그래서 나는 (POS는 정확하게는 태그)과 같이 목록에서 단어의 무리에 태그를 시도하고 있었다 그것은 [['hello'],['world']]
(각 목록은 하나 개의 단어를 포함하는 목록 일명 목록)처럼하지만 난 시도하고 그것을 실행할 때 내가 얻을 :NLTK에서 pos_tag를 사용하는 방법은 무엇입니까? <code>lw</code> 단어의 목록 (정말 길다 또는 내가 그것을 게시하지만 것입니다</p> <pre><code>pos = [nltk.pos_tag(i,tagset='universal') for i in lw] </code></pre> <p>:
Traceback (most recent call last):
File "<pyshell#183>", line 1, in <module>
pos = [nltk.pos_tag(i,tagset='universal') for i in lw]
File "<pyshell#183>", line 1, in <listcomp>
pos = [nltk.pos_tag(i,tagset='universal') for i in lw]
File "C:\Users\my system\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\tag\__init__.py", line 134, in pos_tag
return _pos_tag(tokens, tagset, tagger)
File "C:\Users\my system\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\tag\__init__.py", line 102, in _pos_tag
tagged_tokens = tagger.tag(tokens)
File "C:\Users\my system\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\tag\perceptron.py", line 152, in tag
context = self.START + [self.normalize(w) for w in tokens] + self.END
File "C:\Users\my system\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\tag\perceptron.py", line 152, in <listcomp>
context = self.START + [self.normalize(w) for w in tokens] + self.END
File "C:\Users\my system\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\tag\perceptron.py", line 240, in normalize
elif word[0].isdigit():
IndexError: string index out of range
누군가가 말해 줄 수 왜 내가이 오류가 어떻게 어떻게 그것을 해결하기 위해? 많은 감사합니다.
감사합니다, 그리고 여기 단지 문제는 이런 일이되었다 _why_ 나는 또한 궁금 점이다, 작동 :
도 참조하십시오. 그럼에도 불구하고 귀하의 답변을 주셔서 감사합니다. – EighteenthVariable