__init__ constructor

init

Initializes a new TableDiscreteFunction instance.

def __init__(self, offset_of_inputs, table_of_outputs):
    ...
Parameter Type Description
offset_of_inputs int The offset of the table indices relative to the input values.
table_of_outputs list[int] The table of output values.
Raises Description
ValueError When the number of table elements is 0.

Example

from groupdocs.search.options import TableDiscreteFunction

# Create a function with an offset of 0 and a table defining the maximum
# number of differences for word lengths.
fuzzy_algo = TableDiscreteFunction(0, [0, 1, 1, 2, 2])

init

Initializes a new TableDiscreteFunction.

def __init__(self, first_step_level, steps):
    ...
Parameter Type Description
first_step_level int The level of the first step of the step function.
steps list[Step] The next steps of the step function.
Raises Description
ValueError If limits of steps are not strictly increasing.

Example

from groupdocs.search.options import Step, TableDiscreteFunction

# 1 mistake for words of 1-4 characters, 2 for 5-7 characters, and 3 from 8 characters on
fuzzy_algorithm = TableDiscreteFunction(1, [Step(5, 2), Step(8, 3)])

See Also