def read_testing_data(file_path, label): test = [] with open(file_path) as f: for line in f: elements = line.strip().split('\t') feature = fe.get_feature(elements[4]) test.append((feature, label)) return test
def read_training_data(file_path, question_type): train = [] with open(file_path) as f: for line in f: elements = line.strip().split('\t') feature = fe.get_feature(elements[4]) if question_type: train.append((feature, elements[1])) else: train.append((feature, elements[2])) return train