I need to do some word sense disambiguation as part of a larger project and I came across WordNet.Net I tried to use the wordsensedisambiguator class that came with the WordsMatching project in the download, here is my code
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);
When I view the results, the Sense for every word is still '0' :( Haas anyone used this before or can anyone figure out how to work the WordSenseDisambiguator? Thanks in anticipation of your hastened responses :)
You might want to try out WordNet::SenseRelate::AllWords, which does all words sense diambiguation using WordNet.
http://senserelate.sourceforge.net
Try it out via the web interface at