nltk.ImmutableProbabilisticTree.label

ImmutableProbabilisticTree.label()

Return the node label of the tree.

>>> t = Tree.fromstring('(S (NP (D the) (N dog)) (VP (V chased) (NP (D the) (N cat))))')
>>> t.label()
'S'
Returns:the node label (typically a string)
Return type:any