replace EDU indices with the text of the EDUs
    in a parented tree.

    Parameters
    ----------
    parented_tree : nltk.ParentedTree
        a parented tree that only contains EDU indices
        as leaves
    edus : list(list(unicode))
        a list of EDUs, where each EDU is represented as
        a list of tokens

def _add_edus_to_tree(parented_tree, edus):
    """replace EDU indices with the text of the EDUs
    in a parented tree.

    Parameters
    ----------
    parented_tree : nltk.ParentedTree
        a parented tree that only contains EDU indices
        as leaves
    edus : list(list(unicode))
        a list of EDUs, where each EDU is represented as
        a list of tokens
    """
    for i, child in enumerate(parented_tree):
        if isinstance(child, nltk.Tree):
            _add_edus_to_tree(child, edus)
        else:
            edu_index = int(child)
            edu_tokens = edus[edu_index]
            parented_tree[i] = u" ".join(edu_tokens)