Layer

class ucca.core.Layer(ID, root, attrib=None, *, orderkey=<function id_orderkey>)[source]

Bases: object

Group of similar Node objects in UCCA annotation graph.

A Layer in UCCA annotation graph is a subgraph of the whole Passage annotation graph which consists of similar Nodes and Edge objects between them. The Nodes and the Layer itself has some formal definition for being grouped together.

Attributes:

ID: ID of the Layer, must be alphanumeric. root: the Passage this object is linked with attrib: attribute dictionary of the Layer extra: temporary storage space for undocumented attributes and data orderkey: the key function for ordering the Nodes in the layer.

Note that it must rely only on the Nodes and/or Edges in the Layer. If it, for example, rely on Edges added between Nodes in the Layer and Nodes outside the Layer (hence, the Edges are not in the Layer) the order will not be updated (because the Layer object won’t know that something has changed).

all: a list of all the Nodes which are part of this Layer heads: a list of all Nodes which have no incoming Edges in the subgraph

of the Layer (can have Edges from Nodes in other Layers).

Attributes Summary

ID
all
attrib
heads
orderkey
root

Methods Summary

equals(other, *[, ordered, ignore_node, …]) Returns whether two Layer objects are equal.

Attributes Documentation

ID
all
attrib
heads
orderkey
root

Methods Documentation

equals(other, *, ordered=False, ignore_node=None, ignore_edge=None)[source]

Returns whether two Layer objects are equal.

Layers are considered Layer-equal if their attribute dictionaries are equal and all their heads are recursively Node-equal. Ordered Layer-equality implies that the heads should be ordered the same for the Layers to be considered equal, and the Node-equality is ordered too.

Parameters:
  • other – the Layer object to compare to
  • ordered – whether strict-order equality is used, defaults to False
  • ignore_node – function that returns whether to ignore a given node
  • ignore_edge – function that returns whether to ignore a given edge
Returns:

True iff self and other are Layer-equal.