'Extract dependency triples of the form:
((head word, head tag), rel, (dep word, dep tag))'

def triples(self, node=None):

    if (not node):
        node = self.root
    head = (node[u'word'], node[u'ctag'])
    for i in sorted(chain.from_iterable(node[u'deps'].values())):
        dep = self.get_by_address(i)
        (yield (head, dep[u'rel'], (dep[u'word'], dep[u'ctag'])))
        for triple in self.triples(node=dep):
            (yield triple)
