NLTK: How to create a corpus from csv file

£可爱£侵袭症+ 提交于 2019-12-07 18:00:33

Check out read_csv from the pandas library. Here is the documentation: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html

You can install pandas by running pip install pandas at the command line. Then loading the csv and selecting that column should be as easy as the below:

data = pd.read_csv(path_to_csv)
docs = data['col1']

tfs = tfidf.fit_transform(docs)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!