我正在尝试标记 POS,但结果返回给我一个错误,我什至不知道该怎么做:/ 谁能帮我找出哪里出错了..?
标记位置
api = KhaiiiApi()
significant_tags = ['NNG', 'NNP', 'NNB', 'VV', 'VA', 'VX', 'MAG', 'MAJ', 'XSV', 'XSA']
def pos_text(texts):
corpus = []
for sent in texts:
pos_tagged = ''
for word in api.analyze(sent):
for morph in word.morphs:
if morph.tag in significant_tags:
pos_tagged += morph.lex + '/' + morph.tag + ' '
corpus.append(pos_tagged.strip())
return corpus
pos_post = pos_text(post_checked)
检查 pos_post 状态
for i in range(0, 10):
print(pos_post[i])
错误信息:/
KhaiiiExcept Traceback (most recent call last)
<ipython-input-102-f58ea9e1df6f> in <module>
15 return corpus
16
---> 17 pos_post = pos_text(post_checked)
18
19 # check pos_post status
<ipython-input-102-f58ea9e1df6f> in pos_text(texts)
8 for sent in texts:
9 pos_tagged = ''
---> 10 for word in api.analyze(sent):
11 for morph in word.morphs:
12 if morph.tag in significant_tags:
/opt/anaconda3/lib/python3.7/site-packages/khaiii/khaiii.py in analyze(self, in_str, opt_str)
224 opt_str.encode('UTF-8'))
225 if not results:
--> 226 raise KhaiiiExcept(self._last_error())
227 words = self._make_words(in_str, results)
228 self._free_results(results)
KhaiiiExcept: