public MyWordInfo[] FindSynonyms(ref MyWordInfo pos, bool includeMorphs) { pos.Word = pos.Word.ToLower(); Index index = Index.lookup(pos.Word, PartOfSpeech.of(pos.Pos)); if (index == null) { if (!includeMorphs) { return(null); } var morphs = new MorphStr(pos.Word, PartOfSpeech.of(pos.Pos)); string morph = ""; while ((morph = morphs.next()) != null) { index = Index.lookup(morph, PartOfSpeech.of(pos.Pos)); pos.Word = morph; if (index != null) { break; } } } return(index == null ? null : LookupCandidates(index, pos)); }
public static int GetSynsetIndex(string word, PartsOfSpeech pos) { word = word.ToLower(); //word=RemoveBadChars (word); Index index = Wnlib.Index.lookup(word, PartOfSpeech.of(pos)); if (index == null) { MorphStr morphs = new MorphStr(word, PartOfSpeech.of(pos)); string morph = ""; while ((morph = morphs.next()) != null) { index = Index.lookup(morph, PartOfSpeech.of(pos)); if (index != null) { break; } } } if (index == null) { return(-1); } else { return(0); } }
public void OverviewFor(string t, string p, ref bool b, ref SearchSet obj, ArrayList list) { PartOfSpeech pos = PartOfSpeech.of(p); SearchSet ss = WNDB.is_defined(t, pos); MorphStr ms = new MorphStr(t, pos); bool checkmorphs = false; checkmorphs = AddSearchFor(t, pos, list); // do a search if (checkmorphs) { HasMatch = true; } if (!HasMatch) { // loop through morphs (if there are any) string m; while ((m = ms.next()) != null) { if (m != t) { ss = ss + WNDB.is_defined(m, pos); AddSearchFor(m, pos, list); } } } b = ss.NonEmpty; obj = ss; }