Skip to content

FllImporter

FllImporter

Bases: Importer

Import an engine and its components described using the FuzzyLite Language.

related

Attributes

separator instance-attribute

separator = separator

Functions

__init__

__init__(separator: str = '\n') -> None

Constructor.

Parameters:

Name Type Description Default
separator str

separation between components of the FuzzyLite Language.

'\n'

_process

_process(component: str, block: list[str], engine: Engine) -> None

Process the main components of the FuzzyLite Language, namely Engine, InputVariable, OutputVariable and RuleBlock.

Parameters:

Name Type Description Default
component str

one of Engine, InputVariable, OutputVariable and RuleBlock

required
block list[str]

list of lines that make up the component

required
engine Engine

engine to add the component to

required

activation

activation(fll: str) -> Activation | None

Return the activation method described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

activation method described using the FuzzyLite Language

required

Returns:

Type Description
Activation | None

activation method described using the FuzzyLite Language

boolean

boolean(fll: str) -> bool

Returns a boolean value described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

true or false

required

Returns:

Type Description
bool

boolean value described using the FuzzyLite Language.

component

component(
    cls: type[Activation | Defuzzifier | TNorm | SNorm], fll: str
) -> Activation | Defuzzifier | TNorm | SNorm | None

Return the component described using the FuzzyLite Language.

Parameters:

Name Type Description Default
cls type[Activation | Defuzzifier | TNorm | SNorm]

class of the component to import

required
fll str

component described using the FuzzyLite Language

required

Returns:

Type Description
Activation | Defuzzifier | TNorm | SNorm | None

component described using the FuzzyLite Language

defuzzifier

defuzzifier(fll: str) -> Defuzzifier | None

Return the defuzzifier described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

defuzzifier described using the FuzzyLite Language

required

Returns:

Type Description
Defuzzifier | None

defuzzifier described using the FuzzyLite Language

engine

engine(fll: str) -> Engine

Return the engine describe using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

engine described using the FuzzyLite Language

required

Returns:

Type Description
Engine

engine described using the FuzzyLite Language

extract_key_value

extract_key_value(fll: str, component: str | None = None) -> tuple[str, str]

Return key-value pair described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

key-value pair in the form key: value

required
component str | None

name of the key to extract

None

Returns:

Type Description
tuple[str, str]

tuple of (key, value)

extract_value

extract_value(fll: str, component: str | None = None) -> str

Return value from the key: value pair described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

key-value pair in the form key: value

required
component str | None

name of the key to extract

None

Returns:

Type Description
str

value from the key: value pair described using the FuzzyLite Language

from_string

from_string(text: str) -> Engine

Return the engine describe using the FuzzyLite Language.

Parameters:

Name Type Description Default
text str

engine described using the FuzzyLite Language

required

Returns:

Type Description
Engine

engine described using the FuzzyLite Language

input_variable

input_variable(fll: str, engine: Engine | None = None) -> InputVariable

Return the input variable described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

input variable described using the FuzzyLite Language

required
engine Engine | None

engine to update the reference of the terms in the variable

None

Returns:

Type Description
InputVariable

input variable described using the FuzzyLite Language

output_variable

output_variable(fll: str, engine: Engine | None = None) -> OutputVariable

Return the output variable described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

output variable described using the FuzzyLite Language

required
engine Engine | None

engine to update the reference of the terms in the variable

None

Returns:

Type Description
OutputVariable

output variable described using the FuzzyLite Language

range

range(fll: str) -> tuple[float, float]

Returns the values of a range described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

range of values described using the FuzzyLite Language (eg, 0.0 1.0)

required

Returns:

Type Description
tuple[float, float]

range of values described using the FuzzyLite Language

rule

rule(fll: str, engine: Engine | None = None) -> Rule | None

Return the rule described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

rule described using the FuzzyLite Language

required
engine Engine | None

engine to load the rule

None

Returns:

Type Description
Rule | None

rule described using the FuzzyLite Language

rule_block

rule_block(fll: str, engine: Engine | None = None) -> RuleBlock

Return the rule block described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

rule block described using the FuzzyLite Language

required
engine Engine | None

engine to use for loading the rules

None

Returns:

Type Description
RuleBlock

rule block described using the FuzzyLite Language

snorm

snorm(fll: str) -> SNorm | None

Return the SNorm described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

SNorm described using the FuzzyLite Language

required

Returns:

Type Description
SNorm | None

SNorm described using the FuzzyLite Language

term

term(fll: str, engine: Engine | None = None) -> Term

Return the term described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

term described using the FuzzyLite Language

required
engine Engine | None

engine to update the reference of the term

None

Returns:

Type Description
Term

term described using the FuzzyLite Language

tnorm

tnorm(fll: str) -> TNorm | None

Return the TNorm described using the FuzzyLite Language.

Parameters:

Name Type Description Default
fll str

TNorm described using the FuzzyLite Language

required

Returns:

Type Description
TNorm | None

TNorm described using the FuzzyLite Language