示例#1
0
 public HashSet <string> this[string word]
 {
     get
     {
         if (WordWithPossiblePOS.ContainsKey(word))
         {
             return(WordWithPossiblePOS[word]);
         }
         return(null);
     }
 }
示例#2
0
 //the function initializes WordWithPossiblePOS field after POSWithPossibleWords has been read from a json file.
 private void PopulateDependentJsonPropertys()
 {
     foreach (var kvp in POSWithPossibleWords)
     {
         var words = kvp.Value;
         foreach (var word in words)
         {
             if (!WordWithPossiblePOS.ContainsKey(word))
             {
                 WordWithPossiblePOS[word] = new HashSet <string>();
             }
             WordWithPossiblePOS[word].Add(kvp.Key);
         }
     }
 }
示例#3
0
        public void AddWordsToPOSCategory(string posCat, string[] words)
        {
            foreach (var word in words)
            {
                if (!WordWithPossiblePOS.ContainsKey(word))
                {
                    WordWithPossiblePOS[word] = new HashSet <string>();
                }
                WordWithPossiblePOS[word].Add(posCat);
            }

            if (!POSWithPossibleWords.ContainsKey(posCat))
            {
                POSWithPossibleWords[posCat] = new HashSet <string>();
            }

            foreach (var word in words)
            {
                POSWithPossibleWords[posCat].Add(word);
            }
        }
示例#4
0
 public bool ContainsWord(string word)
 {
     return(WordWithPossiblePOS.ContainsKey(word));
 }