File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 88 "remove_repeated_ngrams"
99]
1010
11- from pythainlp .lm .text_util import calculate_ngram_counts ,remove_repeated_ngrams
11+ from pythainlp .lm .text_util import calculate_ngram_counts , remove_repeated_ngrams
Original file line number Diff line number Diff line change 99
1010def calculate_ngram_counts (
1111 list_words : List [str ],
12- n_min : int = 2 ,
13- n_max : int = 4 )-> Dict [Tuple [str ], int ]:
12+ n_min : int = 2 ,
13+ n_max : int = 4 )-> Dict [Tuple [str ], int ]:
1414 """
1515 Calculates the counts of n-grams in the list words for the specified range.
1616
@@ -26,7 +26,7 @@ def calculate_ngram_counts(
2626
2727 for n in range (n_min , n_max + 1 ):
2828 for i in range (len (list_words ) - n + 1 ):
29- ngram = tuple (list_words [i :i + n ])
29+ ngram = tuple (list_words [i :i + n ])
3030 ngram_counts [ngram ] = ngram_counts .get (ngram , 0 ) + 1
3131
3232 return ngram_counts
You can’t perform that action at this time.
0 commit comments