Edge

class ucca.core.Edge(root, parent, child, tag=None, attrib=None)[source]

Bases: object

Labeled edge between two Node objects in UCCA annotation graph.

An edge between Nodes in a Passage is a simple object; it is a directed edge whose ID is derived by the parent and child of the edge, it is mostly immutable except for its attributes, and it is labeled with the connection type between the Nodes. An edge can have multiple annotations, representing connection types of one or more layers.

Attributes:

ID: ID of the Edge, constructed from the IDs of the two Nodes root: the Passage this object is linked with attrib: attribute dictionary of the Edge extra: temporary storage space for undocumented attributes and data tag: the string label of the Edge parent: the originating Node of the Edge child: the target Node of the Edge categories: a list of categories for this edge ID_FORMAT: format string which creates the ID of the Edge from

the IDs of the parent (first argument to the formatting string) and the child (second argument).

Attributes Summary

ID
ID_FORMAT
add
attrib
categories
child
parent
root
tag
tags

Methods Summary

equals(other, *[, recursive, ordered, …]) Returns whether self and other are Edge-equals.

Attributes Documentation

ID
ID_FORMAT = '{}->{}'
add = functools.partial(<bound method ModifyPassage.__call__ of <ucca.core.ModifyPassage object>>, None)
attrib
categories
child
parent
root
tag
tags

Methods Documentation

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

Returns whether self and other are Edge-equals.

Edge-equality is determined by having the same tag and attributes. Recursive Edge-equality means that the Edges are equal, and their children are recursively Node-equal.

Parameters:
  • other – an Edge object to compare to
  • recursive – whether to compare recursively, defaults to True
  • ordered – if recursive, whether the children are Node-equivalent w.r.t order (see Node.equals())
  • 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 the Edges are equal.