Processors

class jertl.processors.Matcher(structure)

Class which compares data to a structure and returns all Matches

__init__(structure)
Parameters

structure (str) – pattern describing structure to be identified

match_all(data)

match_all Generate all Matches of a structure to data.

Parameters

data ((Sequence | Mapping | Number)) – Python data structure to examine

Yields

Match – All possible Matches

match(data)

match Matches a structure to data.

Parameters

data ((Sequence | Mapping | Number)) – Python data structure to match

Returns

(Sequence | Mapping | Number)

Return type

Optional(Match)

class jertl.processors.Filler(structure)

Class which performs fills

__init__(structure)
Parameters

structure (str) – pattern describing structure to be used for creating new data

fill(**bindings)

fill Fills structure and returns data with structure variables replaced with their bindings

Parameters

**bindings (Dict[str, list | dict | str | Number]) – Initial variable bindings

Returns

data

Return type

(list | dict | str | Number)

class jertl.processors.Transformer(transform)

A transformer with compile structure

__init__(transform)
Parameters

transform (str) – pattern describing a transform

transform_all(data)

transform_all finds all possible transforms of data

Parameters

data ((list | dict | str | Number)) – Data structure to be transformed

Yields

Transformation – All possible transforms of the sources

transform(data)

transform Finds a transform of data

Parameters

data ((list | dict | str | Number)) – Data structure to be transformed

Returns

Optional(Transformer):: A Transformation if one was found

class jertl.processors.Collator(collation)

Class which performs collations

__init__(collation)
Parameters

collation (str) – pattern describing a collation

collate_all(**bindings)

collate_all Yield all possible collations of data

Parameters

**bindings (Dict[str, list | dict | str | Number]) – Initial variable bindings

Yields

Collation – All possible collations

collate(**bindings)

collate Find a collation if any

Parameters

**bindings (Dict[str, list | dict | str | Number]) – Initial variable bindings

Returns

A Collation

Return type

Optional(Collation)

class jertl.processors.Rule(rule)

Class which finds inferences of a production rule

__init__(rule)
Parameters

rule (str) – pattern describing an inference rule

infer_all(**bindings)

infer_all Yield all possible inferences of rule applied to data

Parameters

**bindings (Dict[str, list | dict | str | Number]) – Initial variable bindings

Yields

Inference – All possible inferences

infer(**bindings)

infer Finds an inference of rule applied to data (if any)

Parameters

**bindings (Dict[str, list | dict | str | Number]) – Initial variable bindings

Returns

An inference

Return type

Optional(Inference)