Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unhandled error in opencorpora.reader #1

Open
kmike opened this issue Nov 27, 2016 · 0 comments
Open

unhandled error in opencorpora.reader #1

kmike opened this issue Nov 27, 2016 · 0 comments

Comments

@kmike
Copy link
Owner

kmike commented Nov 27, 2016

Из pymorphy2/pymorphy2#48:

kdruzhkin@Rhodos:~$ ipython
In [1]: import opencorpora
In [2]: corpus = opencorpora.CorpusReader('annot.opcorpora.xml')
In [3]: tws = corpus.iter_tagged_words()
In [4]: for tw in tws: pass
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-58b1ffe6da49> in <module>()
----> 1 for tw in x: pass

/usr/local/lib/python3.4/dist-packages/opencorpora/reader.py in _doc_iterator(self, fileids, categories, doc_method)
    214         for doc in self.iter_documents(fileids, categories, _destroy=True):
    215             meth = getattr(doc, doc_method)
--> 216             for res in meth():
    217                 yield res
    218 

/usr/local/lib/python3.4/dist-packages/opencorpora/reader.py in iter_tagged_words(self)
    110 
    111     def iter_tagged_words(self):
--> 112         return itertools.chain(*self.iter_tagged_sents())
    113 
    114     def iter_parsed_words(self):

/usr/local/lib/python3.4/dist-packages/opencorpora/reader.py in _sentence_tagged_words(sent_elem)
     37         text = text_type(tok.get('text'))
     38         parse = tok.find('*//l')
---> 39         tag = text_type(',').join(_grammemes(parse))
     40         res.append((text, tag))
     41     return res

/usr/local/lib/python3.4/dist-packages/opencorpora/reader.py in _grammemes(l_element)
     55 def _grammemes(l_element):
     56     return [text_type(grammeme.get('v'))
---> 57             for grammeme in l_element.getchildren()]
     58 
     59 

AttributeError: 'NoneType' object has no attribute 'getchildren'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant