Ejemplo n.º 1
0
def task(name):
    if name == 'offenseval':
        return of.Offenseval()
    elif name == 'vua-format':
        return vf.VuaFormat()
    else:
        raise ValueError("task name is unknown. You can add a custom task in 'tasks'")
Ejemplo n.º 2
0
def test_data_load():
    task = vf.VuaFormat()
    task.load(test_data_dir)
    train_X, train_y, test_X, test_y = utils.get_instances(
        task, split_train_dev=False)
    assert len(train_X) == 199
    assert len(test_X) == 99
Ejemplo n.º 3
0
def test_hate_speech():
    task = vf.VuaFormat()
    task.load(hate_speech_data_dir, ['testData.csv'])
    train_X, train_y, test_X, test_y = utils.get_instances(
        task, split_train_dev=True, proportion_train=0.1, proportion_dev=0.01)
    pipe = pipelines.naive_bayes()
    pipe.fit(train_X, train_y)
    sys_y = pipe.predict(test_X)
    assert len(sys_y) == len(test_y)
Ejemplo n.º 4
0
def test_trac2018():
    task = vf.VuaFormat()
    task.load(trac_data_dir, 'devData.csv')
    train_X, train_y, test_X, test_y = utils.get_instances(
        task, split_train_dev=True, proportion_train=0.1, proportion_dev=0.01)
    pipe = pipelines.naive_bayes_counts()
    pipe.fit(train_X, train_y)
    sys_y = pipe.predict(test_X)
    assert len(sys_y) == len(test_y)
Ejemplo n.º 5
0
def task(name):
    if name == 'vua_format':
        return vf.VuaFormat()
    else:
        raise ValueError(
            "task name is unknown. You can add a custom task in 'tasks'")