Exemplo n.º 1
0
def repl(env):
    print('Lion Programming')
    line = ''
    results = None
    while True:
        line = input('*** ')
        if len(line) != 0:
            if line[-1] != ';':
                line += ';'
            results = eval_list(parse(lex(line)), env)
        if results is not None:
            print(token_str(results))
Exemplo n.º 2
0
    os.environ['PYTHONHASHSEED'] = '0'
    np.random.seed(17)
    rn.seed(12345)


if __name__ == "__main__":
    set_reproductible()
    datadir = "../data/"
    trainfile = datadir + "traindata.csv"
    devfile = datadir + "devdata.csv"
    testfile = None
    # Basic checking
    start_time = time.perf_counter()
    classifier = Classifier()
    print("\n")
    # Training
    print("1. Training the classifier...\n")
    classifier.train(trainfile)
    # Evaluation on the dev dataset
    print("\n2. Evaluation on the dev dataset...\n")
    slabels = classifier.predict(devfile)
    glabels = load_label_output(devfile)
    eval_list(glabels, slabels)
    if testfile is not None:
        # Evaluation on the test data
        print("\n3. Evaluation on the test dataset...\n")
        slabels = classifier.predict(testfile)
        glabels = load_label_output(testfile)
        eval_list(glabels, slabels)
    print("\nExec time: %.2f s." % (time.perf_counter() - start_time))
Exemplo n.º 3
0
def add_native(expr, env):
	return eval_list(parse(lex(expr)), env)
Exemplo n.º 4
0
def run(filename, env):
    eval_list(parse(lex(get_chars(filename))), env)
Exemplo n.º 5
0
def std_eval(string, env):
	if string[0] != 'string':
		return none;
	return eval_list(parse(lex(string[1])), env)