有两点不解,请指教: 第一, [t for t in text.split()] 与 text.split() 我觉得是等价的,不知对否? 第二, clean_tokens = list() sr = stopwords.words('english') for token in tokens: if token not in sr: clean_tokens.append(token) 这个写法有点低效了,建议了解一下”Python函数式编程“,不知妥否?
引用来自“j_hao104”的评论
第一个已修正。 第二种用map函数是可以,这种只是为了更直观些。 😄
clean_tokens = [token for token in tokens if token not in sr] 😊
有两点不解,请指教: 第一, [t for t in text.split()] 与 text.split() 我觉得是等价的,不知对否? 第二, clean_tokens = list() sr = stopwords.words('english') for token in tokens: if token not in sr: clean_tokens.append(token) 这个写法有点低效了,建议了解一下”Python函数式编程“,不知妥否?
有两点不解,请指教: 第一, [t for t in text.split()] 与 text.split() 我觉得是等价的,不知对否? 第二, clean_tokens = list() sr = stopwords.words('english') for token in tokens: if token not in sr: clean_tokens.append(token) 这个写法有点低效了,建议了解一下”Python函数式编程“,不知妥否?
引用来自“2010jing”的评论
打开python终端导入NLTK检查NLTK是否正确安装:import mltk
打错了 mltk
import mltk
打错了 mltk
引用来自“Dormouse”的评论
有两点不解,请指教:第一, [t for t in text.split()] 与 text.split() 我觉得是等价的,不知对否?
第二,
clean_tokens = list()
sr = stopwords.words('english')
for token in tokens:
if token not in sr:
clean_tokens.append(token)
这个写法有点低效了,建议了解一下”Python函数式编程“,不知妥否?
引用来自“j_hao104”的评论
第一个已修正。第二种用map函数是可以,这种只是为了更直观些。
😄
😊
引用来自“Dormouse”的评论
有两点不解,请指教:第一, [t for t in text.split()] 与 text.split() 我觉得是等价的,不知对否?
第二,
clean_tokens = list()
sr = stopwords.words('english')
for token in tokens:
if token not in sr:
clean_tokens.append(token)
这个写法有点低效了,建议了解一下”Python函数式编程“,不知妥否?
第二种用map函数是可以,这种只是为了更直观些。
😄
第一, [t for t in text.split()] 与 text.split() 我觉得是等价的,不知对否?
第二,
clean_tokens = list()
sr = stopwords.words('english')
for token in tokens:
if token not in sr:
clean_tokens.append(token)
这个写法有点低效了,建议了解一下”Python函数式编程“,不知妥否?
引用来自“酸辣粉加鸡蛋”的评论
中文博大精深,有这方面的工具吗?引用来自“开源X”的评论
结巴分词算是NLP工具么引用来自“wei2011”的评论
不知道中文处理怎么样