ejsPhraseSuggester

PhraseSuggester extends the PhraseSuggester and suggests entire corrected phrases instead of individual tokens. The individual phrase suggestions are weighted based on ngram-langugage models. In practice it will be able to make better decision about which tokens to pick based on co-occurence and frequencies.

Module

 PhraseSuggester

PhraseSuggester ( name )

A suggester that suggests entire corrected phrases.


Since
elasticsearch 0.90
Parameters
name <String> The name which be used to refer to this suggester.

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
Objectanalyzer(analyzer)

Sets analyzer used to analyze the suggest text.

Objectconfidence(c)

Sets the confidence level defines a factor applied to the input phrases score which is used as a threshold for other suggest candidates. Only candidates that score higher than the threshold will be included in the result.

ObjectdirectGenerator(oGenerator)Adds a direct generator. If passed a single Generator it is added to the list of existing generators. If passed an array of Generators, they replace all existing generators.
Objectfield(field)

Sets the field used to generate suggestions from.

ObjectforceUnigrams(trueFalse)

Forces the use of unigrams.

ObjectgramSize(s)

Sets the max size of the n-grams (shingles) in the field. If the field doesn't contain n-grams (shingles) this should be omitted or set to 1.

Objecthighlight(preTag,postTag)

Enables highlighting of suggestions

ObjectlaplaceSmoothing(alpha)

A smoothing model that uses an additive smoothing model where a constant (typically 1.0 or smaller) is added to all counts to balance weights, The default alpha is 0.5.

ObjectlinearSmoothing(tl,bl,ul)

A smoothing model that takes the weighted mean of the unigrams, bigrams and trigrams based on user supplied weights (lambdas). The sum of tl, bl, and ul must equal 1.

ObjectmaxErrors(c)

Sets the maximum percentage of the terms that at most considered to be misspellings in order to form a correction.

ObjectrealWordErrorLikelihood(l)

Sets the likelihood of a term being a misspelled even if the term exists in the dictionary. The default it 0.95 corresponding to 5% or the real words are misspelled.

Objectseparator(sep)

Sets the separator that is used to separate terms in the bigram field. If not set the whitespce character is used as a separator.

ObjectshardSize(s)

Sets the maximum number of suggestions to be retrieved from each individual shard.

Objectsize(s)

Sets the number of suggestions returned for each token.

ObjectstupidBackoffSmoothing(discount)

A simple backoff model that backs off to lower order n-gram models if the higher order count is 0 and discounts the lower order n-gram model by a constant factor. The default discount is 0.4.

Objecttext(txt)

Sets the text to get suggestions for. If not set, the global suggestion text will be used.

StringtoJSON()

Retrieves the internal suggest object. This is typically used by internal API functions so use with caution.

ObjecttokenLimit(l)

Sets the token limit.


Method Detail

 _type

String _type ( )
The type of ejs object. For internal use only.

Returns
the type of object

 analyzer

Object analyzer ( analyzer )

Sets analyzer used to analyze the suggest text.


Parameters
analyzer <String> A valid analyzer name.
Returns
returns this so that calls can be chained.

 confidence

Object confidence ( c )

Sets the confidence level defines a factor applied to the input phrases score which is used as a threshold for other suggest candidates. Only candidates that score higher than the threshold will be included in the result.


Parameters
c <Double> A positive double value.
Returns
returns this so that calls can be chained.

 directGenerator

Object directGenerator ( oGenerator )
Adds a direct generator. If passed a single Generator it is added to the list of existing generators. If passed an array of Generators, they replace all existing generators.

Parameters
oGenerator <Generator | Generator[]> A valid Generator or array of Generator objects.
Returns
returns this so that calls can be chained.

 field

Object field ( field )

Sets the field used to generate suggestions from.


Parameters
field <String> A valid field name.
Returns
returns this so that calls can be chained.

 forceUnigrams

Object forceUnigrams ( trueFalse )

Forces the use of unigrams.


Parameters
trueFalse <Boolean> True to force unigrams, false otherwise.
Returns
returns this so that calls can be chained.

 gramSize

Object gramSize ( s )

Sets the max size of the n-grams (shingles) in the field. If the field doesn't contain n-grams (shingles) this should be omitted or set to 1.


Parameters
s <Integer> A positive integer value.
Returns
returns this so that calls can be chained.

 highlight

Object highlight ( preTag, postTag )

Enables highlighting of suggestions


Parameters
preTag <String> A tag used at highlight start.
postTag <String> A tag used at the end of the highlight.
Returns
returns this so that calls can be chained.

 laplaceSmoothing

Object laplaceSmoothing ( alpha )

A smoothing model that uses an additive smoothing model where a constant (typically 1.0 or smaller) is added to all counts to balance weights, The default alpha is 0.5.


Parameters
alpha <Double> A double value.
Returns
returns this so that calls can be chained.

 linearSmoothing

Object linearSmoothing ( tl, bl, ul )

A smoothing model that takes the weighted mean of the unigrams, bigrams and trigrams based on user supplied weights (lambdas). The sum of tl, bl, and ul must equal 1.


Parameters
tl <Double> A positive double value used for trigram weight.
bl <Double> A positive double value used for bigram weight.
ul <Double> A positive double value used for unigram weight.
Returns
returns this so that calls can be chained.

 maxErrors

Object maxErrors ( c )

Sets the maximum percentage of the terms that at most considered to be misspellings in order to form a correction.


Parameters
c <Double> A positive double value greater between 0 and 1.
Returns
returns this so that calls can be chained.

 realWordErrorLikelihood

Object realWordErrorLikelihood ( l )

Sets the likelihood of a term being a misspelled even if the term exists in the dictionary. The default it 0.95 corresponding to 5% or the real words are misspelled.


Parameters
l <Double> A positive double value greater than 0.0.
Returns
returns this so that calls can be chained.

 separator

Object separator ( sep )

Sets the separator that is used to separate terms in the bigram field. If not set the whitespce character is used as a separator.


Parameters
sep <String> A string separator.
Returns
returns this so that calls can be chained.

 shardSize

Object shardSize ( s )

Sets the maximum number of suggestions to be retrieved from each individual shard.


Parameters
s <Integer> A positive integer value.
Returns
returns this so that calls can be chained.

 size

Object size ( s )

Sets the number of suggestions returned for each token.


Parameters
s <Integer> A positive integer value.
Returns
returns this so that calls can be chained.

 stupidBackoffSmoothing

Object stupidBackoffSmoothing ( discount )

A simple backoff model that backs off to lower order n-gram models if the higher order count is 0 and discounts the lower order n-gram model by a constant factor. The default discount is 0.4.


Parameters
discount <Double> A double value.
Returns
returns this so that calls can be chained.

 text

Object text ( txt )

Sets the text to get suggestions for. If not set, the global suggestion text will be used.


Parameters
txt <String> A string to get suggestions for.
Returns
returns this so that calls can be chained.

 toJSON

String toJSON ( )

Retrieves the internal suggest object. This is typically used by internal API functions so use with caution.


Returns
returns this object's internal suggest property.

 tokenLimit

Object tokenLimit ( l )

Sets the token limit.


Parameters
l <Integer> A positive integer value.
Returns
returns this so that calls can be chained.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo