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
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.14 $ -->
<!-- pspell currently (2001-08-14) doesn't use resources -->
<reference id="ref.pspell">
<title>Pspell関数</title>
<titleabbrev>Pspell</titleabbrev>
<partintro>
<simpara>
これらの関数により、単語のスペルチェックを行い、修正案を提案させる
ことが可能となります。
</simpara>
<simpara>
aspellライブラリおよびpspellライブラリが必要です。これらは、それぞ
れ <ulink url="&url.aspell;">&url.aspell;</ulink>および
<ulink url="&url.pspell;">&url.pspell;</ulink> で取得可能です。
そして、PHPをコンパイルする際にオプション
<option role="configure">--with-pspell[=dir]</option>を追加する必
要があります。
</simpara>
</partintro>
<refentry id="function.pspell-add-to-personal">
<refnamediv>
<refname>pspell_add_to_personal</refname>
<refpurpose>ユーザの単語リストに単語を追加</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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> はユーザの単語リスト
に単語を追加します。ディレクトリをオープンするために
<function>pspell_new_config</function>を
<function>pspell_config_personal</function>とともに使用した場合、
<function>pspell_save_wordlist</function>で単語リストを保存するこ
とが可能です。この関数は、pspell .11.2 と aspell .32.5 以降でない
限り動作しないことに注意して下さい。
</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>
カレントのセッションの単語リストに単語を追加
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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>は、カレントのセッショ
ンに関連する単語リストに単語を追加します。この関数は、
<function>pspell_add_to_personal</function>に似ています。
</simpara>
</refsect1>
</refentry>
<refentry id="function.pspell-check">
<refnamediv>
<refname>pspell_check</refname>
<refpurpose>単語をチェックする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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> は単語のスペルをチェックし、ス
ペルが正しい場合に&true;、そうでない場合に&false;を返します。
</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>カレントのセッションをクリアする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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> はカレントのセッション
をクリアします。カレントの単語リストは、ブランクになり、この場合、
例えば、<function>pspell_save_wordlist</function>でこのリストを保
存しても何も置きません。
</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" は保存されません。
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.pspell-config-create">
<refnamediv>
<refname>pspell_config_create</refname>
<refpurpose>辞書をオープンする際に使用される設定を作成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>pspell_config_create</methodname>
<methodparam><type>string</type><parameter>language</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>spelling</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>jargon</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>encoding</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<simpara>
<function>pspell_config_create</function>は、
<function>pspell_new</function>の構文に非常によく似ています。実際、
<function>pspell_new_config</function>の直後に
<function>pspell_config_create</function>を使用した場合、全く同じ
結果となります。しかし、新しい設定を作成した後、いくつかの新しい
機能を使用するために<function>pspell_new_config</function>をコー
ルする前に関数<function>pspell_config_*</function>を使用すること
も可能です。
</simpara>
<para>
パラメータ<parameter>language</parameter>は、2文字のISO 639言語コー
ドとオプションでダッシュまたはアンダースコアの後に2文字のISO 3166
国コードからなる言語コードです。
</para>
<para>
パラメータ<parameter>spelling</parameter>は、英語のように複数のス
ペルがある言語に関してスペルの指定を行うものです。指定可能な値は、
'american', 'british', 'canadian'です。
</para>
<para>
パラメータ<parameter>jargon</parameter>は、同じlanguageおよび
spellingパラメータを有する2つの異なる単語リストを区別するための追
加情報を有しています。
</para>
<para>
パラメータ<parameter>encoding</parameter>は、単語のエンコーディン
グとして予想されるものです。有効な値は、'utf-8', 'iso8859-*',
'koi8-r', 'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned
32'です。このパラメータはよくテストされていないため、使用する際に
は注意して下さい。
</para>
<para>
パラメータ<parameter>mode</parameter>は、スペルチェッカの動作モー
ドです。以下に示す複数のモードを使用可能です。
<itemizedlist>
<listitem>
<simpara>
PSPELL_FAST - 高速モード (修正候補の数は最小)
</simpara>
</listitem>
<listitem>
<simpara>
PSPELL_NORMAL - 通常モード (修正候補はより多い)
</simpara>
</listitem>
<listitem>
<simpara>
PSPELL_BAD_SPELLERS - 低速モード (修正候補は多い)
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
より詳細な情報と例については、pspell Webサイト<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>長さがN文字未満の単語を無視する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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"); // エラーを生じません
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.pspell-config-mode">
<refnamediv>
<refname>pspell_config_mode</refname>
<refpurpose>返される提案の数のモードを変更する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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> は、
<function>pspell_new_config</function>をコールする前に設定するた
めに使用する必要があります。この関数は、
<function>pspell_suggest</function>により返される修正候補の数を定
義します。
</simpara>
<para>
パラメータ<parameter>mode</parameter>は、スペルチェッカの動作モー
ドです。以下に示す複数のモードを使用可能です。
<itemizedlist>
<listitem>
<simpara>
PSPELL_FAST - 高速モード (修正候補の数は最小)
</simpara>
</listitem>
<listitem>
<simpara>
PSPELL_NORMAL - 通常モード (修正候補はより多い)
</simpara>
</listitem>
<listitem>
<simpara>
PSPELL_BAD_SPELLERS - 低速モード (修正候補は多い)
</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>個人の単語リストを保持するファイルを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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> は、
<function>pspell_new_config</function>をコールする前に設定を行う
ために使用する必要があります。個人の単語リストは、
<function>pspell_new_config</function>をコールした後にロードされ、
標準的な単語リストに追加されて使用されます。fileが存在しない場合、
このファイルは作成されます。このファイルは、
<function>pspell_save_wordlist</function> により個人的な単語リスト
が保存されるファイルでもあります。ファイルは、PHPの実行ユーザー(
例:nobody)により書き込み可能である必要があります。この関数は、
pspell .11.2 および aspell .32.5 以降でない限り、動作しないことに
注意して下さい。
</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>置換候補を保持するファイルを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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> は、
<function>pspell_new_config</function>をコールする前に設定を行う
ために使用する必要があります。置換の組は、スペルチェッカの品質を
改善します。単語のスペルミスをした場合、そして、適当な修正候補が
リストにあった場合、<function>pspell_store_replacement</function>
を置換候補を保存するために使用し、置換候補を含む単語リストを保存
するために <function>pspell_save_wordlist</function>を使用するこ
とが可能です。fileは、PHPの実行ユーザー(例:nobody)により書き込み
可能である必要があります。この関数は、pspell .11.2 および aspell
.32.5 以降でない限り、動作しないことに注意して下さい。
</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> 複合語を有効な単語の組み合わせとして考慮する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>pspell_config_runtogether</methodname>
<methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
<methodparam><type>boolean</type><parameter>flag</parameter></methodparam>
</methodsynopsis>
<simpara>
<function>pspell_config_runtogether</function> は、
<function>pspell_new_config</function>をコールする前に設定を行う
ために使用する必要があります。この関数は、複合語を正しい複合語と
して処理するかどうかを定義します。つまり、"thecat" には、二つの単
語の間に空白はありませんが、正しい複合語となります。この設定の変
更は、<function>pspell_check</function>による返り値にのみ影響を与
えます。<function>pspell_suggest</function> は、この場合でも修正
候補を返します。
</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>
単語リストと共に置換リストを保存するかどうかを定義する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>pspell_config_save_repl</methodname>
<methodparam><type>int</type><parameter>dictionary_link</parameter></methodparam>
<methodparam><type>boolean</type><parameter>flag</parameter></methodparam>
</methodsynopsis>
<simpara>
<function>pspell_config_save_repl</function> は、
<function>pspell_new_config</function>をコールする前に設定を行う
ために使用する必要があります。この関数は、
<function>pspell_save_wordlist</function> が単語リストと共に置換
リストを保存するかどうかを定義します。
<function>pspell_config_repl</function>を使用した場合、置換の組は
<function>pspell_save_wordlist</function>により保存され、そうでな
い場合には、置換の組は保存されないため、通常はこの関数を使用する
必要はありません。この関数は、pspell .11.2およびaspell .32.5 以降
を有していない場合には動作しないことに注意して下さい。
</simpara>
</refsect1>
</refentry>
<refentry id="function.pspell-new">
<refnamediv>
<refname>pspell_new</refname>
<refpurpose>新規辞書をロードする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>pspell_new</methodname>
<methodparam><type>string</type><parameter>language</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>spelling</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>jargon</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>encoding</optional></replaceable>
</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>mode</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<simpara>
<function>pspell_new</function>は、新規の辞書をロードし、辞書リン
クIDを返します。このリンクIDは、他のpspell関数で使用されます。
</simpara>
<para>
パラメータlanguageは、2文字のISO 639言語コードおよびオプションで
ダッシュまたはアンダースコアの後に2文字のISO 3166 国コードを加え
たものからなる言語コードです。
</para>
<para>
パラメータspellingは、英語のように
複数の表記を有する言語について表記を指定します。既知の値は、
``american'',``britsh'', ``canadian''があります。
</para>
<para>
パラメータjargonには、同じlanguageおよびspellingを有する異なる2種
類の単語に関する追加情報を有しています。
</para>
<para>
encodingパラメータは、その単語が属していると予想されるエンコーディ
ングです。有効な値は、'utf-8', 'iso8859-*', 'koi8-r', 'viscii',
'cp1252', 'machine unsigned 16', 'machine unsigned 32'です。この
パラメータはあまりテストされていないため、使用に際しては注意を要
します。
</para>
<para>
パラメータmodeは、スペルチェッカの動作モードです。以下の複数のモー
ドを使用可能です。
<itemizedlist>
<listitem>
<simpara>
PSPELL_FAST - 高速モード (修正候補の数は最小)
</simpara>
</listitem>
<listitem>
<simpara>
PSPELL_NORMAL - 通常モード (修正候補はより多い)
</simpara>
</listitem>
<listitem>
<simpara>
PSPELL_BAD_SPELLERS - 低速モード (修正候補は多い)
</simpara>
</listitem>
<listitem>
<simpara>
PSPELL_RUN_TOGETHER - 継った単語を複合語(legal compound)とし
て考慮します。この場合、"thecat" には二つの単語の間に空白はあ
りませんが複合語となります。この設定の変更は、
<function>pspell_check</function>から返される結果にのみ影響し
ます。設定変更後も<function>pspell_suggest</function>は修正候
補を返します。
</simpara>
</listitem>
</itemizedlist>
mode は、上記の異なる定数を用いたビットマスクです。
しかし、PSPELL_FAST、PSPELL_NORMAL、PSPELL_BAD_SPELLERS は
相反するため、この中の一つを選択する必要があります。
</para>
<para>
詳細な情報および例については、pspellのWebサイト
:<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>
指定した設定に基づき新規辞書をロードする
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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> は、
<function>pspell_config_create</function>で作成され、
関数<function>pspell_config_*</function>で修正された設定を使用し
て新規辞書をオープンします。この方法は、最も柔軟で、
<function>pspell_new</function> および
<function>pspell_new_personal</function>で提供された全ての機能を
有しています。
</simpara>
<para>
パラメータ config は、configが作成された際に
<function>pspell_config_create</function>により返されたパラメータ
です。
</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_personal ($pspell_config, "en");
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.pspell-new-personal">
<refnamediv>
<refname>pspell_new_personal</refname>
<refpurpose>個人の単語リストを有する新規辞書をロードする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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><type>string</type><parameter>
<replaceable><optional>spelling</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>jargon</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>encoding</optional></replaceable>
</parameter></methodparam>
<methodparam><type>int</type><parameter>
<replaceable><optional>mode</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<simpara>
<function>pspell_new_personal</function> は、個人の単語リストと共
に新規辞書をオープンし、辞書リンクIDを返します。このIDは他の
pspell関数で使用されます。単語リストは修正可能で、必要に応じて
<function>pspell_save_wordlist</function>で保存することも可能です。
しかし、置換の組は保存されません。置換の組を保存するには、
<function>pspell_config_create</function>を用いて設定を作成し、
<function>pspell_config_personal</function>で個人の単語リストを設
定し、<function>pspell_config_repl</function>で置換のファイルを設
定し、<function>pspell_new_config</function>で新規の辞書をオープ
ンします。
</simpara>
<para>
パラメータpersonalは、個人リストに追加された単語が保存される場所
を指定します。この場所には、'/'で始まる絶対パスのファイル名を指定
する必要があります。これは、そうでない場合、$HOMEに相対パスになり、
これは、多くのシステムでは、"/root"であるため、恐らく望ましい結果
とはならないためです。
</para>
<para>
パラメータlanguageは、2文字のISO 639言語コードおよびオプションで
ダッシュまたはアンダースコアの後に2文字のISO 3166 国コードを加え
たものからなる言語コードです。
</para>
<para>
パラメータspellingは、英語のように
複数の表記を有する言語について表記を指定します。既知の値は、
``american'',``britsh'', ``canadian''があります。
</para>
<para>
パラメータjargonには、同じlanguageおよびspellingを有する異なる2種
類の単語に関する追加情報を有しています。
</para>
<para>
encodingパラメータは、その単語が属していると予想されるエンコーディ
ングです。有効な値は、'utf-8', 'iso8859-*', 'koi8-r', 'viscii',
'cp1252', 'machine unsigned 16', 'machine unsigned 32'です。この
パラメータはあまりテストされていないため、使用に際しては注意を要
します。
</para>
<para>
パラメータ<parameter>mode</parameter>は、スペルチェッカの動作モー
ドです。以下に示す複数のモードを使用可能です。
<itemizedlist>
<listitem>
<simpara>
PSPELL_FAST - 高速モード (修正候補の数は最小)
</simpara>
</listitem>
<listitem>
<simpara>
PSPELL_NORMAL - 通常モード (修正候補はより多い)
</simpara>
</listitem>
<listitem>
<simpara>
PSPELL_BAD_SPELLERS - 低速モード (修正候補は多い)
</simpara>
</listitem>
<listitem>
<simpara>
PSPELL_RUN_TOGETHER - 継った単語を複合語(legal compound)とし
て考慮します。この場合、"thecat" には二つの単語の間に空白はあ
りませんが複合語となります。この設定の変更は、
<function>pspell_check</function>から返される結果にのみ影響し
ます。設定変更後も<function>pspell_suggest</function>は修正候
補を返します。
</simpara>
</listitem>
</itemizedlist>
mode は、上記の異なる定数を用いたビットマスクです。
しかし、PSPELL_FAST、PSPELL_NORMAL、PSPELL_BAD_SPELLERS は
相反するため、この中の一つを選択する必要があります。
</para>
<para>
詳細な情報および例については、pspellのWebサイト
:<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>個人の単語リストをファイルに保存する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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> は、カレントのセッショ
ンから個人の単語リストを保存します。辞書は、
<function>pspell_new_personal</function>によりオープンされている
必要があり、ファイルの位置は、
<function>pspell_config_personal</function>および(オプションで)
<function>pspell_config_repl</function>で保存されている必要があり
ます。この関数は、pspell .11.2 および aspell .32.5以降がない限り
動作しないことに注意して下さい。
</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>単語を置換するものを保存する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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> は、単語の置換候補
を保存します。これにより、この後の
<function>pspell_suggest</function>では、置換候補を返すことが可能
となります。この関数の利点を活かすためには、辞書をオープンする際
に<function>pspell_new_personal</function>を使用する必要がありま
す。置換候補を恒久的に保存するためには、
<function>pspell_config_personal</function>を使用する必要があり、
<function>pspell_config_repl</function>によりカスタム単語リストを
保存するパスを設定し、この後、変更点をディスクへ書き込むために
<function>pspell_save_wordlist</function>を使用する必要があります。
この関数は、pspell .11.2 および aspell .32.5 以降でない限り動作し
ないことに注意して下さい。
</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>単語のスペルについて修正候補を示す</refpurpose>
</refnamediv>
<refsect1>
<title>説明</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> は、指定した単語について可能
性のあるスペルの配列を返します。
</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:
-->
|