File: pspell.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (894 lines) | stat: -rw-r--r-- 32,829 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.23 $ -->

<!-- pspell currently (2001-08-14) doesn't use resources -->
 <reference id="ref.pspell">
  <title>Pspell Functions</title>
  <titleabbrev>Pspell</titleabbrev>

  <partintro>
   <simpara>
    These functions allow you to check the spelling of a word and offer
    suggestions.
   </simpara>
   <simpara>
    You need the aspell and pspell libraries, available from <ulink
    url="&url.aspell;">&url.aspell;</ulink> and
    <ulink url="&url.pspell;">&url.pspell;</ulink> respectively, and
    add the <option role="configure">--with-pspell[=dir]</option> option
    when compiling php.
   </simpara>
  </partintro>

  <refentry id="function.pspell-add-to-personal">
   <refnamediv>
    <refname>pspell_add_to_personal</refname>
    <refpurpose>Add the word to a personal wordlist</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_add_to_personal</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
      <methodparam><type>string</type><parameter>word</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_add_to_personal</function> adds a word to the personal 
     wordlist. If you used <function>pspell_new_config</function> with
     <function>pspell_config_personal</function> to open the dictionary,
     you can save the wordlist later with
     <function>pspell_save_wordlist</function>. Please, note that this function
     will not work unless you have pspell .11.2 and aspell .32.5 or later.
    </simpara>
    <para>
     <example>
      <title><function>pspell_add_to_personal</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
$pspell_link = pspell_new_config ($pspell_config);

pspell_add_to_personal ($pspell_link, "Vlad");
pspell_save_wordlist ($pspell_link);
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-add-to-session">
   <refnamediv>
    <refname>pspell_add_to_session</refname>
    <refpurpose>Add the word to the wordlist in the current session
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_add_to_session</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
      <methodparam><type>string</type><parameter>word</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_add_to_session</function> adds a word to the wordlist
     associated with the current session. It is very similar to
     <function>pspell_add_to_personal</function>
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-check">
   <refnamediv>
    <refname>pspell_check</refname>
    <refpurpose>Check a word</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>pspell_check</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
      <methodparam><type>string</type><parameter>word</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_check</function> checks the spelling of a word
     and returns &true; if the spelling is correct, &false; if not.
    </simpara>
    <para>
     <example>
      <title><function>pspell_check</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_link = pspell_new ("en");

if (pspell_check ($pspell_link, "testt")) {
    echo "This is a valid spelling";
} else {
    echo "Sorry, wrong spelling";
}
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-clear-session">
   <refnamediv>
    <refname>pspell_clear_session</refname>
    <refpurpose>Clear the current session</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_clear_session</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_clear_session</function> clears the current session.
     The current wordlist becomes blank, and, for example, if you try to save
     it with <function>pspell_save_wordlist</function>, nothing happens.
    </simpara>
    <para>
     <example>
      <title><function>pspell_add_to_personal</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
$pspell_link = pspell_new_config ($pspell_config);

