Example #1
0
 public string classifyWords(string text)
 {
     int x = 0;
     int output;
     string strtest;
     string[] seperate;
     Word wrd;
     text = text.Trim();
     while(true)
     {
         if (x >= text.Length)
             return text;
         if (x != 0)
         {
             strtest = text.Substring(x, 1);
             while (!strtest.Equals(" "))
             {
                 x++;
                 if (x == text.Length)
                     break;
                 strtest = text.Substring(x, 1);
             }
             if (x == text.Length)
                 return text;
         }
         seperate = seperateNextWord(x, text);
         if (seperate == null)
         {
             x++;
             continue;
         }
         else if (seperate[1].Contains("href"))
         {
             x++;
             continue;
         }
         else if (seperate[1].Equals(""))
         {
             x++;
             continue;
         }
         else if (int.TryParse(seperate[1],out output))
         {
             x += seperate.Length;
             continue;
         }
         wrd = new Word(seperate[1]);
         DictionaryInterface.findType(wrd);
         if (wrd.type.Equals("unknown"))
         {
             text = seperate[0] +" "+ wrd.word +"() "+ seperate[2];
             x += wrd.word.Length;
         }
         else
         {
             text = seperate[0] +" "+ wrd.word + "(" + wrd.type + ") " + seperate[2];
             x += wrd.word.Length + wrd.type.Length + 2;
         }
     }
 }
Example #2
0
 public static void findType(Word wrd)
 {
     WnLexicon.WordInfo wrdinf = WnLexicon.Lexicon.FindWordInfo(wrd.word, true);
     if (wrdinf.partOfSpeech.ToString().Equals("Unknown"))
         wrd.type = "";
     else
         wrd.type = wrdinf.partOfSpeech.ToString();
 }
Example #3
0
 private void WordType_Click(object sender, EventArgs e)
 {
     Word wrd = new Word(TypeBox.Text);
     DictionaryInterface.findType(wrd);
     TypeLabel.Text = wrd.type;
 }