“nltk bigrams” Ответ

nltk bigrams

>>> import nltk
>>> from nltk.tokenize import word_tokenize
>>> text = "to be or not to be"
>>> tokens = nltk.word_tokenize(text)
>>> bigrm = nltk.bigrams(tokens)
>>> print(*map(' '.join, bigrm), sep=', ')
to be, be or, or not, not to, to be
Determined Dunlin

nltk bigrams

bigrm = list(nltk.bigrams(text.split()))
Determined Dunlin

Ответы похожие на “nltk bigrams”

Смотреть популярные ответы по языку

Смотреть другие языки программирования