issues tagging POS

60 Views Asked by At

I'm trying to tag POS but results returns me an error I don't even know what to do about :/ can anyone help me find out where went wrong..?

tagging 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)

check pos_post status

 for i in range(0, 10):
    print(pos_post[i])

the error message :/

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: 

screenshot of the error message

the error message

0

There are 0 best solutions below