Source code for pythainlp.spell

# -*- coding: utf-8 -*-
"""
Spell checking
"""

from typing import List

from .pn import DEFAULT_SPELL_CHECKER, NorvigSpellChecker

__all__ = ["DEFAULT_SPELL_CHECKER", "correct", "spell", "NorvigSpellChecker"]


[docs]def spell(word: str, engine: str = "pn") -> List[str]: """ :param str word: word to check spelling :param str engine: * pn - Peter Norvig's algorithm (default) :return: list of words """ return DEFAULT_SPELL_CHECKER.spell(word)
[docs]def correct(word: str, engine: str = "pn") -> str: """ :param str word: word to correct spelling :param str engine: * pn - Peter Norvig's algorithm (default) :return: the corrected word """ return DEFAULT_SPELL_CHECKER.correct(word)