nltk分詞

1.安裝nltkspa

2.運行以下code

>>>import nltk
>>> nltk.download('punkt')blog

3.代碼:token

import nltk
sentence= """At eight o'clock on Thursday morning
... Arthur didn't feel very good."""
tokens = nltk.word_tokenize(sentence)
print(tokens)

4.結果class

相關文章
相關標籤/搜索