pspell_add_to_personal ($pspell_link, "Vlad");
pspell_clear_session ($pspell_link);
pspell_save_wordlist ($pspell_link);    //"Vlad" will not be saved
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-create">
   <refnamediv>
    <refname>pspell_config_create</refname>
    <refpurpose>Create a config used to open a dictionary</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_config_create</methodname>
      <methodparam><type>string</type><parameter>language</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>
        spelling
       </parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>
        jargon
       </parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>
        encoding
       </parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_config_create</function> has a very similar syntax to
     <function>pspell_new</function>. In fact, using 
     <function>pspell_config_create</function> immediatelly followed by 
     <function>pspell_new_config</function> will produce the exact same result.
     However, after creating a new config, you can also use
     <function>pspell_config_*</function> functions before calling
     <function>pspell_new_config</function> to take advantage of some
     advanced functionality.
    </simpara>
    <para>
     The language parameter is the language code which consists of the
     two letter ISO 639 language code and an optional two letter ISO
     3166 country code after a dash or underscore. 
    </para>
    <para>
     The spelling parameter is the requested spelling for languages
     with more than one spelling such as English. Known values are
     'american', 'british', and 'canadian'.
    </para>
    <para>
     The jargon parameter contains extra information to distinguish
     two different words lists that have the same language and
     spelling parameters.
    </para>
    <para>
     The encoding parameter is the encoding that words are expected to
     be in.  Valid values are 'utf-8', 'iso8859-*', 'koi8-r',
     'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned
     32'. This parameter is largely untested, so be careful when
     using.
    </para>
    <para>
     The mode parameter is the mode in which spellchecker will work.
     There are several modes available:
     <itemizedlist>
      <listitem>
       <simpara>
        <constant>PSPELL_FAST</constant> - Fast mode (least number of
        suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <constant>PSPELL_NORMAL</constant> - Normal mode (more suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <constant>PSPELL_BAD_SPELLERS</constant> - Slow mode (a lot of
        suggestions)
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     For more information and examples, check out inline manual pspell
     website:<ulink url="&url.pspell;">&url.pspell;</ulink>.
    </para>
    <para>
     <example>
      <title><function>pspell_config_create</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
pspell_config_repl ($pspell_config, "/var/dictionaries/custom.repl");
$pspell_link = pspell_new_personal ($pspell_config, "en");
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-ignore">
   <refnamediv>
    <refname>pspell_config_ignore</refname>
    <refpurpose>Ignore words less than N characters long</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_config_ignore</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
      <methodparam><type>int</type><parameter>n</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_config_ignore</function> should be used on a config
     before calling <function>pspell_new_config</function>. This function
     allows short words to be skipped by the spellchecker. Words less then
     n characters will be skipped.
    </simpara>
    <para>
     <example>
      <title><function>pspell_config_ignore</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_config = pspell_config_create ("en");
pspell_config_ignore($pspell_config, 5);
$pspell_link = pspell_new_config($pspell_config);
pspell_check($pspell_link, "abcd");    //will not result in an error
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-mode">
   <refnamediv>
    <refname>pspell_config_mode</refname>
    <refpurpose>Change the mode number of suggestions returned</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_config_mode</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
      <methodparam><type>int</type><parameter>mode</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_config_mode</function> should be used on a config
     before calling <function>pspell_new_config</function>. This function
     determines how many suggestions will be returned by 
     <function>pspell_suggest</function>.
    </simpara>
    <para>
     The mode parameter is the mode in which spellchecker will work.
     There are several modes available:
     <itemizedlist>
      <listitem>
       <simpara>
        <constant>PSPELL_FAST</constant> - Fast mode (least number of
        suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <constant>PSPELL_NORMAL</constant> - Normal mode (more suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <constant>PSPELL_BAD_SPELLERS</constant> - Slow mode (a lot of
        suggestions)
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     <example>
      <title><function>pspell_config_mode</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_config = pspell_config_create ("en");
pspell_config_mode($pspell_config, PSPELL_FAST);
$pspell_link = pspell_new_config($pspell_config);
pspell_check($pspell_link, "thecat");
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-personal">
   <refnamediv>
    <refname>pspell_config_personal</refname>
    <refpurpose>Set a file that contains personal wordlist</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_config_personal</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
      <methodparam><type>string</type><parameter>file</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_config_personal</function> should be used on a config
     before calling <function>pspell_new_config</function>. The personal
     wordlist will be loaded and used in addition to the standard one after
     you call <function>pspell_new_config</function>. If the file does not
     exist, it will be created. The file is also the file where
     <function>pspell_save_wordlist</function> will save personal wordlist to.
     The file should be writable by whoever php runs as (e.g. nobody). Please,
     note that this function will not work unless you have pspell .11.2 and
     aspell .32.5 or later.
    </simpara>
    <para>
     <example>
      <title><function>pspell_config_personal</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
$pspell_link = pspell_new_config ($pspell_config);
pspell_check ($pspell_link, "thecat");
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-repl">
   <refnamediv>
    <refname>pspell_config_repl</refname>
    <refpurpose>Set a file that contains replacement pairs</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_config_repl</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
      <methodparam><type>string</type><parameter>file</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_config_repl</function> should be used on a config
     before calling <function>pspell_new_config</function>. The replacement
     pairs improve the quality of the spellchecker. When a word is misspelled,
     and a proper suggestion was not found in the list,
     <function>pspell_store_replacement</function> can be used to store a 
     replacement pair and then <function>pspell_save_wordlist</function> to
     save the wordlist along with the replacement pairs. The file should be
     writable by whoever php runs as (e.g. nobody). Please, note that this
     function will not work unless you have pspell .11.2 and aspell .32.5 or
     later.
    </simpara>
    <para>
     <example>
      <title><function>pspell_config_repl</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
pspell_config_repl ($pspell_config, "/var/dictionaries/custom.repl");
$pspell_link = pspell_new_config ($pspell_config);
pspell_check ($pspell_link, "thecat");
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-runtogether">
   <refnamediv>
    <refname>pspell_config_runtogether</refname>
    <refpurpose>Consider run-together words as valid compounds</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_config_runtogether</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
      <methodparam><type>bool</type><parameter>flag</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_config_runtogether</function> should be used on a config
     before calling <function>pspell_new_config</function>. This function
     determines whether run-together words will be treated as legal
     compounds.  That is, "thecat" will be a legal compound,
     athough there should be a space between the two
     words. Changing this setting only affects the results returned
     by <function>pspell_check</function>;
     <function>pspell_suggest</function> will still return suggestions.
    </simpara>
    <para>
     <example>
      <title><function>pspell_config_runtogether</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_config = pspell_config_create ("en");
pspell_config_runtogether ($pspell_config, true);
$pspell_link = pspell_new_config ($pspell_config);
pspell_check ($pspell_link, "thecat");
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-save-repl">
   <refnamediv>
    <refname>pspell_config_save_repl</refname>
    <refpurpose>Determine whether to save a replacement pairs list
    along with the wordlist</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_config_save_repl</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
      <methodparam><type>bool</type><parameter>flag</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_config_save_repl</function> should be used on a config
     before calling <function>pspell_new_config</function>. It determines
     whether <function>pspell_save_wordlist</function> will save the
     replacement pairs along with the wordlist. Usually there is no need to use
     this function because if <function>pspell_config_repl</function> is used,
     the replacement pairs will be saved by 
     <function>pspell_save_wordlist</function> anyway, and if it is not,
     the replacement pairs will not be saved. Please, note that this function
     will not work unless you have pspell .11.2 and aspell .32.5 or later.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-new">
   <refnamediv>
    <refname>pspell_new</refname>
    <refpurpose>Load a new dictionary</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_new</methodname>
      
      <methodparam><type>string</type><parameter>language</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>
        spelling
       </parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>
        jargon
       </parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>
        encoding
       </parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>
        mode
       </parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_new</function> opens up a new dictionary and
     returns the dictionary link identifier for use in other pspell
     functions.
    </simpara>
    <para>
     The language parameter is the language code which consists of the
     two letter ISO 639 language code and an optional two letter ISO
     3166 country code after a dash or underscore. 
    </para>
    <para>
     The spelling parameter is the requested spelling for languages
     with more than one spelling such as English. Known values are
     'american', 'british', and 'canadian'.
    </para>
    <para>
     The jargon parameter contains extra information to distinguish
     two different words lists that have the same language and
     spelling parameters.
    </para>
    <para>
     The encoding parameter is the encoding that words are expected to
     be in.  Valid values are 'utf-8', 'iso8859-*', 'koi8-r',
     'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned
     32'. This parameter is largely untested, so be careful when
     using.
    </para>
    <para>
     The mode parameter is the mode in which spellchecker will work.
     There are several modes available:
     <itemizedlist>
      <listitem>
       <simpara>
        <constant>PSPELL_FAST</constant> - Fast mode (least number of
        suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <constant>PSPELL_NORMAL</constant> - Normal mode (more suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <constant>PSPELL_BAD_SPELLERS</constant> - Slow mode (a lot of
        suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <constant>PSPELL_RUN_TOGETHER</constant> - Consider run-together words
        as legal compounds.  That is, "thecat" will be a legal compound,
        athough there should be a space between the two words. Changing this
        setting only affects the results returned by
        <function>pspell_check</function>; <function>pspell_suggest</function>
        will still return suggestions.
       </simpara>
      </listitem>
     </itemizedlist>
     Mode is a bitmask constructed from different constants listed above.
     However, <constant>PSPELL_FAST</constant>,
     <constant>PSPELL_NORMAL</constant> and
     <constant>PSPELL_BAD_SPELLERS</constant> are mutually exclusive, so you
     should select only one of them.
    </para>
    <para>
     For more information and examples, check out inline manual pspell
     website:<ulink url="&url.pspell;">&url.pspell;</ulink>.
    </para>
    <para>
     <example>
      <title><function>pspell_new</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_link = pspell_new ("en", "", "", "", 
                           (PSPELL_FAST|PSPELL_RUN_TOGETHER));
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-new-config">
   <refnamediv>
    <refname>pspell_new_config</refname>
    <refpurpose>Load a new dictionary with settings based on a given config
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_new_config</methodname>
      <methodparam><type>int</type><parameter>config</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_new_config</function> opens up a new dictionary with
     settings specified in a config, created with with
     <function>pspell_config_create</function> and modified with
     <function>pspell_config_*</function> functions. This method provides you
     with the most flexibility and has all the functionality provided by
     <function>pspell_new</function> and 
     <function>pspell_new_personal</function>.
    </simpara>
    <para>
     The config parameter is the one returned by
     <function>pspell_config_create</function> when the config was created.
    </para>
    <para>
     <example>
      <title><function>pspell_new_config</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
pspell_config_repl ($pspell_config, "/var/dictionaries/custom.repl");
$pspell_link = pspell_new_config ($pspell_config);
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-new-personal">
   <refnamediv>
    <refname>pspell_new_personal</refname>
    <refpurpose>Load a new dictionary with personal wordlist</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_new_personal</methodname>
      <methodparam><type>string</type><parameter>personal</parameter></methodparam>
      <methodparam><type>string</type><parameter>language</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>
        spelling
       </parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>
        jargon
       </parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>
        encoding
       </parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>
        mode
       </parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_new_personal</function> opens up a new dictionary with
     a personal wordlist and returns the dictionary link identifier for use
     in other pspell functions. The wordlist can be modified and saved with
     <function>pspell_save_wordlist</function>, if desired. However, the
     replacement pairs are not saved. In order to save replacement pairs, you
     should create a config using <function>pspell_config_create</function>,
     set the personal wordlist file with 
     <function>pspell_config_personal</function>, 
     set the file for replacement pairs with 
     <function>pspell_config_repl</function>, and open a new dictionary with
     <function>pspell_new_config</function>.
    </simpara>
    <para>
     The personal parameter specifies the file where words added to the
     personal list will be stored. It should be an absolute filename
     beginning with '/' because otherwise it will be relative to $HOME,
     which is "/root" for most systems, and is probably not what you want.
    </para>
    <para>
     The language parameter is the language code which consists of the
     two letter ISO 639 language code and an optional two letter ISO
     3166 country code after a dash or underscore. 
    </para>
    <para>
     The spelling parameter is the requested spelling for languages
     with more than one spelling such as English. Known values are
     'american', 'british', and 'canadian'.
    </para>
    <para>
     The jargon parameter contains extra information to distinguish
     two different words lists that have the same language and
     spelling parameters.
    </para>
    <para>
     The encoding parameter is the encoding that words are expected to
     be in.  Valid values are 'utf-8', 'iso8859-*', 'koi8-r',
     'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned
     32'. This parameter is largely untested, so be careful when
     using.
    </para>
    <para>
     The mode parameter is the mode in which spellchecker will work.
     There are several modes available:
     <itemizedlist>
      <listitem>
       <simpara>
        <constant>PSPELL_FAST</constant> - Fast mode (least number of
        suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <constant>PSPELL_NORMAL</constant> - Normal mode (more suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <constant>PSPELL_BAD_SPELLERS</constant> - Slow mode (a lot of
        suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <constant>PSPELL_RUN_TOGETHER</constant> - Consider run-together words
        as legal compounds.  That is, "thecat" will be a legal compound,
        athough there should be a space between the two words. Changing this
        setting only affects the results returned by
        <function>pspell_check</function>; <function>pspell_suggest</function>
        will still return suggestions.
       </simpara>
      </listitem>
     </itemizedlist>
     Mode is a bitmask constructed from different constants listed above.
     However, <constant>PSPELL_FAST</constant>,
     <constant>PSPELL_NORMAL</constant> and
     <constant>PSPELL_BAD_SPELLERS</constant> are mutually exclusive, so you
     should select only one of them.
    </para>
    <para>
     For more information and examples, check out inline manual pspell
     website:<ulink url="&url.pspell;">&url.pspell;</ulink>.
    </para>
    <para>
     <example>
      <title><function>pspell_new_personal</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_link = pspell_new_personal ("/var/dictionaries/custom.pws", 
        "en", "", "", "", PSPELL_FAST|PSPELL_RUN_TOGETHER));
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-save-wordlist">
   <refnamediv>
    <refname>pspell_save_wordlist</refname>
    <refpurpose>Save the personal wordlist to a file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_save_wordlist</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_save_wordlist</function> saves the personal wordlist
     from the current session. The dictionary has to be open with
     <function>pspell_new_personal</function>, and the location of files to be
     saved specified with <function>pspell_config_personal</function> and 
     (optionally) <function>pspell_config_repl</function>. Please, note that
     this function will not work unless you have pspell .11.2 and aspell .32.5
     or later.
    </simpara>
    <para>
     <example>
      <title><function>pspell_add_to_personal</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/tmp/dicts/newdict");
$pspell_link = pspell_new_config ($pspell_config);

pspell_add_to_personal ($pspell_link, "Vlad");
pspell_save_wordlist ($pspell_link);
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-store-replacement">
   <refnamediv>
    <refname>pspell_store_replacement</refname>
    <refpurpose>Store a replacement pair for a word</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>pspell_store_replacement</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
      <methodparam><type>string</type><parameter>misspelled</parameter></methodparam>
      <methodparam><type>string</type><parameter>correct</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_store_replacement</function> stores a replacement pair for
     a word, so that replacement can be returned by
     <function>pspell_suggest</function> later. In order to be able to take
     advantage of this function, you have to use 
     <function>pspell_new_personal</function> to open the dictionary. In order
     to permanently save the replacement pair, you have to
     use <function>pspell_config_personal</function> and
     <function>pspell_config_repl</function> to set the path where to save your
     custom wordlists, and then use <function>pspell_save_wordlist</function>
     for the changes to be written to disk. Please, note that this function
     will not work unless you have pspell .11.2 and aspell .32.5 or later.
    </simpara>
    <para>
     <example>
      <title><function>pspell_store_replacement</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
pspell_config_repl ($pspell_config, "/var/dictionaries/custom.repl");
$pspell_link = pspell_new_config ($pspell_config);

pspell_store_replacement ($pspell_link, $misspelled, $correct);
pspell_save_wordlist ($pspell_link);
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-suggest">
   <refnamediv>
    <refname>pspell_suggest</refname>
    <refpurpose>Suggest spellings of a word</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>array</type><methodname>pspell_suggest</methodname>
      <methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
      <methodparam><type>string</type><parameter>word</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>pspell_suggest</function> returns an array of possible
     spellings for the given word.
    </simpara>
    <para>
     <example>
      <title><function>pspell_suggest</function></title>
      <programlisting role="php">
<![CDATA[
$pspell_link = pspell_new ("en");

if (!pspell_check ($pspell_link, "testt")) {
    $suggestions = pspell_suggest ($pspell_link, "testt");

    foreach ($suggestions as $suggestion) {
        echo "Possible spelling: $suggestion<br>"; 
    }
}
]]>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->