Fix fetching of noun chunk iterator

This commit is contained in:
Matthew Honnibal 2017-06-04 15:53:05 -05:00
parent 3680c51b8f
commit 2a3bd5ee90

View File

@ -65,8 +65,13 @@ cdef attr_t get_token_attr(const TokenC* token, attr_id_t feat_name) nogil:
return Lexeme.get_struct_attr(token.lex, feat_name) return Lexeme.get_struct_attr(token.lex, feat_name)
def _get_chunker(lang): def _get_chunker(lang):
cls = util.get_lang_class(lang) try:
return cls.Defaults.syntax_iterators.get('noun_chunks') cls = util.get_lang_class(lang)
except ImportError:
return None
except KeyError:
return None
return cls.Defaults.syntax_iterators.get(u'noun_chunks')
cdef class Doc: cdef class Doc:
"""A sequence of Token objects. Access sentences and named entities, export """A sequence of Token objects. Access sentences and named entities, export