Beispiel #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')"''')
Beispiel #2
0
 def __repr__(self):
     return to_string("<%s: %s>") % ("Heading" if self._is_heading else
                                     "Sentence", self.__str__())
Beispiel #3
0
def expand_resource_path(path):
    directory = dirname(sys.modules["sumy"].__file__)
    directory = abspath(directory)
    return join(directory, to_string("data"), to_string(path))
Beispiel #4
0
 def __repr__(self):
     return to_string("<ItemsCount: %r>" % self._value)