gpt4 book ai didi

nlp - 使用 WordNet.Net 进行词义消歧

转载 作者:行者123 更新时间:2023-12-02 19:54:16 26 4
gpt4 key购买 nike

作为一个更大项目的一部分,我需要做一些词义消歧工作,我遇到了 WordNet.Net我尝试使用下载中的WordsMatching项目附带的wordsensedisambiguator类,这是我的代码

        string sent = "We have investigated the inductions of the IE genes in response to calcium signals in Jurkat cells (in the presence of activated p21(ras)) and their correlated consequences.";
Tokeniser tok = new Tokeniser();
tok.UseStemming = true;
string[] words = tok.Partition(sent);

if (words.Length == 0) return null;

MyWordInfo[] wordInfos = new MyWordInfo[words.Length];

for (int i = 0; i < words.Length; i++)
{

WnLexicon.WordInfo wordInfo = WnLexicon.Lexicon.FindWordInfo(words[i], true);

if (wordInfo.partOfSpeech != Wnlib.PartsOfSpeech.Unknown && wordInfo.text != string.Empty)
{

words[i] = wordInfo.text;

Wnlib.PartsOfSpeech[] posEnum = (Wnlib.PartsOfSpeech[])Enum.GetValues(typeof(Wnlib.PartsOfSpeech));

for (int j = 0; j < posEnum.Length; j++)
{
if (wordInfo.senseCounts[j] > 0) // get the first part of speech
{
wordInfos[i] = new MyWordInfo(words[i], posEnum[j]);
break;
}
}
}
}

WordSenseDisambiguator wsd = new WordSenseDisambiguator();
wordInfos = wsd.Disambiguate(wordInfos);

当我查看结果时,每个单词的意义仍然是“0”:(哈,有人以前用过这个,或者有人能弄清楚如何使用 WordSenseDisambiguator 吗?感谢您的快速回复:)

最佳答案

您可能想尝试 WordNet::SenseRelate::AllWords,它使用 WordNet 来感知所有单词的歧义。

http://senserelate.sourceforge.net

通过网络界面尝试一下

http://marimba.d.umn.edu

关于nlp - 使用 WordNet.Net 进行词义消歧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6840176/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com