ShingleTokenFilter Class

public final class ShingleTokenFilter
extends TokenFilter

Creates combinations of tokens as a single token. This token filter is implemented using Apache Lucene.

Constructor Summary

Constructor Description
ShingleTokenFilter(String name)

Creates an instance of ShingleTokenFilter class.

Method Summary

Modifier and Type Method and Description
Boolean areOutputUnigrams()

Get the outputUnigrams property: A value indicating whether the output stream will contain the input tokens (unigrams) as well as shingles.

Boolean areOutputUnigramsIfNoShingles()

Get the outputUnigramsIfNoShingles property: A value indicating whether to output unigrams for those times when no shingles are available.

static ShingleTokenFilter fromJson(JsonReader jsonReader)

Reads an instance of ShingleTokenFilter from the JsonReader.

String getFilterToken()

Get the filterToken property: The string to insert for each position at which there is no token.

Integer getMaxShingleSize()

Get the maxShingleSize property: The maximum shingle size.

Integer getMinShingleSize()

Get the minShingleSize property: The minimum shingle size.

String getOdataType()

Get the odataType property: A URI fragment specifying the type of token filter.

String getTokenSeparator()

Get the tokenSeparator property: The string to use when joining adjacent tokens to form a shingle.

ShingleTokenFilter setFilterToken(String filterToken)

Set the filterToken property: The string to insert for each position at which there is no token.

ShingleTokenFilter setMaxShingleSize(Integer maxShingleSize)

Set the maxShingleSize property: The maximum shingle size.

ShingleTokenFilter setMinShingleSize(Integer minShingleSize)

Set the minShingleSize property: The minimum shingle size.

ShingleTokenFilter setOutputUnigrams(Boolean outputUnigrams)

Set the outputUnigrams property: A value indicating whether the output stream will contain the input tokens (unigrams) as well as shingles.

ShingleTokenFilter setOutputUnigramsIfNoShingles(Boolean outputUnigramsIfNoShingles)

Set the outputUnigramsIfNoShingles property: A value indicating whether to output unigrams for those times when no shingles are available.

ShingleTokenFilter setTokenSeparator(String tokenSeparator)

Set the tokenSeparator property: The string to use when joining adjacent tokens to form a shingle.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from TokenFilter

Methods inherited from java.lang.Object

Constructor Details

ShingleTokenFilter

public ShingleTokenFilter(String name)

Creates an instance of ShingleTokenFilter class.

Parameters:

name - the name value to set.

Method Details

areOutputUnigrams

public Boolean areOutputUnigrams()

Get the outputUnigrams property: A value indicating whether the output stream will contain the input tokens (unigrams) as well as shingles. Default is true.

Returns:

the outputUnigrams value.

areOutputUnigramsIfNoShingles

public Boolean areOutputUnigramsIfNoShingles()

Get the outputUnigramsIfNoShingles property: A value indicating whether to output unigrams for those times when no shingles are available. This property takes precedence when outputUnigrams is set to false. Default is false.

Returns:

the outputUnigramsIfNoShingles value.

fromJson

public static ShingleTokenFilter fromJson(JsonReader jsonReader)

Reads an instance of ShingleTokenFilter from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of ShingleTokenFilter if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getFilterToken

public String getFilterToken()

Get the filterToken property: The string to insert for each position at which there is no token. Default is an underscore ("_").

Returns:

the filterToken value.

getMaxShingleSize

public Integer getMaxShingleSize()

Get the maxShingleSize property: The maximum shingle size. Default and minimum value is 2.

Returns:

the maxShingleSize value.

getMinShingleSize

public Integer getMinShingleSize()

Get the minShingleSize property: The minimum shingle size. Default and minimum value is 2. Must be less than the value of maxShingleSize.

Returns:

the minShingleSize value.

getOdataType

public String getOdataType()

Get the odataType property: A URI fragment specifying the type of token filter.

Overrides:

ShingleTokenFilter.getOdataType()

Returns:

the odataType value.

getTokenSeparator

public String getTokenSeparator()

Get the tokenSeparator property: The string to use when joining adjacent tokens to form a shingle. Default is a single space (" ").

Returns:

the tokenSeparator value.

setFilterToken

public ShingleTokenFilter setFilterToken(String filterToken)

Set the filterToken property: The string to insert for each position at which there is no token. Default is an underscore ("_").

Parameters:

filterToken - the filterToken value to set.

Returns:

the ShingleTokenFilter object itself.

setMaxShingleSize

public ShingleTokenFilter setMaxShingleSize(Integer maxShingleSize)

Set the maxShingleSize property: The maximum shingle size. Default and minimum value is 2.

Parameters:

maxShingleSize - the maxShingleSize value to set.

Returns:

the ShingleTokenFilter object itself.

setMinShingleSize

public ShingleTokenFilter setMinShingleSize(Integer minShingleSize)

Set the minShingleSize property: The minimum shingle size. Default and minimum value is 2. Must be less than the value of maxShingleSize.

Parameters:

minShingleSize - the minShingleSize value to set.

Returns:

the ShingleTokenFilter object itself.

setOutputUnigrams

public ShingleTokenFilter setOutputUnigrams(Boolean outputUnigrams)

Set the outputUnigrams property: A value indicating whether the output stream will contain the input tokens (unigrams) as well as shingles. Default is true.

Parameters:

outputUnigrams - the outputUnigrams value to set.

Returns:

the ShingleTokenFilter object itself.

setOutputUnigramsIfNoShingles

public ShingleTokenFilter setOutputUnigramsIfNoShingles(Boolean outputUnigramsIfNoShingles)

Set the outputUnigramsIfNoShingles property: A value indicating whether to output unigrams for those times when no shingles are available. This property takes precedence when outputUnigrams is set to false. Default is false.

Parameters:

outputUnigramsIfNoShingles - the outputUnigramsIfNoShingles value to set.

Returns:

the ShingleTokenFilter object itself.

setTokenSeparator

public ShingleTokenFilter setTokenSeparator(String tokenSeparator)

Set the tokenSeparator property: The string to use when joining adjacent tokens to form a shingle. Default is a single space (" ").

Parameters:

tokenSeparator - the tokenSeparator value to set.

Returns:

the ShingleTokenFilter object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

ShingleTokenFilter.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to

Azure SDK for Java

Latest