Package edu.washington.cs.knowitall.extractor.conf

Source Code of edu.washington.cs.knowitall.extractor.conf.WekaClassifierConfFunctionTest

package edu.washington.cs.knowitall.extractor.conf;

import static org.junit.Assert.assertTrue;
import opennlp.maxent.GIS;
import opennlp.maxent.GISModel;
import opennlp.model.ListEventStream;

import org.junit.Test;

import edu.washington.cs.knowitall.extractor.conf.featureset.BooleanFeatureSet;
import edu.washington.cs.knowitall.extractor.conf.opennlp.OpenNlpConfFunction;

public class WekaClassifierConfFunctionTest {

    @Test
    public void testGetConf() throws Exception {
        BooleanFeatureSet<String> features = StringFeatures.featureSet;
        GISModel model = GIS.trainModel(
                new ListEventStream(StringFeatures.dataSet.getInstances()), 100, 0);
        OpenNlpConfFunction<String> conf = new OpenNlpConfFunction<String>(model, features);
        double janeConf = conf.getConf("jane");
        double ofConf = conf.getConf("of");
        System.out.println(ofConf);
        System.out.println(janeConf);
        assertTrue(ofConf < janeConf);
        assertTrue(ofConf < 1.0);
        assertTrue(0.0 < janeConf);
    }
}
TOP

Related Classes of edu.washington.cs.knowitall.extractor.conf.WekaClassifierConfFunctionTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.