from textblob import TextBlob
import nltk
array=("i have a bunch of grapes","i like to eat apple","this is a laptop")
array2=[]
for i in array:
c=TextBlob(i)
array2.append(c.words)
print array2
打印出来的结果是:
[WordList(['i', 'have', 'a', 'bunch', 'of', 'grapes']), WordList(['i', 'like', 'to', 'eat', '苹果']), WordList(['this', 'is', 'a', 'laptop'])]
我如何从 WordList 中提取,以便我的 array2 将打印为:
[['i', 'have', 'a', 'bunch', 'of', 'grapes'],['i', 'like', 'to', 'eat', 'apple'],[ “这是一台笔记本电脑”]]