pythainlp.lm
Modules
- pythainlp.lm.calculate_ngram_counts(list_words: List[str], n_min: int = 2, n_max: int = 4) Dict[Tuple[str], int] [source]
Calculates the counts of n-grams in the list words for the specified range.
- pythainlp.lm.remove_repeated_ngrams(string_list: List[str], n: int = 2) List[str] [source]
Remove repeated n-grams
- Parameters:
- Returns:
List of string
- Return type:
List[str]
- Example:
from pythainlp.lm import remove_repeated_ngrams remove_repeated_ngrams(['เอา', 'เอา', 'แบบ', 'ไหน'], n=1) # output: ['เอา', 'แบบ', 'ไหน']