From 148cdd22624c36997c331c1baf9fdccf5e40bcb4 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 2 Apr 2015 09:54:28 +0200 Subject: SpellCorrector: look for differences in likelihood --- spellchecker/src/SpellCorrector.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spellchecker/src/SpellCorrector.java b/spellchecker/src/SpellCorrector.java index 3202949..4978f4e 100644 --- a/spellchecker/src/SpellCorrector.java +++ b/spellchecker/src/SpellCorrector.java @@ -261,6 +261,10 @@ public class SpellCorrector { // try the modification, calculate the result and restore. likelihood = getWordLikelihood(index, word, channel_probability); + // look for the word which increases the likelihood the most + // (that is, the difference of the old and new likelihood). + likelihood -= word_likelihoods[index]; + if (likelihood > best_likelihood) { best_likelihood = likelihood; best_modification = new WordModification(index, word); -- cgit v1.2.1