File tree Expand file tree Collapse file tree 2 files changed +8
-14
lines changed
Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Original file line number Diff line number Diff line change 1111import re
1212def MetaSound (name ):
1313 '''
14- MetaSound(str) ภาษาไทย
15-
16- >>> MetaSound('รัก')
17- '501'
18- >>> MetaSound('ลัก')
19- '501'
14+ Thai MetaSound
2015
16+ :param str name: thai text
17+ :return: MetaSound for thai text
2118 '''
2219 name1 = list (name )
2320 count = len (name1 )
@@ -58,4 +55,4 @@ def MetaSound(name):
5855 return '' .join (name1 )
5956if __name__ == '__main__' :
6057 print (MetaSound ('รัก' ))
61- print (MetaSound ('ลัก' ))
58+ print (MetaSound ('ลัก' ))
Original file line number Diff line number Diff line change 44from pythainlp .rank import rank
55def find_keyword (word_list ,lentext = 3 ):
66 '''
7- ระบบค้นหาคำสำคัญ
8- หลักการ ลบ stopword ออกแล้ว นับจำนวนคำที่ส่งค่าออกมา
9-
10- find_keyword(word_list,lentext=3)
11- word_list คือ คำที่อยู่ใน list
12- lentext คือ จำนวนคำที่มีอยู่ใน list สำหรับใช้กำหนดค่าหา keyword ค่าเริ่มต้นคือ 3
7+ :param list word_list: a list of thai text
8+ :param int lentext: a number of keyword
9+ :return: dict
1310 '''
1411 filtered_words = [word for word in word_list if word not in set (stopwords .words ('thai' ))]
1512 word_list = rank (filtered_words )
16- return {k :v for k , v in word_list .items () if v >= lentext }
13+ return {k :v for k , v in word_list .items () if v >= lentext }
You can’t perform that action at this time.
0 commit comments