nltk.ccg.CCGLeafEdge

class nltk.ccg.CCGLeafEdge[source]

Bases: EdgeI

Class representing leaf edges in a CCG derivation.

__init__(pos, token, leaf)[source]
lhs()[source]

Return this edge’s left-hand side, which specifies what kind of structure is hypothesized by this edge.

See

TreeEdge and LeafEdge for a description of the left-hand side values for each edge type.

span()[source]

Return a tuple (s, e), where tokens[s:e] is the portion of the sentence that is consistent with this edge’s structure.

Return type

tuple(int, int)

start()[source]

Return the start index of this edge’s span.

Return type

int

end()[source]

Return the end index of this edge’s span.

Return type

int

length()[source]

Return the length of this edge’s span.

Return type

int

rhs()[source]

Return this edge’s right-hand side, which specifies the content of the structure hypothesized by this edge.

See

TreeEdge and LeafEdge for a description of the right-hand side values for each edge type.

dot()[source]

Return this edge’s dot position, which indicates how much of the hypothesized structure is consistent with the sentence. In particular, self.rhs[:dot] is consistent with tokens[self.start():self.end()].

Return type

int

is_complete()[source]

Return True if this edge’s structure is fully consistent with the text.

Return type

bool

is_incomplete()[source]

Return True if this edge’s structure is partially consistent with the text.

Return type

bool

nextsym()[source]

Return the element of this edge’s right-hand side that immediately follows its dot.

Return type

Nonterminal or terminal or None

token()[source]
categ()[source]
leaf()[source]