(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
pspell_store_replacement — 儲存單字的取代配對
pspell_store_replacement() 會儲存一個單字的替換配對,以便之後 pspell_suggest() 可以返回該替換。為了利用這個函式,您必須使用 pspell_new_personal() 來開啟字典。為了永久儲存替換配對,您必須使用 pspell_config_personal() 和 pspell_config_repl() 設定儲存自訂詞彙列表的路徑,然後使用 pspell_save_wordlist() 將變更寫入磁碟。
版本 | 描述 |
---|---|
8.1.0 | dictionary 參數現在需要一個 PSpell\Dictionary 實例;先前需要的是 資源。 |
範例 #1 pspell_store_replacement()
<?php
$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 = pspell_new_config($pspell_config);
pspell_store_replacement($pspell, $misspelled, $correct);
pspell_save_wordlist($pspell);
?>
注意:
除非您擁有 pspell .11.2 和 aspell .32.5 或更高版本,否則此函式將無法運作。