def import_tree_corpus(labels_path, parents_path, texts_path):
    """
    Import dataset from the TreeLSTM data generation scrips.

    Arguments:
    ----------
        labels_path : str, where are labels are stored (should be in
            data/sst/labels.txt).
        parents_path : str, where the parent relationships are stored
            (should be in data/sst/parents.txt).
        texts_path : str, where are strings for each tree are stored
            (should be in data/sst/sents.txt).

    Returns:
    --------
        list<LabeledTree> : loaded example trees.
    """
    with codecs.open(labels_path, "r", "UTF-8") as f:
        label_lines = f.readlines()
    with codecs.open(parents_path, "r", "UTF-8") as f:
        parent_lines = f.readlines()
    with codecs.open(texts_path, "r", "UTF-8") as f:
        word_lines = f.readlines()
    assert len(label_lines) == len(parent_lines)
    assert len(label_lines) == len(word_lines)

    trees = []

    for labels, parents, words in zip(label_lines, parent_lines, word_lines):
        labels  = [int(l) + 2 for l in labels.strip().split(" ")]
        parents = [int(l) for l in parents.strip().split(" ")]
        words   = words.strip().split(" ")
        assert len(labels) == len(parents)
        trees.append(read_tree(parents, labels, words))
    return trees
Import dataset from the TreeLSTM data generation scrips.

    Arguments:
    ----------
        labels_path : str, where are labels are stored (should be in
            data/sst/labels.txt).
        parents_path : str, where the parent relationships are stored
            (should be in data/sst/parents.txt).
        texts_path : str, where are strings for each tree are stored
            (should be in data/sst/sents.txt).

    Returns:
    --------
        list<LabeledTree> : loaded example trees.