nltk.tokenize.stanford module

class nltk.tokenize.stanford.StanfordTokenizer[source]

Bases: nltk.tokenize.api.TokenizerI

Interface to the Stanford Tokenizer

>>> from nltk.tokenize.stanford import StanfordTokenizer
>>> s = "Good muffins cost $3.88\nin New York.  Please buy me\ntwo of them.\nThanks."
>>> StanfordTokenizer().tokenize(s)
['Good', 'muffins', 'cost', '$', '3.88', 'in', 'New', 'York', '.', 'Please', 'buy', 'me', 'two', 'of', 'them', '.', 'Thanks', '.']
>>> s = "The colour of the wall is blue."
>>> StanfordTokenizer(options={"americanize": True}).tokenize(s)
['The', 'color', 'of', 'the', 'wall', 'is', 'blue', '.']
__init__(path_to_jar=None, encoding='utf8', options=None, verbose=False, java_options='-mx1000m')[source]
tokenize(s)[source]

Use stanford tokenizer’s PTBTokenizer to tokenize multiple sentences.