Example #1
0
        /// <summary>
        /// Adds a new word to the cache
        /// </summary>
        /// <param name="word">A string containing the word to add to the cache.</param>
        public void AddWord(string word)
        {
            string key = stemming.StemWord(CapitalizeString(word));

            lock (words)
            {
                if (!words.ContainsKey(key))
                {
                    int word_id = InsertWord(key);
                    if (word_id != -1)
                    {
                        words.Add(key, word_id);
                        OnCacheUpdated(EventArgs.Empty);
                    }
                }
            }
        }
Example #2
0
 /// <summary>
 /// This method takes a capitalized word as input and performs a 2-level Stemming
 /// </summary>
 /// <param name="word">The word to stem</param>
 /// <returns>The stemmed word</returns>
 private string StemWord(string word)
 {
     return(stemming.StemWord(word));
 }