问题描述
我正在尝试标记 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:
错误信息截图
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)