public HashSet <string> this[string word] { get { if (WordWithPossiblePOS.ContainsKey(word)) { return(WordWithPossiblePOS[word]); } return(null); } }
//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); } } }
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); } }
public bool ContainsWord(string word) { return(WordWithPossiblePOS.ContainsKey(word)); }