微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

问题标记 POS

如何解决问题标记 POS

我正在尝试标记 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: 

错误信息截图

the error message

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。