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 11
11
import re
12
12
def MetaSound (name ):
13
13
'''
14
- MetaSound(str) ภาษาไทย
15
-
16
- >>> MetaSound('รัก')
17
- '501'
18
- >>> MetaSound('ลัก')
19
- '501'
14
+ Thai MetaSound
20
15
16
+ :param str name: thai text
17
+ :return: MetaSound for thai text
21
18
'''
22
19
name1 = list (name )
23
20
count = len (name1 )
@@ -58,4 +55,4 @@ def MetaSound(name):
58
55
return '' .join (name1 )
59
56
if __name__ == '__main__' :
60
57
print (MetaSound ('รัก' ))
61
- print (MetaSound ('ลัก' ))
58
+ print (MetaSound ('ลัก' ))
Original file line number Diff line number Diff line change 4
4
from pythainlp .rank import rank
5
5
def find_keyword (word_list ,lentext = 3 ):
6
6
'''
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
13
10
'''
14
11
filtered_words = [word for word in word_list if word not in set (stopwords .words ('thai' ))]
15
12
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