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
This commit is contained in:
parent
c63415d091
commit
aa583c4064
|
@ -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;
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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"));
|
||||
|
||||
|
|
Loading…
Reference in New Issue