0

我想从文本中提取相关术语,并且我想选择最相关的术语。

How to config nltk data -> how, to, config ignored
config mysql to scan -> config NOT ingored
Python NLTK usage -> usage ingored
new song by the band usage -> usage NOT ingored
NLTK Thinks that -> thinks ignored
critical thinking -> thinking NOT ignored

我只能想到这种粗略的方法:

>>> text = nltk.word_tokenize(input)
>>> nltk.pos_tag(text)

并且只保存名词和动词。但即使“think”和“thinking”是动词,我只想保留“thinking”。也是“结合”而不是“结合”。如果可以的话,我也想提取短语。还有“free2play”、“@pro_blogger”等术语。


请提出一个更好的方案或如何让我的方案真正发挥作用。

4

1 回答 1

0

您所需要的只是一个更好的 pos 标记。这是 NLTK 的一个众所周知的问题,核心 pos 标记器对于生产使用效率不高。可能你想尝试别的东西。在此处比较 pos 标记的结果 - http://nlp.stanford.edu:8080/parser/。这是我发现的最准确的词性标注器(我知道我很快就会被证明是错误的)。一旦你在这个标记器中解析了你的数据,你就会自动意识到你到底想要什么。

我建议您专注于正确标记。

检查 POS 标记示例:标记关键/JJ 思维/NN

资料来源:这些天我也在为 NLTK pos tagger 苦苦挣扎。:)

于 2013-04-10T12:00:50.843 回答