PHP Velho Oeste 2024

pspell_add_to_personal

(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)

pspell_add_to_personalFügt der persönlichen Wortliste ein Wort hinzu

Beschreibung

pspell_add_to_personal(PSpell\Dictionary $dictionary, string $word): bool

pspell_add_to_personal() fügt der persönlichen Wortliste ein Wort hinzu. Falls pspell_new_config() mit pspell_config_personal() verwendet wurde, um das Wörterbuch zu öffnen, kann die Wortliste später mit pspell_save_wordlist() gespeichert werden.

Parameter-Liste

dictionary

Eine PSpell\Dictionary-Instanz.

word

Das hinzugefügte Wort.

Rückgabewerte

Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.

Changelog

Version Beschreibung
8.1.0 Der Parameter dictionary erwartet nun eine PSpell\Dictionary-Instanz; vorher wurde eine Ressource erwartet.

Beispiele

Beispiel #1 pspell_add_to_personal()-Beispiel

<?php
$pspell_config
= pspell_config_create("de");
pspell_config_personal($pspell_config, "/var/dictionaries/custom.pws");
$pspell = pspell_new_config($pspell_config);

pspell_add_to_personal($pspell, "Vlad");
pspell_save_wordlist($pspell);
?>

Anmerkungen

Hinweis:

Diese Funktion funktioniert nur mit pspell .11.2 und aspell .32.5 oder höher.

add a note add a note

User Contributed Notes 1 note

up
0
canhnm at opensource dot com dot vn
4 years ago
Add personal dictionary word does not support a part of number?

Example I would like to have "covid-19" in my personal dictionary.

Then there will be error:
Message:  pspell_add_to_personal(): pspell_add_to_personal() gave error: The word &quot;covid-19&quot; is invalid. The character '-' (U+2D) may not appear in the middle of a word
To Top