Class StupidBackoff
java.lang.Object
org.elasticsearch.search.suggest.phrase.SmoothingModel
org.elasticsearch.search.suggest.phrase.StupidBackoff
- All Implemented Interfaces:
NamedWriteable
,Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
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
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic double
Default discount parameter forStupidBackoff
smoothingstatic String
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionStupidBackoff(double discount)
Creates a Stupid-Backoff smoothing model.Read from a stream. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
doEquals(SmoothingModel other)
subtype specific implementation of "equals".protected int
static SmoothingModel
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
double
Returns the name of the writeable objectprotected org.elasticsearch.common.xcontent.XContentBuilder
innerToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.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
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 Details
-
DEFAULT_BACKOFF_DISCOUNT
public static final double DEFAULT_BACKOFF_DISCOUNTDefault discount parameter forStupidBackoff
smoothing- See Also:
- Constant Field Values
-
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:
IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Throws:
IOException
-
getDiscount
public double getDiscount()- Returns:
- the discount parameter of the model
-
innerToXContent
protected org.elasticsearch.common.xcontent.XContentBuilder innerToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
innerToXContent
in classSmoothingModel
- Throws:
IOException
-
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 SmoothingModel fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException- Throws:
IOException
-
buildWordScorerFactory
- Specified by:
buildWordScorerFactory
in classSmoothingModel
-