discodop.heads

Functions related to finding the linguistic head of a constituent.

Functions

applyheadrules(tree, headrules[, modifierrules]) Apply head rules and set head attribute of nodes.
getheadpos(node) Get head word dominated by this node.
headfinder(tree, headrules[, headlabels]) Use head finding rules to select one child of tree node as head.
headstats(trees) Collect some information useful for writing headrules.
markmodifiers(tree, modifierrules) Use heuristics to distinguish complements from modifiers.
readheadrules(filename) Read a file containing heuristic rules for head assignment.
readmodifierrules(filename) Read a file containing heuristic rules for marking modifiers.
saveheads(tree, tailmarker) Infer head from binarization and store.
discodop.heads.applyheadrules(tree, headrules, modifierrules=None)[source]

Apply head rules and set head attribute of nodes.

discodop.heads.getheadpos(node)[source]

Get head word dominated by this node.

discodop.heads.readheadrules(filename)[source]

Read a file containing heuristic rules for head assignment.

Example line: s right-to-left vmfin vafin vaimp, which means traverse siblings of an S constituent from right to left, the first child with a label of vmfin, vafin, or vaimp will be marked as head.

discodop.heads.headfinder(tree, headrules, headlabels=frozenset({'HD'}))[source]

Use head finding rules to select one child of tree node as head.

discodop.heads.saveheads(tree, tailmarker)[source]

Infer head from binarization and store.

discodop.heads.headstats(trees)[source]

Collect some information useful for writing headrules.

  • heads['NP']['NN'] == number of times NN occurs as head of NP.
  • pos1['NP'][1] == number of times head of NP is at position 1.
  • pos2 is like pos1, but position is from the right.
  • unknown['NP']['NN'] == number of times NP that does not have a head
    dominates an NN.