summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spellchecker/src/SpellCorrector.java4
1 files changed, 4 insertions, 0 deletions
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);