Skip to content

Commit 16cfbb1

Browse files
committed
check split line before append
1 parent e2c3390 commit 16cfbb1

File tree

3 files changed

+10
-1329
lines changed

3 files changed

+10
-1329
lines changed

pythainlp/corpus/tnc.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ def word_freqs() -> List[Tuple[str, int]]:
6464
Get word frequency from Thai National Corpus (TNC)
6565
"""
6666
lines = list(get_corpus(_FILENAME))
67-
listword = []
67+
word_freqs = []
6868
for line in lines:
69-
listindata = line.split("\t")
70-
listword.append((listindata[0], int(listindata[1])))
69+
word_freq = line.split("\t")
70+
if len(word_freq) >= 2:
71+
word_freqs.append((word_freq[0], int(word_freq[1])))
7172

72-
return listword
73+
return word_freqs

0 commit comments

Comments
 (0)