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: ['เอา', 'แบบ', 'ไหน']