use of nars.concept.Concept in project narchy by automenta.
the class LinkageTest method ProperlyLinkedTest.
void ProperlyLinkedTest(@NotNull String premise1, @NotNull String premise2) throws Exception {
test.requireConditions = false;
TestNAR tester = test;
// .en("If robin is a type of bird then robin can fly.");
tester.believe(premise1);
// .en("Robin is a type of bird.");
tester.believe(premise2);
tester.run(runCycles, false);
Concept ret = tester.nar.conceptualize(premise1);
assertTrue(isPassed2(premise2, ret), ret + " termlinks contains " + premise2);
Concept ret2 = tester.nar.conceptualize(premise2);
assertTrue(isPassed2(premise1, ret2), ret2 + " termlinks contains " + premise1);
}
use of nars.concept.Concept in project narchy by automenta.
the class LinkageTest method testConceptFormed.
public void testConceptFormed(@NotNull String s) throws Exception {
test.requireConditions = false;
TestNAR tester = test;
tester.believe(s, 1.0f, 0.9f);
tester.nar.run(10);
Concept ret = tester.nar.conceptualize(s);
assertNotNull(ret, "Failed to create a concept for " + s);
}
use of nars.concept.Concept in project narchy by automenta.
the class LinkageTest method links.
public boolean links(@NotNull String premise1, String premise2, @NotNull TestNAR tester) throws Narsese.NarseseException {
Concept ret = tester.nar.conceptualize(premise1);
boolean passed = false;
if (ret != null) {
for (PriReference<Term> entry : ret.termlinks()) {
Term et1 = entry.get().term();
if (et1.toString().equals(premise2)) {
passed = true;
break;
}
if (!(et1 instanceof Variable)) {
Concept Wc = tester.nar.concept(et1);
if (Wc != null) {
for (PriReference<Term> entry2 : Wc.termlinks()) {
Term et2 = entry2.get().term();
if (et2.toString().equals(premise2)) {
passed = true;
break;
}
Concept Wc2 = tester.nar.concept(et2);
if (Wc2 != null) {
for (PriReference<Term> entry3 : Wc2.termlinks()) {
Term et3 = entry3.get().term();
if (et3.toString().equals(premise2)) {
passed = true;
break;
}
}
}
}
}
}
/*if (w.toString().equals(premise2)) {
passed = true;
}*/
}
}
return passed;
}
use of nars.concept.Concept in project narchy by automenta.
the class OperatorTest method testThe.
/**
* tests Builtin.System and evaluating a term input as a command
*/
@Test
public void testThe() throws Narsese.NarseseException {
NAR n = NARS.tmp();
@Nullable Concept statusFunctor = n.concept($.the("the"));
statusFunctor.print();
StringBuilder b = new StringBuilder();
n.log(b);
n.input("the(sys)");
String s = b.toString();
assertTrue(s.contains("→("), () -> s);
}
use of nars.concept.Concept in project narchy by automenta.
the class DynamicTruthBeliefTableTest method testDynamicConjConceptWithNegations.
@Test
public void testDynamicConjConceptWithNegations() throws Narsese.NarseseException {
NAR n = NARS.tmp();
for (String s : new String[] { "((y-->t) &&+1 (t-->happy))", "(--(y-->t) &&+1 (t-->happy))", "((y-->t) &&+1 --(t-->happy))", "(--(y-->t) &&+1 --(t-->happy))" }) {
Concept c = n.conceptualize($.$(s));
assertTrue(c.beliefs() instanceof DynamicTruthBeliefTable);
assertTrue(c.goals() instanceof DynamicTruthBeliefTable);
}
}
Aggregations