【发布时间】:2018-03-14 23:45:25
【问题描述】:
我目前正在尝试训练我的 Python NLTK 词性标注器来正确标注德语文本。为此,我使用了 ClassifiedBasedGermanTagger,来自:
https://github.com/ptnplanet/NLTK-Contributions/tree/master/ClassifierBasedGermanTagger
以及来自本网站的训练语料库:
http://www.ims.uni-stuttgart.de/forschung/ressourcen/korpora/TIGERCorpus/download/start.html (TIGER Corpus 版本 2.2(2012 年 7 月))
我发现有一个写得很好的教程关于如何去做。所以现在我要做的就是重新创建代码:
对我不起作用的部分是:
tagged_sents = corp.tagged_sents()
random.shuffle(tagged_sents)
我得到的错误如下所示:
File "C:\somedude\lib\random.py", line 274, in shuffle
x[i], x[j] = x[j], x[i]
TypeError: 'LazyMap' object does not support item assignment
您是否有解决方法,甚至解释为什么它对编写该教程的绅士有效,以及为什么它对我显示错误?目前我正在使用 Python 3。
提前非常感谢大家。
【问题讨论】:
标签: python nltk pos-tagger