jaclearn.nlp.tree.ptb#

PTB-formed constituency trees.

Classes

Functions

parse_ptb(sentence)

Class PTBNode

class PTBNode[source]#

Bases: Node

__init__(vtype, token=None, index=-1)[source]#
__new__(**kwargs)#
append_child(node)#
assign_index(start_index=0)[source]#
attach(father, sibling_ind=-1)#

Attach to a new father.

clone()#
detach()#

Detach from the father.

classmethod from_string(encoding, incl_vtype=True, default_vtype=None)[source]#
insert_child(pos, node)#
remove_child(node)#
to_sentence(to_string=True)[source]#
to_string(to_string=True, compressed=True, vtype=True)[source]#
property breadth#

Breadth is defined as the maximum number of children of nodes in the tree.

property depth#

Depth is defined as the number of nodes on the maximum distance with the root of nodes + 1. (Thus a single nodes will have depth 1.)

property is_leaf#
property leftmost_index#
property lson#
property nr_children#
property nr_leaves#
property rightmost_index#
property rson#
property size#

Functions

parse_ptb(sentence)[source]#