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 doubleDEFAULT_BACKOFF_DISCOUNTDefault discount parameter forStupidBackoffsmoothingstatic java.lang.StringNAME-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description StupidBackoff(double discount)Creates a Stupid-Backoff smoothing model.StupidBackoff(StreamInput in)Read from a stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WordScorer.WordScorerFactorybuildWordScorerFactory()protected booleandoEquals(SmoothingModel other)subtype specific implementation of "equals".protected intdoHashCode()static SmoothingModelfromXContent(XContentParser parser)doublegetDiscount()java.lang.StringgetWriteableName()Returns the name of the writeable objectprotected XContentBuilderinnerToXContent(XContentBuilder builder, ToXContent.Params params)voidwriteTo(StreamOutput out)Write this into the StreamOutput.-
Methods inherited from class org.elasticsearch.search.suggest.phrase.SmoothingModel
equals, hashCode, toXContent
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
DEFAULT_BACKOFF_DISCOUNT
public static final double DEFAULT_BACKOFF_DISCOUNT
Default discount parameter forStupidBackoffsmoothing- See Also:
- Constant Field Values
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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
public StupidBackoff(StreamInput in) throws java.io.IOException
Read from a stream.- Throws:
java.io.IOException
-
-
Method Detail
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:WriteableWrite 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:
innerToXContentin classSmoothingModel- Throws:
java.io.IOException
-
getWriteableName
public java.lang.String getWriteableName()
Description copied from interface:NamedWriteableReturns the name of the writeable object
-
doEquals
protected boolean doEquals(SmoothingModel other)
Description copied from class:SmoothingModelsubtype specific implementation of "equals".- Specified by:
doEqualsin classSmoothingModel
-
doHashCode
protected int doHashCode()
- Specified by:
doHashCodein classSmoothingModel
-
fromXContent
public static SmoothingModel fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
buildWordScorerFactory
public WordScorer.WordScorerFactory buildWordScorerFactory()
- Specified by:
buildWordScorerFactoryin classSmoothingModel
-
-