pythainlp.spell¶
The pythainlp.spell finds the closest correctly spelled word to the given text.
Modules¶
-
class
pythainlp.spell.NorvigSpellChecker(custom_dict: Optional[List[Tuple[str, int]]] = None, min_freq: int = 2, min_len: int = 2, max_len: int = 40, dict_filter: Callable[[str], bool] = <function _is_thai_and_not_num>)[source]¶ -
correct(word: str) → str[source]¶ Return the most possible word, using the probability from the spelling dictionary
- Parameters
word (str) – A word to correct its spelling
-
dictionary() → List[Tuple[str, int]][source]¶ Return the spelling dictionary currently used by this spell checker
-
freq(word: str) → int[source]¶ Return frequency of an input word, according to the spelling dictionary
- Parameters
word (str) – A word to check its frequency
-
known(words: List[str]) → List[str][source]¶ Return a list of given words that found in the spelling dictionary
- Parameters
words (str) – A list of words to check if they are in the spelling dictionary
-
-
pythainlp.spell.DEFAULT_SPELL_CHECKER= Default instance of standard NorvigSpellChecker, using word list from Thai National Corpus¶