通过 space NLTK 对单词进行分词
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)
在 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)