'Generate the productions that correspond to the non-terminal nodes of the tree.
For each subtree of the form (P: C1 C2 ... Cn) this produces a production of the
form P -> C1 C2 ... Cn.
>>> t = Tree.fromstring("(S (NP (D the) (N dog)) (VP (V chased) (NP (D the) (N cat))))")
>>> t.productions()
[S -> NP VP, NP -> D N, D -> \'the\', N -> \'dog\', VP -> V NP, V -> \'chased\',
NP -> D N, D -> \'the\', N -> \'cat\']
:rtype: list(Production)'

def productions(self):

    if (not isinstance(self._label, string_types)):
        raise TypeError(u'Productions    can    only    be    generated    from    trees    having    node    labels    that    are    strings')
    prods = [Production(Nonterminal(self._label), _child_names(self))]
    for child in self:
        if isinstance(child, Tree):
            prods += child.productions()
    return prods
