diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-04-02 02:21:05 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-04-02 02:21:05 +0200 |
commit | cc9d613274b9cb7945cbcad2874c3a106728804e (patch) | |
tree | cebb80e3469b71b822ec0f8d09ac6fb7b457d6a7 | |
parent | 4615358ae4f3aab0e18bb0b290e7c0caaa7441ea (diff) | |
download | assignment4-cc9d613274b9cb7945cbcad2874c3a106728804e.tar.gz |
Calculate probability for unigram
Find L * P(word) instead of L * #word.
-rw-r--r-- | spellchecker/src/SpellCorrector.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spellchecker/src/SpellCorrector.java b/spellchecker/src/SpellCorrector.java index ab41c3d..3202949 100644 --- a/spellchecker/src/SpellCorrector.java +++ b/spellchecker/src/SpellCorrector.java @@ -234,7 +234,7 @@ public class SpellCorrector { // Now obtain n-gram probabilities. Use interpolation to combine // unigrams and bigrams. - p = LAMBDAS[0] * cr.getSmoothedCount(word); + p = LAMBDAS[0] * cr.getSmoothedCount(word) / cr.getUnigramCount(); // Add probability of bi-grams. // For words u and w, P(w|u) = P(u, w) / P(u). |