private static void AddExampleOrException(Lemmatizer lemmatizer, string word, string lemma) { var computedLemma = lemmatizer.Lemmatize(word); if (computedLemma != lemma) { // add example lemmatizer.AddExample(word, lemma); // if still doesn't work --> add exception var computedLemma2 = lemmatizer.Lemmatize(word); if (computedLemma2 != lemma) { Console.WriteLine("Added lemma exception: {0} -> {1}", word, lemma); lemmatizer.AddException(word, lemma); } } }
private static void AddExampleOrException(Lemmatizer lemmatizer, string word, string lemma) { // compute the lemma of this example var computedLemma = lemmatizer.Lemmatize(word); if (computedLemma != lemma) { // if the computed lemma is different from what we expect, // add this example to lemmatizer (lemmatizer can then deduce a new rule and succeed, or still fail) lemmatizer.AddExample(word, lemma); // if still doesn't work --> add exception var computedLemma2 = lemmatizer.Lemmatize(word); if (computedLemma2 != lemma) { Console.WriteLine("Added lemma exception: {0} -> {1}", word, lemma); lemmatizer.AddException(word, lemma); } } }