Share via


EdgeNGramTokenFilter Class

public final class EdgeNGramTokenFilter
extends TokenFilter

Generates n-grams of the given size(s) starting from the front or the back of an input token. This token filter is implemented using Apache Lucene.

Constructor Summary

Constructor Description
EdgeNGramTokenFilter(String name)

Constructor of TokenFilter.

Method Summary

Modifier and Type Method and Description
Integer getMaxGram()

Get the maxGram property: The maximum n-gram length.

Integer getMinGram()

Get the minGram property: The minimum n-gram length.

EdgeNGramTokenFilterSide getSide()

Get the side property: Specifies which side of the input the n-gram should be generated from.

EdgeNGramTokenFilter setMaxGram(Integer maxGram)

Set the maxGram property: The maximum n-gram length.

EdgeNGramTokenFilter setMinGram(Integer minGram)

Set the minGram property: The minimum n-gram length.

EdgeNGramTokenFilter setSide(EdgeNGramTokenFilterSide side)

Set the side property: Specifies which side of the input the n-gram should be generated from.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from TokenFilter

Methods inherited from java.lang.Object

Constructor Details

EdgeNGramTokenFilter

public EdgeNGramTokenFilter(String name)

Constructor of TokenFilter.

Parameters:

name - The name of the token filter. It must only contain letters, digits, spaces, dashes or underscores, can only start and end with alphanumeric characters, and is limited to 128 characters.

Method Details

getMaxGram

public Integer getMaxGram()

Get the maxGram property: The maximum n-gram length. Default is 2.

Returns:

the maxGram value.

getMinGram

public Integer getMinGram()

Get the minGram property: The minimum n-gram length. Default is 1. Must be less than the value of maxGram.

Returns:

the minGram value.

getSide

public EdgeNGramTokenFilterSide getSide()

Get the side property: Specifies which side of the input the n-gram should be generated from. Default is "front". Possible values include: 'Front', 'Back'.

Returns:

the side value.

setMaxGram

public EdgeNGramTokenFilter setMaxGram(Integer maxGram)

Set the maxGram property: The maximum n-gram length. Default is 2.

Parameters:

maxGram - the maxGram value to set.

Returns:

the EdgeNGramTokenFilter object itself.

setMinGram

public EdgeNGramTokenFilter setMinGram(Integer minGram)

Set the minGram property: The minimum n-gram length. Default is 1. Must be less than the value of maxGram.

Parameters:

minGram - the minGram value to set.

Returns:

the EdgeNGramTokenFilter object itself.

setSide

public EdgeNGramTokenFilter setSide(EdgeNGramTokenFilterSide side)

Set the side property: Specifies which side of the input the n-gram should be generated from. Default is "front". Possible values include: 'Front', 'Back'.

Parameters:

side - the side value to set.

Returns:

the EdgeNGramTokenFilter object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

EdgeNGramTokenFilter.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to