Esempio n. 1
0
 def test_rank(self):
     self.assertEqual(rank([]), None)
     self.assertEqual(
         rank(["แมว", "คน", "แมว"]), Counter({"แมว": 2, "คน": 1})
     )
     self.assertIsNotNone(
         rank(["แมว", "คน", "แมว"], exclude_stopwords=True)
     )
Esempio n. 2
0
def frequency_word_pythai(list_word, i):
    d = rank(list_word)
    # print (fdist1.most_common(100))
    # z=fdist1.most_common(25)
    df = pd.DataFrame(list(d.items()), columns=["Word", "count"])
    # df.to_csv(f'{i+1}.csv')
    print(df)
    return df
Esempio n. 3
0
 def repeatWords(self, cutWords):
     WordsRepeat = rank(cutWords)
     return WordsRepeat
Esempio n. 4
0
 def test_rank(self):
     self.assertEqual(rank([]), None)
     self.assertEqual(rank(["แมว", "คน", "แมว"]), Counter({"แมว": 2, "คน": 1}))
     self.assertIsNotNone(rank(["แมว", "คน", "แมว"], exclude_stopwords=True))