TableDiscreteFunction class

TableDiscreteFunction class

Represents the fuzzy search algorithm that contains correspondences between word lengths and the number of allowed mistakes.

Learn more:

The TableDiscreteFunction type exposes the following members:

Constructors

Constructor Description
init Initializes a new TableDiscreteFunction instance.
init Initializes a new TableDiscreteFunction.

Methods

Method Description
get_max_mistake_count Returns the maximum allowed number of mistakes for the specified term length.
get_similarity_level Gets a similarity level for the specified term length.

Example

from groupdocs.search import Index
from groupdocs.search.options import SearchOptions, TableDiscreteFunction, Step

index = Index("./index")
index.add("./documents")

options = SearchOptions()
options.fuzzy_search.enabled = True
# Use a step function: max 1 mistake for words 1‑4 characters,
# 2 mistakes for 5‑7 characters, and 3 mistakes for 8+ characters.
options.fuzzy_search.fuzzy_algorithm = TableDiscreteFunction(1, [Step(5, 2), Step(8, 3)])

result = index.search("Einstein", options)
print(result.document_count)

Guides

Task guides that use TableDiscreteFunction:

See Also