【发布时间】:2011-08-20 15:11:58
【问题描述】:
我正在尝试创建一种类似英语的小型语言来指定任务。基本思想是将语句拆分为动词和名词短语,这些动词应适用。我正在使用 nltk,但没有得到我希望的结果,例如:
>>> nltk.pos_tag(nltk.word_tokenize("select the files and copy to harddrive'"))
[('select', 'NN'), ('the', 'DT'), ('files', 'NNS'), ('and', 'CC'), ('copy', 'VB'), ('to', 'TO'), ("harddrive'", 'NNP')]
>>> nltk.pos_tag(nltk.word_tokenize("move the files to harddrive'"))
[('move', 'NN'), ('the', 'DT'), ('files', 'NNS'), ('to', 'TO'), ("harddrive'", 'NNP')]
>>> nltk.pos_tag(nltk.word_tokenize("copy the files to harddrive'"))
[('copy', 'NN'), ('the', 'DT'), ('files', 'NNS'), ('to', 'TO'), ("harddrive'", 'NNP')]
在每种情况下,它都没有意识到第一个词(选择、移动和复制)是动词。我知道我可以创建自定义标记器和语法来解决这个问题,但与此同时,当很多这些东西超出我的范围时,我会犹豫是否要重新发明轮子。我特别希望有一个也可以处理非英语语言的解决方案。
所以无论如何,我的问题之一是: 这种语法有更好的标注器吗? 有没有办法让现有的标注器更频繁地使用动词形式而不是名词形式? 有没有办法训练标注者? 有没有更好的方法?
【问题讨论】: