summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spellchecker/src/SpellCorrector.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/spellchecker/src/SpellCorrector.java b/spellchecker/src/SpellCorrector.java
index edff671..a435f74 100644
--- a/spellchecker/src/SpellCorrector.java
+++ b/spellchecker/src/SpellCorrector.java
@@ -276,9 +276,9 @@ public class SpellCorrector {
public double getWordLikelihood(int index, double channel_probability) {
double prior, score, p, igram_p;
String word = words[index];
- // a suggested word not in the vocabulary is certainly wrong,
- // changed (or consequentive) words should also not be changed.
- if (!cr.inVocabulary(word) || words_readonly[index]) {
+
+ // a suggested word not in the vocabulary is certainly wrong
+ if (!cr.inVocabulary(word)) {
return 0.0;
}
@@ -354,6 +354,12 @@ public class SpellCorrector {
double[] scores;
int index_left, index_right;
+ // Words that have previously been changed (or conseqentive words)
+ // should not be changed again.
+ if (words_readonly[index]) {
+ return;
+ }
+
// Simulate the change of changing this word.
words[index] = word;