NLTK의 CategorizedPlaintextCorpusReader
객체는 pandas
의 dtype
없습니다.
말했다되고, 당신은 튜플의리스트에 영화 리뷰를 변환 다음과 같은 dataframe 채울 수 있습니다 :
import pandas as pd
from nltk.corpus import movie_reviews as mr
reviews = []
for fileid in mr.fileids():
tag, filename = fileid.split('/')
reviews.append((filename, tag, mr.raw(fileid)))
df = pd.DataFrame(reviews, columns=['filename', 'tag', 'text'])
[OUT] :
>>> df.head()
filename tag text
0 cv000_29416.txt neg plot : two teen couples go to a church party ,...
1 cv001_19502.txt neg the happy bastard's quick movie review \ndamn ...
2 cv002_17424.txt neg it is movies like these that make a jaded movi...
3 cv003_12683.txt neg " quest for camelot " is warner bros . ' firs...
4 cv004_12641.txt neg synopsis : a mentally unstable man undergoing ...
가 text
열을 처리하기를, How to NLTK word_tokenize to a Pandas dataframe for Twitter data?
@alvas를 참조하십시오. 이제 어떻게 할지를 보여 주셨으니 이제는 "불가능한"주장을 제거해야 할 것입니다 ... – alexis
아, 그래야합니다. "간단하게 그렇게 초기화 할 수 있다고 생각하지 않습니다."=) – alvas
그렇게 간단하게 초기화 할 수 있다고 생각하지 않습니다. " NLTK의'CategorizedPlaintextCorpusReader' 객체는'pandas'를위한'dtype'이 아닙니다. – alvas