From aa583c40649d691c98a8186bb396fa2c0e9153b8 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 29 Mar 2016 20:10:39 -0400 Subject: [PATCH] Fix spelling of linear interpolation scorer class This commit fixes the spelling of LinearInterpoatingScorer to LinearInterpolatingScorer. Note that there was a missing ell. Closes #17384 --- ...terpoatingScorer.java => LinearInterpolatingScorer.java} | 4 ++-- .../search/suggest/phrase/LinearInterpolation.java | 2 +- .../suggest/phrase/LinearInterpolationModelTests.java | 4 ++-- .../suggest/phrase/NoisyChannelSpellCheckerTests.java | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) rename core/src/main/java/org/elasticsearch/search/suggest/phrase/{LinearInterpoatingScorer.java => LinearInterpolatingScorer.java} (93%) diff --git a/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpoatingScorer.java b/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolatingScorer.java similarity index 93% rename from core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpoatingScorer.java rename to core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolatingScorer.java index 995b194afd5..2a5895a8320 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpoatingScorer.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolatingScorer.java @@ -27,13 +27,13 @@ import org.elasticsearch.search.suggest.phrase.DirectCandidateGenerator.Candidat import java.io.IOException; //TODO public for tests -public final class LinearInterpoatingScorer extends WordScorer { +public final class LinearInterpolatingScorer extends WordScorer { private final double unigramLambda; private final double bigramLambda; private final double trigramLambda; - public LinearInterpoatingScorer(IndexReader reader, Terms terms, String field, double realWordLikelyhood, BytesRef separator, + public LinearInterpolatingScorer(IndexReader reader, Terms terms, String field, double realWordLikelyhood, BytesRef separator, double trigramLambda, double bigramLambda, double unigramLambda) throws IOException { super(reader, terms, field, realWordLikelyhood, separator); double sum = unigramLambda + bigramLambda + trigramLambda; diff --git a/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolation.java b/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolation.java index 8021edcc782..f351bebe5a8 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolation.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolation.java @@ -173,7 +173,7 @@ public final class LinearInterpolation extends SmoothingModel { @Override public WordScorerFactory buildWordScorerFactory() { return (IndexReader reader, Terms terms, String field, double realWordLikelyhood, BytesRef separator) -> - new LinearInterpoatingScorer(reader, terms, field, realWordLikelyhood, separator, trigramLambda, bigramLambda, + new LinearInterpolatingScorer(reader, terms, field, realWordLikelyhood, separator, trigramLambda, bigramLambda, unigramLambda); } } \ No newline at end of file diff --git a/core/src/test/java/org/elasticsearch/search/suggest/phrase/LinearInterpolationModelTests.java b/core/src/test/java/org/elasticsearch/search/suggest/phrase/LinearInterpolationModelTests.java index 30d4b1421ff..b3689977840 100644 --- a/core/src/test/java/org/elasticsearch/search/suggest/phrase/LinearInterpolationModelTests.java +++ b/core/src/test/java/org/elasticsearch/search/suggest/phrase/LinearInterpolationModelTests.java @@ -65,8 +65,8 @@ public class LinearInterpolationModelTests extends SmoothingModelTestCase { @Override void assertWordScorer(WordScorer wordScorer, SmoothingModel in) { LinearInterpolation testModel = (LinearInterpolation) in; - LinearInterpoatingScorer testScorer = (LinearInterpoatingScorer) wordScorer; - assertThat(wordScorer, instanceOf(LinearInterpoatingScorer.class)); + LinearInterpolatingScorer testScorer = (LinearInterpolatingScorer) wordScorer; + assertThat(wordScorer, instanceOf(LinearInterpolatingScorer.class)); assertEquals(testModel.getTrigramLambda(), (testScorer).trigramLambda(), 1e-15); assertEquals(testModel.getBigramLambda(), (testScorer).bigramLambda(), 1e-15); assertEquals(testModel.getUnigramLambda(), (testScorer).unigramLambda(), 1e-15); diff --git a/core/src/test/java/org/elasticsearch/search/suggest/phrase/NoisyChannelSpellCheckerTests.java b/core/src/test/java/org/elasticsearch/search/suggest/phrase/NoisyChannelSpellCheckerTests.java index 2143c7be9e0..a7d6e8b920a 100644 --- a/core/src/test/java/org/elasticsearch/search/suggest/phrase/NoisyChannelSpellCheckerTests.java +++ b/core/src/test/java/org/elasticsearch/search/suggest/phrase/NoisyChannelSpellCheckerTests.java @@ -322,7 +322,7 @@ public class NoisyChannelSpellCheckerTests extends ESTestCase { } DirectoryReader ir = DirectoryReader.open(writer); - WordScorer wordScorer = new LinearInterpoatingScorer(ir, MultiFields.getTerms(ir, "body_ngram"), "body_ngram", 0.85d, new BytesRef(" "), 0.5, 0.4, 0.1); + WordScorer wordScorer = new LinearInterpolatingScorer(ir, MultiFields.getTerms(ir, "body_ngram"), "body_ngram", 0.85d, new BytesRef(" "), 0.5, 0.4, 0.1); NoisyChannelSpellChecker suggester = new NoisyChannelSpellChecker(); DirectSpellChecker spellchecker = new DirectSpellChecker(); @@ -336,7 +336,7 @@ public class NoisyChannelSpellCheckerTests extends ESTestCase { assertThat(corrections.length, equalTo(0)); // assertThat(corrections[0].join(new BytesRef(" ")).utf8ToString(), equalTo("american ape")); - wordScorer = new LinearInterpoatingScorer(ir, MultiFields.getTerms(ir, "body_ngram"), "body_ngram", 0.85d, new BytesRef(" "), 0.5, 0.4, 0.1); + wordScorer = new LinearInterpolatingScorer(ir, MultiFields.getTerms(ir, "body_ngram"), "body_ngram", 0.85d, new BytesRef(" "), 0.5, 0.4, 0.1); corrections = suggester.getCorrections(wrapper, new BytesRef("Xor the Got-Jewel"), generator, 0.5f, 4, ir, "body", wordScorer, 0, 3).corrections; assertThat(corrections.length, equalTo(4)); assertThat(corrections[0].join(new BytesRef(" ")).utf8ToString(), equalTo("xorr the god jewel")); @@ -383,7 +383,7 @@ public class NoisyChannelSpellCheckerTests extends ESTestCase { spellchecker.setMinPrefix(1); spellchecker.setMinQueryLength(1); suggester = new NoisyChannelSpellChecker(0.95); - wordScorer = new LinearInterpoatingScorer(ir, MultiFields.getTerms(ir, "body_ngram"), "body_ngram", 0.95d, new BytesRef(" "), 0.5, 0.4, 0.1); + wordScorer = new LinearInterpolatingScorer(ir, MultiFields.getTerms(ir, "body_ngram"), "body_ngram", 0.95d, new BytesRef(" "), 0.5, 0.4, 0.1); corrections = suggester.getCorrections(analyzer, new BytesRef("captian usa"), generator, 2, 4, ir, "body", wordScorer, 1, 3).corrections; assertThat(corrections[0].join(new BytesRef(" ")).utf8ToString(), equalTo("captain america"));