* Load POS tagger in load() function if path exists

This commit is contained in:
Matthew Honnibal 2014-12-07 22:05:57 +11:00
parent 677e111ee7
commit f00afe12c4
1 changed files with 2 additions and 1 deletions

View File

@ -44,7 +44,8 @@ cdef class Language:
def load(self): def load(self):
self.lexicon.load(path.join(util.DATA_DIR, self.name, 'lexemes')) self.lexicon.load(path.join(util.DATA_DIR, self.name, 'lexemes'))
self.lexicon.strings.load(path.join(util.DATA_DIR, self.name, 'strings')) self.lexicon.strings.load(path.join(util.DATA_DIR, self.name, 'strings'))
self.pos_tagger = Tagger(path.join(util.DATA_DIR, self.name, 'pos')) if path.exists(path.join(util.DATA_DIR, self.name, 'pos')):
self.pos_tagger = Tagger(path.join(util.DATA_DIR, self.name, 'pos'))
cpdef Tokens tokens_from_list(self, list strings): cpdef Tokens tokens_from_list(self, list strings):
cdef int length = sum([len(s) for s in strings]) cdef int length = sum([len(s) for s in strings])