Skip to content

Commit 3ad110c

Browse files
committed
fix open file
1 parent f7e3640 commit 3ad110c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pythainlp/postaggers/text.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
from nine import nimport,str
33
from pythainlp.segment import segment
44
import pythainlp
5+
import codecs
56
import os
67
json= nimport('json')
78
import nltk.tag, nltk.data
89
templates_dir = os.path.join(os.path.dirname(pythainlp.__file__), 'corpus')
910
template_file = os.path.join(templates_dir, 'thaipos.json')
1011
#default_tagger = nltk.data.load(nltk.tag._POS_TAGGER)
1112
def data():
12-
with open(template_file) as handle:
13+
with codecs.open(template_file,'r',encoding='utf-8') as handle:
1314
model = json.load(handle)
1415
return model
1516
data1 =data()

0 commit comments

Comments
 (0)