discodop.heads¶
Functions related to finding the linguistic head of a constituent.
Functions
applyheadrules(tree, headrules) |
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. |
readheadrules(filename) |
Read a file containing heuristic rules for head assignment. |
saveheads(tree, tailmarker) |
Store head as grammatical function when inferrable from binarization. |
sethead(child) |
Mark node as head in an auxiliary field. |
-
discodop.heads.applyheadrules(tree, headrules)[source]¶ Apply head rules and set head attribute of nodes.
-
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]¶ Store head as grammatical function when inferrable from binarization.
-
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.pos2is like pos1, but position is from the right.unknown['NP']['NN'] ==number of times NP that does not have a head- dominates an NN.