Search in sources :

Example 11 with Concept

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());
}
Also used : TaskConcept(nars.concept.TaskConcept) Concept(nars.concept.Concept) Test(org.junit.jupiter.api.Test)

Example 12 with Concept

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);
}
Also used : Termed(nars.term.Termed) Concept(nars.concept.Concept) NAR(nars.NAR) Test(org.junit.jupiter.api.Test)

Example 13 with Concept

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));
}
Also used : TaskConcept(nars.concept.TaskConcept) Concept(nars.concept.Concept) NotNull(org.jetbrains.annotations.NotNull) Nullable(org.jetbrains.annotations.Nullable) Test(org.junit.jupiter.api.Test)

Example 14 with Concept

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 + "?");
    }
}
Also used : Concept(nars.concept.Concept)

Example 15 with Concept

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;
}
Also used : Concept(nars.concept.Concept)

Aggregations

Concept (nars.concept.Concept)47 TaskConcept (nars.concept.TaskConcept)19 Term (nars.term.Term)19 Test (org.junit.jupiter.api.Test)15 Nullable (org.jetbrains.annotations.Nullable)11 Truth (nars.truth.Truth)9 NAR (nars.NAR)6 Termed (nars.term.Termed)6 FasterList (jcog.list.FasterList)4 PermanentConcept (nars.concept.PermanentConcept)4 BeliefTable (nars.table.BeliefTable)4 TestNAR (nars.test.TestNAR)4 Util (jcog.Util)3 PriReference (jcog.pri.PriReference)3 GL2 (com.jogamp.opengl.GL2)2 java.io (java.io)2 java.util (java.util)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 Op (nars.Op)2 CauseLink (nars.link.CauseLink)2