File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 22from __future__ import absolute_import ,unicode_literals ,print_function
33import sys
44import six
5- if six .PY2 :
6- print ("Thai sentiment in pythainlp. Not support Python 2" )
7- sys .exit (0 )
85try :
96 from wordcut import Wordcut
107except ImportError :
118 '''
129 ในกรณีที่ยังไม่ติดตั้ง wordcutpy ในระบบ
1310 '''
1411 from pythainlp .tools import install_package
15- install_package (' wordcutpy' )
12+ install_package (" wordcutpy" )
1613 try :
1714 from wordcut import Wordcut
1815 except ImportError :
19- sys . exit ( 'Error ! using $ pip install wordcutpy' )
16+ raise Exception ( "ImportError ! using $ pip install wordcutpy" )
2017
2118def segment (text , data = None ):
2219 if not data :
2320 wordcut = Wordcut .bigthai ()
2421 else :
2522 word_list = list (set (data ))
2623 wordcut = Wordcut (word_list )
27- return wordcut .tokenize (text )
24+ return wordcut .tokenize (text )
You can’t perform that action at this time.
0 commit comments