[英]tokanizing words by space NLTK
在 nltk 自然語言處理中通過單詞而不是句子來標記行的代碼是什么?
就像句子一樣,我使用此代碼是因為我想根據單詞而不是句子進行標記。
import nltk
text=" Hi how are you, how is live, what are you doing "
from nltk.tokenize import sent_tokenize
print(sent_tokenize(text))
你也有准備好的庫,你可以使用這個代碼
import nltk
text=nltk.word_tokenize(" Don't hesitate to ask questions, every thing will be okey")
print(text)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.