Class LinearInterpolation
java.lang.Object
org.opensearch.search.suggest.phrase.SmoothingModel
org.opensearch.search.suggest.phrase.LinearInterpolation
- All Implemented Interfaces:
NamedWriteable
,Writeable
,org.opensearch.common.xcontent.ToXContent
,org.opensearch.common.xcontent.ToXContentFragment
public final class LinearInterpolation extends SmoothingModel
Linear interpolation smoothing model.
See N-Gram Smoothing for details.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.common.xcontent.ToXContent
org.opensearch.common.xcontent.ToXContent.DelegatingMapParams, org.opensearch.common.xcontent.ToXContent.MapParams, org.opensearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.opensearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NAME
-
Constructor Summary
Constructors Constructor Description LinearInterpolation(double trigramLambda, double bigramLambda, double unigramLambda)
Creates a linear interpolation smoothing model.LinearInterpolation(StreamInput in)
Read from a stream. -
Method Summary
Modifier and Type Method Description WordScorer.WordScorerFactory
buildWordScorerFactory()
protected boolean
doEquals(SmoothingModel other)
subtype specific implementation of "equals".protected int
doHashCode()
static LinearInterpolation
fromXContent(org.opensearch.common.xcontent.XContentParser parser)
double
getBigramLambda()
double
getTrigramLambda()
double
getUnigramLambda()
java.lang.String
getWriteableName()
Returns the name of the writeable objectprotected org.opensearch.common.xcontent.XContentBuilder
innerToXContent(org.opensearch.common.xcontent.XContentBuilder builder, org.opensearch.common.xcontent.ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class org.opensearch.search.suggest.phrase.SmoothingModel
equals, hashCode, toXContent
-
Field Details
-
NAME
public static final java.lang.String NAME- See Also:
- Constant Field Values
-
-
Constructor Details
-
LinearInterpolation
public LinearInterpolation(double trigramLambda, double bigramLambda, double unigramLambda)Creates a linear interpolation smoothing model. Note: the lambdas must sum up to one.- Parameters:
trigramLambda
- the trigram lambdabigramLambda
- the bigram lambdaunigramLambda
- the unigram lambda
-
LinearInterpolation
Read from a stream.- Throws:
java.io.IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Throws:
java.io.IOException
-
getTrigramLambda
public double getTrigramLambda() -
getBigramLambda
public double getBigramLambda() -
getUnigramLambda
public double getUnigramLambda() -
innerToXContent
protected org.opensearch.common.xcontent.XContentBuilder innerToXContent(org.opensearch.common.xcontent.XContentBuilder builder, org.opensearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
innerToXContent
in classSmoothingModel
- Throws:
java.io.IOException
-
getWriteableName
public java.lang.String getWriteableName()Description copied from interface:NamedWriteable
Returns the name of the writeable object -
doEquals
Description copied from class:SmoothingModel
subtype specific implementation of "equals".- Specified by:
doEquals
in classSmoothingModel
-
doHashCode
protected int doHashCode()- Specified by:
doHashCode
in classSmoothingModel
-
fromXContent
public static LinearInterpolation fromXContent(org.opensearch.common.xcontent.XContentParser parser) throws java.io.IOException- Throws:
java.io.IOException
-
buildWordScorerFactory
- Specified by:
buildWordScorerFactory
in classSmoothingModel
-