Apertium

Create a function to extract features from a node in a dependency tree

Each node in the dependency tree has different features, e.g. lemma, morphological features, part-of-speech etc. Write a function to extract these features from the node.

The feature specifications should be given suchly, where position is the relative position to the current node.

lemma(position)

e.g. lemma(0) = lemma of current node lemma(-1) = lemma of parent lemma(-2) = lemma of grandparent

count(position)

 count(1) = number of children
 count(2) = number of grandchildren

deprel(position)

 label(0) = label of current node
 label(1) = label of children

upos(position)

 category(0) = PoS of the current node
 category(1) = PoS of children

ufeat(position, 'attribute')

 attribute(0, 'Case') = case of the current node
 attribute(-1, 'Number') = number of the parent node

If there are more than one child, then they are combined in a vector.

Task tags

  • python
  • dependency

Students who completed this task

Kamil Bujel

Task type

  • code Code
close

2016