【发布时间】:2023-03-21 04:34:01
【问题描述】:
我最近开始使用 nltk 模块进行文本分析。我被困在一个点上。我想在数据帧上使用 word_tokenize,从而获取数据帧特定行中使用的所有单词。
data example:
text
1. This is a very good site. I will recommend it to others.
2. Can you please give me a call at 9983938428. have issues with the listings.
3. good work! keep it up
4. not a very helpful site in finding home decor.
expected output:
1. 'This','is','a','very','good','site','.','I','will','recommend','it','to','others','.'
2. 'Can','you','please','give','me','a','call','at','9983938428','.','have','issues','with','the','listings'
3. 'good','work','!','keep','it','up'
4. 'not','a','very','helpful','site','in','finding','home','decor'
基本上,我想将所有单词分开并找到数据框中每个文本的长度。
我知道 word_tokenize 可以用于字符串,但是如何将它应用到整个数据帧?
请帮忙!
提前谢谢...
【问题讨论】:
-
你的问题描述缺少数据输入,你的代码,你想要的输出你能充实吗?谢谢
-
@EdChum:已编辑查询。希望它有所需的信息。