diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-04-02 09:54:28 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-04-02 09:54:28 +0200 |
commit | 148cdd22624c36997c331c1baf9fdccf5e40bcb4 (patch) | |
tree | 51b3699af04225a269204b89d7e1ddad924f65e9 | |
parent | cc9d613274b9cb7945cbcad2874c3a106728804e (diff) | |
download | assignment4-148cdd22624c36997c331c1baf9fdccf5e40bcb4.tar.gz |
SpellCorrector: look for differences in likelihood
-rw-r--r-- | spellchecker/src/SpellCorrector.java | 4 |
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); |