예제 #1
0
 def _get_sentence_tokenizer(self, language):
     try:
         path = to_string("tokenizers/punkt/%s.pickle") % to_string(
             language)
         return nltk.data.load(path)
     except (LookupError, zipfile.BadZipfile):
         raise LookupError(
             "NLTK tokenizers are missing. Download them by following command: "
             '''python -c "import nltk; nltk.download('punkt')"''')
예제 #2
0
 def __repr__(self):
     return to_string("<%s: %s>") % ("Heading" if self._is_heading else
                                     "Sentence", self.__str__())
예제 #3
0
파일: utils.py 프로젝트: Applesaurus/4444
def expand_resource_path(path):
    directory = dirname(sys.modules["sumy"].__file__)
    directory = abspath(directory)
    return join(directory, to_string("data"), to_string(path))
예제 #4
0
파일: utils.py 프로젝트: Applesaurus/4444
 def __repr__(self):
     return to_string("<ItemsCount: %r>" % self._value)