0
PythonでNLTKを使用してデフォルトのTaggerを作成しようとしていますが、エラーが発生しています。エストニア語の単語で構成されたコーパスとポイントは、個々の単語の品詞にタグを付けることです。デフォルトのTaggerを作成するPython NLTK
マイコード:
from nltk.corpus.reader import TaggedCorpusReader
mypath = "/Users/mmo/Downloads/"
EC = TaggedCorpusReader(mypath,"estonianSmall_copy.txt",
encoding="latin-1")
sents = EC.tagged_sents()
from nltk import DefaultTagger
from nltk.probability import FreqDist
tags =[ [(word,tag)for word,tag in sent]\
for sent in EC.tagged_sents()]
tagF = FreqDist(tags)
エラー:
tagF = FreqDist(tags)
Traceback (most recent call last):
File "<ipython-input-26-c1ca76857fce>", line 1, in <module>
tagF = FreqDist(tags)
File "/Users/mmo/anaconda/lib/python2.7/site-packages/nltk/probability.py", line 106, in __init__
Counter.__init__(self, samples)
File "/Users/mmo/anaconda/lib/python2.7/collections.py", line 477, in __init__
self.update(*args, **kwds)
File "/Users/mmo/anaconda/lib/python2.7/collections.py", line 567,
in update
self[elem] = self_get(elem, 0) + 1
TypeError: unhashable type: 'list'