Beispiel #1
0
def load_data(path,
              vocabulary=None,
              seq_length=None,
              batch_size=32,
              eval_mode=False,
              logger=None):
    dataset = convert_unary_binary_bracketed_data(path)
    return dataset
Beispiel #2
0
def load_data(path, vocabulary=None, seq_length=None, batch_size=32, eval_mode=False, logger=None):

    def keep_fn(label):
        if label == "2":
            return False
        return True

    def convert_fn(label):
        if label == "0" or label == "1":
            return "0"
        elif label == "3" or label == "4":
            return "1"
        else:
            raise ValueError("Bad Label: {}".format(label))

    dataset = convert_unary_binary_bracketed_data(path, keep_fn=keep_fn, convert_fn=convert_fn)
    return dataset, None