Class StupidBackoff
java.lang.Object
org.elasticsearch.search.suggest.phrase.SmoothingModel
org.elasticsearch.search.suggest.phrase.StupidBackoff
- All Implemented Interfaces:
NamedWriteable
,Writeable
,ToXContent
,ToXContentFragment
public final class StupidBackoff extends SmoothingModel
A "stupid-backoff" smoothing model similar to Katz's
Backoff. This model is used as the default if no model is configured.
See N-Gram Smoothing for details.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_BACKOFF_DISCOUNT
Default discount parameter forStupidBackoff
smoothingstatic java.lang.String
NAME
-
Constructor Summary
Constructors Constructor Description StupidBackoff(double discount)
Creates a Stupid-Backoff smoothing model.StupidBackoff(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 SmoothingModel
fromXContent(XContentParser parser)
double
getDiscount()
java.lang.String
getWriteableName()
Returns the name of the writeable objectprotected XContentBuilder
innerToXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class org.elasticsearch.search.suggest.phrase.SmoothingModel
equals, hashCode, toXContent
-
Field Details
-
DEFAULT_BACKOFF_DISCOUNT
public static final double DEFAULT_BACKOFF_DISCOUNTDefault discount parameter forStupidBackoff
smoothing- See Also:
- Constant Field Values
-
NAME
public static final java.lang.String NAME- See Also:
- Constant Field Values
-
-
Constructor Details
-
StupidBackoff
public StupidBackoff(double discount)Creates a Stupid-Backoff smoothing model.- Parameters:
discount
- the discount given to lower order ngrams if the higher order ngram doesn't exits
-
StupidBackoff
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
-
getDiscount
public double getDiscount()- Returns:
- the discount parameter of the model
-
innerToXContent
protected XContentBuilder innerToXContent(XContentBuilder builder, 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
- Throws:
java.io.IOException
-
buildWordScorerFactory
- Specified by:
buildWordScorerFactory
in classSmoothingModel
-