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
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)
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)
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