Skip to content

Commit f6e4b9a

Browse files
jsorefjavanna
authored andcommitted
Spelling: correct wrong spellings of likelihood (#37052)
1 parent 5d5d5c2 commit f6e4b9a

11 files changed

+26
-26
lines changed

server/src/main/java/org/elasticsearch/search/suggest/phrase/Laplace.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static SmoothingModel fromXContent(XContentParser parser) throws IOExcept
119119

120120
@Override
121121
public WordScorerFactory buildWordScorerFactory() {
122-
return (IndexReader reader, Terms terms, String field, double realWordLikelyhood, BytesRef separator)
123-
-> new LaplaceScorer(reader, terms, field, realWordLikelyhood, separator, alpha);
122+
return (IndexReader reader, Terms terms, String field, double realWordLikelihood, BytesRef separator)
123+
-> new LaplaceScorer(reader, terms, field, realWordLikelihood, separator, alpha);
124124
}
125125
}

server/src/main/java/org/elasticsearch/search/suggest/phrase/LaplaceScorer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ final class LaplaceScorer extends WordScorer {
2929
private double alpha;
3030

3131
LaplaceScorer(IndexReader reader, Terms terms, String field,
32-
double realWordLikelyhood, BytesRef separator, double alpha) throws IOException {
33-
super(reader, terms, field, realWordLikelyhood, separator);
32+
double realWordLikelihood, BytesRef separator, double alpha) throws IOException {
33+
super(reader, terms, field, realWordLikelihood, separator);
3434
this.alpha = alpha;
3535
}
3636

server/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolatingScorer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public final class LinearInterpolatingScorer extends WordScorer {
3232
private final double bigramLambda;
3333
private final double trigramLambda;
3434

35-
public LinearInterpolatingScorer(IndexReader reader, Terms terms, String field, double realWordLikelyhood, BytesRef separator,
35+
public LinearInterpolatingScorer(IndexReader reader, Terms terms, String field, double realWordLikelihood, BytesRef separator,
3636
double trigramLambda, double bigramLambda, double unigramLambda) throws IOException {
37-
super(reader, terms, field, realWordLikelyhood, separator);
37+
super(reader, terms, field, realWordLikelihood, separator);
3838
double sum = unigramLambda + bigramLambda + trigramLambda;
3939
this.unigramLambda = unigramLambda / sum;
4040
this.bigramLambda = bigramLambda / sum;

server/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ public static LinearInterpolation fromXContent(XContentParser parser) throws IOE
168168

169169
@Override
170170
public WordScorerFactory buildWordScorerFactory() {
171-
return (IndexReader reader, Terms terms, String field, double realWordLikelyhood, BytesRef separator) ->
172-
new LinearInterpolatingScorer(reader, terms, field, realWordLikelyhood, separator, trigramLambda, bigramLambda,
171+
return (IndexReader reader, Terms terms, String field, double realWordLikelihood, BytesRef separator) ->
172+
new LinearInterpolatingScorer(reader, terms, field, realWordLikelihood, separator, trigramLambda, bigramLambda,
173173
unigramLambda);
174174
}
175175
}

server/src/main/java/org/elasticsearch/search/suggest/phrase/NoisyChannelSpellChecker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838

3939
//TODO public for tests
4040
public final class NoisyChannelSpellChecker {
41-
public static final double REAL_WORD_LIKELYHOOD = 0.95d;
41+
public static final double REAL_WORD_LIKELIHOOD = 0.95d;
4242
public static final int DEFAULT_TOKEN_LIMIT = 10;
4343
private final double realWordLikelihood;
4444
private final boolean requireUnigram;
4545
private final int tokenLimit;
4646

4747
public NoisyChannelSpellChecker() {
48-
this(REAL_WORD_LIKELYHOOD);
48+
this(REAL_WORD_LIKELIHOOD);
4949
}
5050

5151
public NoisyChannelSpellChecker(double nonErrorLikelihood) {

server/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggester.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private PhraseSuggester() {}
6969
@Override
7070
public Suggestion<? extends Entry<? extends Option>> innerExecute(String name, PhraseSuggestionContext suggestion,
7171
IndexSearcher searcher, CharsRefBuilder spare) throws IOException {
72-
double realWordErrorLikelihood = suggestion.realworldErrorLikelyhood();
72+
double realWordErrorLikelihood = suggestion.realworldErrorLikelihood();
7373
final PhraseSuggestion response = new PhraseSuggestion(name, suggestion.getSize());
7474
final IndexReader indexReader = searcher.getIndexReader();
7575
List<PhraseSuggestionContext.DirectCandidateGenerator> generators = suggestion.generators();

server/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestionContext.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class PhraseSuggestionContext extends SuggestionContext {
4040
static final float DEFAULT_RWE_ERRORLIKELIHOOD = 0.95f;
4141
static final float DEFAULT_MAX_ERRORS = 0.5f;
4242
static final String DEFAULT_SEPARATOR = " ";
43-
static final WordScorer.WordScorerFactory DEFAULT_SCORER = (IndexReader reader, Terms terms, String field, double realWordLikelyhood,
44-
BytesRef separator) -> new StupidBackoffScorer(reader, terms, field, realWordLikelyhood, separator, 0.4f);
43+
static final WordScorer.WordScorerFactory DEFAULT_SCORER = (IndexReader reader, Terms terms, String field, double realWordLikelihood,
44+
BytesRef separator) -> new StupidBackoffScorer(reader, terms, field, realWordLikelihood, separator, 0.4f);
4545

4646
private float maxErrors = DEFAULT_MAX_ERRORS;
4747
private BytesRef separator = new BytesRef(DEFAULT_SEPARATOR);
@@ -78,7 +78,7 @@ public void setSeparator(BytesRef separator) {
7878
this.separator = separator;
7979
}
8080

81-
public Float realworldErrorLikelyhood() {
81+
public Float realworldErrorLikelihood() {
8282
return realworldErrorLikelihood;
8383
}
8484

server/src/main/java/org/elasticsearch/search/suggest/phrase/StupidBackoff.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public static SmoothingModel fromXContent(XContentParser parser) throws IOExcept
122122

123123
@Override
124124
public WordScorerFactory buildWordScorerFactory() {
125-
return (IndexReader reader, Terms terms, String field, double realWordLikelyhood, BytesRef separator)
126-
-> new StupidBackoffScorer(reader, terms, field, realWordLikelyhood, separator, discount);
125+
return (IndexReader reader, Terms terms, String field, double realWordLikelihood, BytesRef separator)
126+
-> new StupidBackoffScorer(reader, terms, field, realWordLikelihood, separator, discount);
127127
}
128128
}

server/src/main/java/org/elasticsearch/search/suggest/phrase/StupidBackoffScorer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class StupidBackoffScorer extends WordScorer {
2929
private final double discount;
3030

3131
StupidBackoffScorer(IndexReader reader, Terms terms,String field,
32-
double realWordLikelyhood, BytesRef separator, double discount) throws IOException {
33-
super(reader, terms, field, realWordLikelyhood, separator);
32+
double realWordLikelihood, BytesRef separator, double discount) throws IOException {
33+
super(reader, terms, field, realWordLikelihood, separator);
3434
this.discount = discount;
3535
}
3636

server/src/main/java/org/elasticsearch/search/suggest/phrase/WordScorer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ public abstract class WordScorer {
3737
protected final String field;
3838
protected final Terms terms;
3939
protected final long vocabluarySize;
40-
protected final double realWordLikelyhood;
40+
protected final double realWordLikelihood;
4141
protected final BytesRefBuilder spare = new BytesRefBuilder();
4242
protected final BytesRef separator;
4343
protected final long numTerms;
4444
private final TermsEnum termsEnum;
4545
private final boolean useTotalTermFreq;
4646

47-
public WordScorer(IndexReader reader, String field, double realWordLikelyHood, BytesRef separator) throws IOException {
48-
this(reader, MultiTerms.getTerms(reader, field), field, realWordLikelyHood, separator);
47+
public WordScorer(IndexReader reader, String field, double realWordLikelihood, BytesRef separator) throws IOException {
48+
this(reader, MultiTerms.getTerms(reader, field), field, realWordLikelihood, separator);
4949
}
5050

51-
public WordScorer(IndexReader reader, Terms terms, String field, double realWordLikelyHood, BytesRef separator) throws IOException {
51+
public WordScorer(IndexReader reader, Terms terms, String field, double realWordLikelihood, BytesRef separator) throws IOException {
5252
this.field = field;
5353
if (terms == null) {
5454
throw new IllegalArgumentException("Field: [" + field + "] does not exist");
@@ -65,7 +65,7 @@ public WordScorer(IndexReader reader, Terms terms, String field, double realWord
6565
this.termsEnum = new FreqTermsEnum(reader, field, !useTotalTermFreq, useTotalTermFreq, null,
6666
BigArrays.NON_RECYCLING_INSTANCE); // non recycling for now
6767
this.reader = reader;
68-
this.realWordLikelyhood = realWordLikelyHood;
68+
this.realWordLikelihood = realWordLikelihood;
6969
this.separator = separator;
7070
}
7171

@@ -78,7 +78,7 @@ public long frequency(BytesRef term) throws IOException {
7878

7979
protected double channelScore(Candidate candidate, Candidate original) throws IOException {
8080
if (candidate.stringDistance == 1.0d) {
81-
return realWordLikelyhood;
81+
return realWordLikelihood;
8282
}
8383
return candidate.stringDistance;
8484
}
@@ -117,6 +117,6 @@ public static BytesRef join(BytesRef separator, BytesRefBuilder result, BytesRef
117117

118118
public interface WordScorerFactory {
119119
WordScorer newScorer(IndexReader reader, Terms terms,
120-
String field, double realWordLikelyhood, BytesRef separator) throws IOException;
120+
String field, double realWordLikelihood, BytesRef separator) throws IOException;
121121
}
122122
}

server/src/test/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestionBuilderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ protected void assertSuggestionContext(PhraseSuggestionBuilder builder, Suggesti
195195
assertOptionalEquals(builder.confidence(), phraseSuggesterCtx.confidence(), PhraseSuggestionContext.DEFAULT_CONFIDENCE);
196196
assertOptionalEquals(builder.collatePrune(), phraseSuggesterCtx.collatePrune(), PhraseSuggestionContext.DEFAULT_COLLATE_PRUNE);
197197
assertEquals(builder.separator(), phraseSuggesterCtx.separator().utf8ToString());
198-
assertOptionalEquals(builder.realWordErrorLikelihood(), phraseSuggesterCtx.realworldErrorLikelyhood(),
198+
assertOptionalEquals(builder.realWordErrorLikelihood(), phraseSuggesterCtx.realworldErrorLikelihood(),
199199
PhraseSuggestionContext.DEFAULT_RWE_ERRORLIKELIHOOD);
200200
assertOptionalEquals(builder.maxErrors(), phraseSuggesterCtx.maxErrors(), PhraseSuggestionContext.DEFAULT_MAX_ERRORS);
201201
assertOptionalEquals(builder.forceUnigrams(), phraseSuggesterCtx.getRequireUnigram(),

0 commit comments

Comments
 (0)