diff --git a/spacy/lang.pxd b/spacy/lang.pxd index fd4cf6e70..54f317ce8 100644 --- a/spacy/lang.pxd +++ b/spacy/lang.pxd @@ -8,6 +8,7 @@ from cymem.cymem cimport Pool from .typedefs cimport hash_t from .tokens cimport Tokens, TokenC from .lexeme cimport Lexeme +from .tagger cimport Tagger from .utf8string cimport StringStore, UniStr @@ -29,6 +30,7 @@ cdef class Language: cdef PreshMap _cache cdef PreshMap _specials cpdef readonly Lexicon lexicon + cpdef readonly Tagger pos_tagger cdef object _prefix_re cdef object _suffix_re diff --git a/spacy/lang.pyx b/spacy/lang.pyx index 1fdd683f3..0ca5f08d2 100644 --- a/spacy/lang.pyx +++ b/spacy/lang.pyx @@ -39,10 +39,12 @@ cdef class Language: self._infix_re = re.compile(infix) self.lexicon = Lexicon(self.set_flags) self._load_special_tokenization(rules) + self.pos_tagger = None def load(self): self.lexicon.load(path.join(util.DATA_DIR, self.name, 'lexemes')) self.lexicon.strings.load(path.join(util.DATA_DIR, self.name, 'strings')) + self.pos_tagger = Tagger(path.join(util.DATA_DIR, self.name, 'pos')) cpdef Tokens tokens_from_list(self, list strings): cdef int length = sum([len(s) for s in strings])