Search in sources :

Example 1 with Configuration

use of edu.cmu.ml.proppr.util.Configuration in project ProPPR by TeamCohen.

the class SplitFactsPluginTest method test.

@Test
public void test() throws LogicProgramException {
    int input = 0;
    int output = 0;
    int constants = Configuration.USE_WAM;
    int modules = 0;
    Configuration c = new Configuration(("--programFiles " + GrounderTest.RULES + ":" + GrounderTest.FACTS + ":" + ADDLFACTS).split(" "), input, output, constants, modules);
    assertEquals("# of plugins", c.plugins.length, 1);
    assertEquals("# of members", ((SplitFactsPlugin) c.plugins[0]).plugins.size(), 2);
    assertTrue("claim", c.plugins[0]._claim("validClass/1"));
    Query q = Query.parse("validClass(X)");
    WamInterpreter interp = new WamInterpreter(c.program, c.plugins);
    int queryStartAddr = c.program.size();
    q.variabilize();
    c.program.append(q);
    interp.executeWithoutBranching(queryStartAddr);
    List<Outlink> outs = c.plugins[0].outlinks(interp.saveState(), interp, true);
    assertEquals("# outlinks", 6, outs.size());
}
Also used : Outlink(edu.cmu.ml.proppr.prove.wam.Outlink) Configuration(edu.cmu.ml.proppr.util.Configuration) Query(edu.cmu.ml.proppr.prove.wam.Query) WamInterpreter(edu.cmu.ml.proppr.prove.wam.WamInterpreter) Test(org.junit.Test) GrounderTest(edu.cmu.ml.proppr.GrounderTest)

Example 2 with Configuration

use of edu.cmu.ml.proppr.util.Configuration in project ProPPR by TeamCohen.

the class FixedWeightRulesTest method testCascade.

@Test
public void testCascade() {
    Configuration c = new Configuration("--fixedWeights f(*=n:*=y".split(" "), 0, 0, Configuration.USE_FIXEDWEIGHTS, 0);
    assertTrue("Most rules", c.fixedWeightRules.isFixed("id(x,12,15)"));
    assertFalse("f(* rules", c.fixedWeightRules.isFixed("f(x,12,15)"));
}
Also used : Configuration(edu.cmu.ml.proppr.util.Configuration) ModuleConfiguration(edu.cmu.ml.proppr.util.ModuleConfiguration) Test(org.junit.Test)

Example 3 with Configuration

use of edu.cmu.ml.proppr.util.Configuration in project ProPPR by TeamCohen.

the class FixedWeightRulesTest method test.

@Test
public void test() {
    Configuration c = new Configuration("--fixedWeights f(thing,pos)".split(" "), 0, 0, Configuration.USE_FIXEDWEIGHTS, 0);
    assertTrue("Raw fixedWeightRules", c.fixedWeightRules.isFixed("f(thing,pos)"));
}
Also used : Configuration(edu.cmu.ml.proppr.util.Configuration) ModuleConfiguration(edu.cmu.ml.proppr.util.ModuleConfiguration) Test(org.junit.Test)

Aggregations

Configuration (edu.cmu.ml.proppr.util.Configuration)3 Test (org.junit.Test)3 ModuleConfiguration (edu.cmu.ml.proppr.util.ModuleConfiguration)2 GrounderTest (edu.cmu.ml.proppr.GrounderTest)1 Outlink (edu.cmu.ml.proppr.prove.wam.Outlink)1 Query (edu.cmu.ml.proppr.prove.wam.Query)1 WamInterpreter (edu.cmu.ml.proppr.prove.wam.WamInterpreter)1