예제 #1
0
 def check_language(obj):
     """ Check that the given string identifies a known language. """
     language = Language.from_code(obj)
     if language is None:
         print(u"[ERRO] Unknown language code '%s'" % obj)
         usage(1)
     return language
예제 #2
0
파일: base.py 프로젝트: pettarin/lachesis
 def _check_language(self):
     lfc = Language.from_code(self.language)
     if (lfc is not None) and (lfc in self.LANGUAGES):
         self.language = lfc
         return
     raise ValueError(u"This splitter does not support the '%s' language" %
                      self.language)
예제 #3
0
파일: base.py 프로젝트: tookam/lachesis
 def __init__(self, language):
     lfc = Language.from_code(language)
     if (lfc is not None) and (lfc in self.LANGUAGES):
         self.language = lfc
         return self
     if language in self.LANGUAGES:
         self.language = language
         return self
     raise ValueError(
         u"This NLP library does not support the '%s' language" % language)
예제 #4
0
파일: document.py 프로젝트: tookam/lachesis
 def __init__(self, raw=None, language=None):
     self.raw = self._set_raw(raw)
     self.language = Language.from_code(language)
     self.tokens = []
     self.text_view = None
     self.ccs_view = None