/// <summary> /// Gather and sort list of DeGeWo base forms that are omitted from OT-derived word list. /// </summary> private void gatherOmitted() { foreach (var x in baseFormToClass) { if (wordToWWC.ContainsKey(x.Key)) { continue; } WordWithClass wwc = new WordWithClass { Word = x.Key, FreqClass = x.Value, OrigRank = baseFormToRank[x.Key] }; corpusOmitted.Add(wwc); } corpusOmitted.Sort((x, y) => x.OrigRank.CompareTo(y.OrigRank)); }
/// <summary> /// Records OT word with the provided class+rank, or updates earlier class+rank if this one's lower. /// </summary> private void addUpdateWordWithClass(string word, int freqClass, int origRank) { // Not recorded before: add. if (!wordToWWC.ContainsKey(word)) { WordWithClass wwc = new WordWithClass { Word = word, FreqClass = freqClass, OrigRank = origRank }; wordToWWC[word] = wwc; wordsWithClass.Add(wwc); } // Seen before: update if new class is lower. else if (freqClass < wordToWWC[word].FreqClass) { wordToWWC[word].FreqClass = freqClass; wordToWWC[word].OrigRank = origRank; } }