나는 CountVectorizer 가지고있는 N- 그램으로부터 당기고 문서가이 문자열이 오류가 발생두 단어가있을 때 CountVectorizer에서 bigram에 대해 "빈 단어 오류"가 표시되는 이유는 무엇입니까? 그 벡터 기 구현</p> <pre><code>word_vectorizer = CountVectorizer(stop_words=None, ngram_range=(2,2), analyzer='word') </code></pre> <p>:
Traceback (most recent call last):
File "<ipython-input-63-d261e44b8cce>", line 1, in <module>
runfile('C:/Users/taca/Documents/Work/Python/Text Analytics/owccomments.py', wdir='C:/Users/taca/Documents/Work/Python/Text Analytics')
File "C:\Users\taca\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "C:\Users\taca\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/taca/Documents/Work/Python/Text Analytics/owccomments.py", line 38, in <module>
X = word_vectorizer.fit_transform(group['cleanComments'])
File "C:\Users\taca\AppData\Local\Continuum\Anaconda3\lib\site-packages\sklearn\feature_extraction\text.py", line 839, in fit_transform
self.fixed_vocabulary_)
File "C:\Users\taca\AppData\Local\Continuum\Anaconda3\lib\site-packages\sklearn\feature_extraction\text.py", line 781, in _count_vocab
raise ValueError("empty vocabulary; perhaps the documents only"
ValueError: empty vocabulary; perhaps the documents only contain stop words
입니다 :
X = word_vectorizer.fit_transform(group['cleanComments'])
이 오류가 발생합니다 : "중복 q". 문서가 ''일 때마다 발생합니다.
왜 CountVectorizer가 q (또는 그와 관련하여 하나의 문자)를 유효한 단어로 선택하지 않는 이유는 무엇입니까? 이 오류가 CountVectorizer에 발생할 수있는 이유를 나열하는 포괄적 인 장소가 있습니까?
EDIT : 나는 오류 자체를 파고 들었고 어휘와 관련이있는 것 같습니다. 나는 표준 어휘가 단문을 단어로 받아들이지 않는다고 가정하고 있지만, 그 문제를 해결하는 방법을 모르겠습니다.
'group [ 'cleanComments']'에 행의 예를 보여 주시겠습니까? 그것은 어떻게 생겼습니까? – titipata