LCH 相似性 - 需要相同的 POS? Python

LCH Similarity - Need Same POS? Python

比较 wordnet 相似性度量以查看哪个与我的语料库最 relevant/useful - 在尝试计算 lch 时遇到此错误消息 -

"Computing the lch similarity requires Synset('home'.n.01) and Synset('chronological.a.01') to have the same part of speech."

在尝试 lch 之前,我是否必须将列表中的所有单词规范化为相同的 POS?

作为参考,我能够计算 wup_similarity successfully without any POS normalization. The list of words I am trying to calculate similarity have all been lemmatized using WordNetLemmatizer

您不能通过更改词性来解决此问题,因为并非所有单词都可以是词性。例如,"chronological" 不能是名词。

一种方法是像这样捕获异常,或者检查不同的词性,并指定相似度为零。

WordNet 有时也会通过模拟不同词性的共享词根来处理这个问题,这可能是您的一些相似性度量起作用的原因。但是,工作方式 is confusing,因此您可能不应该依赖它。

如果您想要任意词的相似性,请尝试使用词向量(Word2Vec 或 GloVe)而不是 WordNet。