/// <summary> /// This is an overview search - the basis for any advanced search. /// </summary> private void Overview() { //overview for 'search' string t = null; WordNetClasses.WN wnc = new WordNetClasses.WN(dictpath); se = null; // prevent the treeview from being overwritten by old results in showresults t = txtSearchWord.Text; lblSearchInfo.Text = "Searches for " + t + ":"; lblSearchInfo.Visible = true; btnOverview.Visible = false; txtOutput.Text = ""; txtOutput.Visible = false; StatusBar1.Text = "Overview of " + t; Refresh(); try { bool b = false; // sets the visibility of noun, verb, adj, adv when showing buttons for a word list = new ArrayList(); wnc.OverviewFor(t, "noun", ref b, ref bobj2, list); btnNoun.Visible = b; wnc.OverviewFor(t, "verb", ref b, ref bobj3, list); btnVerb.Visible = b; wnc.OverviewFor(t, "adj", ref b, ref bobj4, list); btnAdj.Visible = b; wnc.OverviewFor(t, "adv", ref b, ref bobj5, list); btnAdv.Visible = b; txtSearchWord.Text = t; txtSenses.Text = "0"; treeControl1.fillTree(list, true); } catch (Exception ex) { MessageBox.Show(ex.Message + Constants.vbCrLf + Constants.vbCrLf + "Princeton's WordNet not pre-installed to default location?"); } FixDisplay(null); }
public static ArrayList GetVerbSenses(string verb, int percent, int threshold) { WordNetClasses.WN wnc = new WordNetClasses.WN(Wnlib.WNCommon.path); bool b = false; SearchSet boj = null; ArrayList list = new ArrayList(); wnc.OverviewFor(verb, "verb", ref b, ref boj, list); Search vs = (Search)list[0]; ArrayList senses = new ArrayList(); int cut = (int)Math.Ceiling(vs.senses.Count * percent / 100.0); if (cut < threshold) { cut = threshold; } foreach (SynSet ss in vs.senses) { /* * if(--cut<0) * break; */ VerbSense vsense = new VerbSense(); vsense.Sense = verb + "#v#" + (ss.sense + 1).ToString(); vsense.Structs = new ArrayList(); foreach (SynSetFrame frame in ss.frames) { SyntaxStruct st = new SyntaxStruct(); switch (frame.fr.str) { case "1": st.Check = new SyntaxChecker(VerbSense.CheckForm1); break; case "2": st.Check = new SyntaxChecker(VerbSense.CheckForm1); break; case "3": st.Check = new SyntaxChecker(VerbSense.CheckForm1); break; case "4": st.Check = new SyntaxChecker(VerbSense.CheckForm4); break; case "5": st.Check = new SyntaxChecker(VerbSense.CheckForm5); break; case "6": st.Check = new SyntaxChecker(VerbSense.CheckForm6); break; case "7": st.Check = new SyntaxChecker(VerbSense.CheckForm7); break; case "8": st.Check = new SyntaxChecker(VerbSense.CheckForm8); break; case "9": st.Check = new SyntaxChecker(VerbSense.CheckForm8); break; case "10": st.Check = new SyntaxChecker(VerbSense.CheckForm8); break; case "11": st.Check = new SyntaxChecker(VerbSense.CheckForm8); break; case "12": st.Check = new SyntaxChecker(VerbSense.CheckForm12); st.Input = "TO"; break; case "13": st.Check = new SyntaxChecker(VerbSense.CheckForm12); st.Input = "ON"; break; case "14": st.Check = new SyntaxChecker(CheckForm14); break; case "15": st.Check = new SyntaxChecker(VerbSense.CheckForm15); st.Input = "TO"; break; case "16": st.Check = new SyntaxChecker(VerbSense.CheckForm15); st.Input = "FROM"; break; case "17": st.Check = new SyntaxChecker(VerbSense.CheckForm15); st.Input = "WITH"; break; case "18": st.Check = new SyntaxChecker(VerbSense.CheckForm15); st.Input = "OF"; break; case "19": st.Check = new SyntaxChecker(VerbSense.CheckForm15); st.Input = "ON"; break; case "20": st.Check = new SyntaxChecker(VerbSense.CheckForm20); break; case "21": st.Check = new SyntaxChecker(VerbSense.CheckForm20); break; case "22": st.Check = new SyntaxChecker(VerbSense.CheckForm22); break; case "23": st.Check = new SyntaxChecker(VerbSense.CheckForm1); break; case "24": st.Check = new SyntaxChecker(VerbSense.CheckForm24); break; case "25": st.Check = new SyntaxChecker(VerbSense.CheckForm25); break; case "26": st.Check = new SyntaxChecker(VerbSense.CheckForm26); break; case "27": st.Check = new SyntaxChecker(VerbSense.CheckForm12); break; case "28": st.Check = new SyntaxChecker(VerbSense.CheckForm28); break; case "29": st.Check = new SyntaxChecker(VerbSense.CheckForm29); break; case "30": st.Check = new SyntaxChecker(VerbSense.CheckForm30); break; case "31": st.Check = new SyntaxChecker(VerbSense.CheckForm15); st.Input = "WITH"; break; case "32": st.Check = new SyntaxChecker(VerbSense.CheckForm32); break; case "33": st.Check = new SyntaxChecker(VerbSense.CheckForm33); break; case "34": st.Check = new SyntaxChecker(VerbSense.CheckForm26); break; case "35": st.Check = new SyntaxChecker(VerbSense.CheckForm32); break; } vsense.Structs.Add(st); } senses.Add(vsense); } return(senses); }