作为更大项目的一部分,我需要做一些词义消歧,我遇到了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);
当我查看结果时,每个单词的Sense仍然是'0':(哈斯以前有人使用过这个或者有没有人能想出如何使用WordSenseDisambiguator? 感谢您的加快回复:)
答案 0 :(得分:6)
你可能想尝试使用WordNet :: SenseRelate :: AllWords,它可以让所有单词使用WordNet来感知diambiguation。
http://senserelate.sourceforge.net
通过
的网络界面试用