Toplevel functions
Matching
- jertl.match(structure, data)
Matches a structure to data.
- Parameters
structure (str) – A pattern defining the structure to compare to data.
data ((Sequence | Mapping | Number)) – Python data to compare structure against
- Returns
A description of the match
- Return type
Optional(
Match
)
Filling
- jertl.fill(structure, **bindings)
Populate a structure.
- Parameters
structure (str) – A pattern defining the structure to compare to the target data.
**bindings (Dict[str, list | dict | str | Number]) – values for free variables referenced by template
- Returns
A filled template
- Return type
Dict | Sequence | Number
Transforming
- jertl.transform(transform, data)
Matches a structure to data and fills a target structure.
- Parameters
transform (str) – A pattern describing structures for matching and filling.
data (Dict | Sequence | Number) – Data to match against.
- Returns
Optional(
Transformer
):: A Transformation
- jertl.transform_all(transform, data)
Generate all Transforms of data given Transformation specification.
- Parameters
transform (str) – A pattern describing structures for matching and filling.
data (KwArgs) – Data to match against.
- Yields
Transformation
– All possible transforms of the sources
- jertl.compile_transform(transform)
Compiles a transform pattern for later reuse.
- Parameters
transform (str) – Pattern describing a transform.
- Returns
A transformer
- Return type
Collating
- jertl.collate(collation, **bindings)
Match all matchers to targets
- Parameters
collation (str) – Specification of collation.
**bindings (Dict[str, list | dict | str | Number]) – Data to match against.
- Returns
A Collation
- Return type
Optional(
Collation
)
Inferring
- jertl.infer(rule, **sources)
Applies a production rule agains sources and generates new data according to output structures
- Parameters
rule (str) – Pattern describing a production rule.
**sources (Dict[str, list | dict | str | Number]) – Data to match against.
- Returns
An inference
- Return type
Optional(
Inference
)