use of nars.concept.Concept in project narchy by automenta.
the class DynamicTruthBeliefTableTest method testDynamicIntRange.
@Test
public void testDynamicIntRange() throws Narsese.NarseseException {
NAR n = NARS.tmp();
n.believe("x:1", 1f, 0.9f);
n.believe("x:2", 0.5f, 0.9f);
n.believe("x:3", 0f, 0.9f);
n.run(1);
Concept x12 = n.conceptualize($.inh(Int.range(1, 2), $.the("x")));
Concept x23 = n.conceptualize($.inh(Int.range(2, 3), $.the("x")));
Concept x123 = n.conceptualize($.inh(Int.range(1, 3), $.the("x")));
assertEquals("%.50;.81%", n.beliefTruth(x12, ETERNAL).toString());
assertEquals("%0.0;.90%", n.beliefTruth(x23, ETERNAL).toString());
assertEquals("%0.0;.90%", n.beliefTruth(x123, ETERNAL).toString());
}
use of nars.concept.Concept in project narchy by automenta.
the class NARTest method testConceptInstancing.
//
// @Test public void testFork() throws Exception {
// NAR a = new Default();
// a.input("b:a.");
// a.input("c:b.");
// a.frame(8);
//
// NAR b = a.fork();
//
// assertEquals(a, b);
//
//
// }
@Test
public void testConceptInstancing() throws Narsese.NarseseException {
NAR n = NARS.tmp();
String statement1 = "<a --> b>.";
Termed a = $.$("a");
assertNotNull(a);
Termed a1 = $.$("a");
assertEquals(a, a1);
n.input(statement1);
n.run(4);
n.input(" <a --> b>. ");
n.run(1);
n.input(" <a--> b>. ");
n.run(1);
String statement2 = "<a --> c>.";
n.input(statement2);
n.run(4);
Termed a2 = $.$("a");
assertNotNull(a2);
Concept ca = n.conceptualize(a2);
assertNotNull(ca);
}
use of nars.concept.Concept in project narchy by automenta.
the class TemporalTermTest method testAtemporalizationSharesNonTemporalSubterms.
@Test
public void testAtemporalizationSharesNonTemporalSubterms() throws Narsese.NarseseException {
Task a = n.inputTask("((x) ==>+10 (y)).");
Task c = n.inputTask("((x) ==>+9 (y)).");
Task b = n.inputTask("((x) <-> (y)).");
n.run();
@NotNull Term aa = a.term();
assertNotNull(aa);
@Nullable Concept na = a.concept(n, true);
assertNotNull(na);
@Nullable Concept nc = c.concept(n, true);
assertNotNull(nc);
assertSame(na, nc);
assertSame(na.sub(0), nc.sub(0));
// System.out.println(b.concept(n));
// System.out.println(c.concept(n));
assertEquals(b.concept(n, true).sub(0), c.concept(n, true).sub(0));
}
use of nars.concept.Concept in project narchy by automenta.
the class TuffySmokesTest method print.
static void print() throws Narsese.NarseseException {
for (String name : new String[] { "Edward", "Anna", "Bob", "Frank", "Gary", "Helen" }) {
String t = "<" + name + " --> Cancer>";
// n.input(t + "?");
Concept c = n.conceptualize(t);
System.err.print(System.identityHashCode(c) + " ");
if (c == null) {
System.err.println(t + " unknown" + " ");
} else {
// if (!c.hasBeliefs()) {
// System.err.println(t + " no beliefs");
//
//
// //n.input(t + ". %0.5;0.1%");
//
// } else {
// Task b = c.beliefs().top(ETERNAL);
// System.err.println(t + " = " + b);
// //System.err.println(b.getExplanation());
// continue;
// }
}
// n.input(t + "?");
}
}
use of nars.concept.Concept in project narchy by automenta.
the class TermIcon method update.
public void update(Concept c, long time) {
this._concept = c;
Concept cc = this._concept;
if (cc == null)
return;
// float b = 2f * (_concept.beliefFreq(time, 0.5f) - 0.5f);
// bgColor[0] = b >= 0 ? b : 0;
// bgColor[1] = b < 0 ? -b : 0;
// bgColor[2] = 0;
// bgColor[3] = 0.9f;
}
Aggregations