Ejemplo n.º 1
0
 static void AddWordsToList(string path, List <string> list)
 {
     using (StreamReader sr = new StreamReader(path))
     {
         string line;
         while ((line = sr.ReadLine()) != null)
         {
             line = line.ToLower();
             var   patternChooseWords = @"[^a-z'ĝĥĵŝŭĉ]";
             Regex regex = new Regex(patternChooseWords);
             line = regex.Replace(line, " ");
             string[] curArr = line.Split(' ');
             for (int i = 0; i < curArr.Length; i++)
             {
                 if (curArr[i] == "")
                 {
                     continue;
                 }
                 var len = curArr[i].Length;
                 if (len != 1 && curArr[i][len - 1] == '\'')
                 {
                     curArr[i] = curArr[i].Substring(0, len - 1) + "o";
                 }
                 if (curArr[i].Length > 1 && !(SpecialWords.Contains(curArr[i])))
                 {
                     curArr[i] = DeleteEnding(curArr[i]); // make it dynamic
                 }
                 if (!(list.Contains(curArr[i])))
                 {
                     list.Add(curArr[i]);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Determines whether the given word indicates a method that needs special handling.
 /// </summary>
 /// <param name="word">The word to test.</param>
 /// <returns>True if the word indicats a method that need special handling, False otherwise.</returns>
 protected bool IsSpecialCase(string word)
 {
     //TODO: Is the second clause even possible in non-Java languages?
     return(SpecialWords.Contains(word) || Regex.IsMatch(word, "^[0-9].*"));
 }