udapi.block.zellig_harris.enhancedeps module

class udapi.block.zellig_harris.enhancedeps.EnhanceDeps(zones='all', if_empty_tree='process', **kwargs)[source]

Bases: Block

Identify new relations between nodes in the dependency tree (an analogy of effective parents/children from PML). Add these new relations into secondary dependencies slot.

process_node(node)[source]

Enhance secondary dependencies by application of the following rules: 1. when the current node A has a deprel ‘conj’ to its parent B,

create a new secondary dependence (B.parent, B.deprel) to A

  1. when the current node A has a deprel ‘conj’ to its parent B, look at B.children C when C.deprel is in {subj, subjpass, iobj, dobj, compl} and there is no A.children D such that C.deprel == D.deprel, add a new secondary dependence (A, C.deprel) to C

Parameters:

node – A node to be process.

udapi.block.zellig_harris.enhancedeps.echildren(node)[source]

Return a list with node’s effective children.

Parameters:

node – An input node.

Returns:

A list with node’s effective children.

Return type:

list

udapi.block.zellig_harris.enhancedeps.enhance_deps(node, new_dependence)[source]

Add a new dependence to the node.deps, but firstly check if there is no such dependence already.

Parameters:
  • node – A node to be enhanced.

  • new_dependence – A new dependence to be add into node.deps.

udapi.block.zellig_harris.enhancedeps.eparent(node)[source]

Return an effective parent for the given node.

The rule for the effective parent - when the current node A has a deprel ‘conj’ to its parent B, return B.parent, otherwise return A.parent.

Parameters:

node – An input node.

Returns:

An effective parent.

Return type:

udapi.core.node.Node