각 줄이 문서로 간주되는 텍스트 파일에서 NLTK를 사용하여 kmeans 클러스터링을 수행합니다. 이제
성급한
마이크 성급한 벽
예거 마이스터 규칙
규칙 대역을 여리고 UnicodeDecodeError : 'ascii'코덱은 13 진수 0xe2를 디코딩 할 수 없습니다. 서수가 범위 내에 없습니다 (128)
손가락 죽음의 펀치 속해
가 수행 팔로우 예거 마이스터 단계접근
: 그래서 예를 들어, 내 텍스트 파일은 다음과 같은 것입니다 실행하려고하는 데모 코드는 다음과 같습니다. https://gist.github.com/xim/1279283
오류는 다음과 같습니다.
Traceback (most recent call last):
File "cluster_example.py", line 40, in
words = get_words(job_titles)
File "cluster_example.py", line 20, in get_words
words.add(normalize_word(word))
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/nltk/decorators.py", line 183, in memoize
result = func(*args)
File "cluster_example.py", line 14, in normalize_word
return stemmer_func(word.lower())
File "/usr/local/lib/python2.7/dist-packages/nltk/stem/snowball.py", line 694, in stem
word = (word.replace(u"\u2019", u"\x27")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 13: ordinal not in range(128)
여기 무슨 일입니까?
이 line.decode ('utf-8'). strip(). lower(). split()도 동일한 오류가 발생합니다. .deocode ('utf-8')를 추가했습니다. –