有人知道如何把英语形容词转换成相应的副词吗?Python将是理想的,但实际上任何编程方法都是很好的。在
我试过pattern.en、nltk wordnet、和{a3}都没有用。在
把副词转换成形容词的词根形式不是问题。我使用的是SO解决方案here。在
我想要的是走另一条路。从形容词到副词。在
Here is nltk wordnet code这种方法可以在不同的词形之间转换单词,但对于形容词和副词的转换则失败。在
具体来说,我希望函数getAdverb
如下所示:
getAdverb('quick')
>>> quickly
getAdverb('noteable')
>>> notably
getAdverb('happy')
>>> happily
任何代码,资源,或建议将不胜感激!在
想法
让我们获取预先训练的单词嵌入,并使用word vector arithmetic properties来获取语义上与目标单词相似的单词集,然后选择最有前途的单词:
但我们将尝试利用形容词与副词的关系。在
代码
首先,您需要下载单词embeddings。我通常从斯坦福大学毕业。然后您需要将手套文本格式转换为Gensim:
之后装载相当容易:
^{pr2}$此测试应将语义相似的单词输出到
woman
,将类似的king
输出到man
:最后,我们可以找到最接近的副词:
结果并不理想,但看起来很有希望:
当然,你可以用一个更好的方法来检查副词,用
nltk.edit_distance
来衡量单词的相似性等等。所以这只是一个想法,有点概率性,但我觉得很有趣。在相关问题 更多 >
编程相关推荐