drepr.models.parsers.v1.align_parser#

Classes

AlignParser()

Alignments are defined as a list

class AlignParser[source]#

Bases: object

Alignments are defined as a list

``` - type: <alignment_type>

# other properties

```

If <alignment_type> is dimension, we have two schemas:
  1. align by one dimension

``` - type: dimension

value: <source_attr_id>:<step_index> <-> <target_attr_id>:<step_index>

```

  1. align by multiple dimensions

``` - type: dimension

source: <attr_id> target: <attr_id> aligned_dims:

  • { source: <step_index>, target: <step_index> }

  • { source: <step_index>, target: <step_index> }

```

If <alignment_type> is value, then the schema is

``` - type: value

source: <attr_id> target: <attr_id>

```

If <alignment_type> is auto, then the schema is:

``` - type: auto

attributes: <list of attributes to align>

```

The attributes are optional, if not provided, the system will try to align all attributes automatically based on the dimension

ALIGNMENT_TYPES_VALUES = {'auto', 'dimension', 'identical', 'value'}#
REG_DALIGN = re.compile('^([^:]+)(?::(\\d+))? *<-> *([^:]+)(?::(\\d+))?$')#
DALIGN_KEYS = {'aligned_dims', 'source', 'target', 'type'}#
DALIGN_ALIGNED_DIMS_KEYS = {'source', 'target'}#
VALIGN_KEYS = {'source', 'target', 'type'}#
classmethod parse(alignments: List[dict]) List[Union[RangeAlignment, ValueAlignment, IdenticalAlign, AutoAlignment]][source]#
Parameters:

alignments (List[dict]) –

Return type:

List[Union[RangeAlignment, ValueAlignment, IdenticalAlign, AutoAlignment]]

classmethod parse_range_align(conf: dict, parse_trace: str) RangeAlignment[source]#
Parameters:
  • conf (dict) –

  • parse_trace (str) –

Return type:

RangeAlignment

classmethod parse_value_align(conf: dict, parse_trace: str) ValueAlignment[source]#
Parameters:
  • conf (dict) –

  • parse_trace (str) –

Return type:

ValueAlignment

classmethod parse_auto_align(conf: dict, parse_trace: str) AutoAlignment[source]#
Parameters:
  • conf (dict) –

  • parse_trace (str) –

Return type:

AutoAlignment