Пример #1
0
 // naClass.init(naWord, ttags);
 private int Add(AmbiguityClass a)
 {
     if (classes.Contains(a))
     {
         return(classes.IndexOf(a));
     }
     classes.Add(a);
     return(classes.IndexOf(a));
 }
Пример #2
0
        protected internal virtual int GetClass(string word, Dictionary dict, int veryCommonWordThresh, TTags ttags)
        {
            if (word.Equals(naWord))
            {
                return(-2);
            }
            if (dict.IsUnknown(word))
            {
                return(-1);
            }
            bool           veryCommon = dict.Sum(word) > veryCommonWordThresh;
            AmbiguityClass a          = new AmbiguityClass(word, veryCommon, dict, ttags);

            // TODO: surely it would be faster and not too expensive to cache
            // the results of creating a whole bunch of these, since we're
            // probably constructing the same AmbiguityClass multiple times
            // for each word.  Furthermore, the separation of having two
            // constructors here is pretty awful, quite frankly.
            return(Add(a));
        }