Search in sources :

Example 11 with Atomic

use of nars.term.atom.Atomic in project narchy by automenta.

the class EllipsisTest method testEllipsisInMinArity.

@Test
public void testEllipsisInMinArity() {
    Atomic a = Atomic.the("a");
    Ellipsis b = new EllipsisOneOrMore($.varPattern(1));
    for (Op o : Op.values()) {
        if (o.minSize <= 1)
            continue;
        if (o.statement)
            continue;
        if (o != DIFFe && o != DIFFi) {
            assertEquals(a, o.the(DTERNAL, a), o + " with normal term");
        } else {
            assertEquals(Null, o.the(DTERNAL, a));
        }
        assertEquals(o.statement ? VAR_PATTERN : o, o.the(DTERNAL, b).op(), o + " with ellipsis not reduced");
    }
}
Also used : Op(nars.Op) Ellipsis(nars.derive.match.Ellipsis) Ellipsis.firstEllipsis(nars.derive.match.Ellipsis.firstEllipsis) EllipsisOneOrMore(nars.derive.match.EllipsisOneOrMore) Atomic(nars.term.atom.Atomic) Test(org.junit.jupiter.api.Test)

Example 12 with Atomic

use of nars.term.atom.Atomic in project narchy by automenta.

the class JsonTermTest method testBigJSON.

@Test
public void testBigJSON() {
    NAR d = new NARS().get();
    // d.log();
    int n = 0;
    for (String json : new String[] { "{\"coord\":{\"lon\":-0.13,\"lat\":51.51},\"weather\":[{\"id\":300,\"main\":\"Drizzle\",\"description\":\"light intensity drizzle\",\"icon\":\"09d\"}],\"base\":\"stations\",\"main\":{\"temp\":280.32,\"pressure\":1012,\"humidity\":81,\"temp_min\":279.15,\"temp_max\":281.15},\"visibility\":10000,\"wind\":{\"speed\":4.1,\"deg\":80},\"clouds\":{\"all\":90},\"dt\":1485789600,\"sys\":{\"type\":1,\"id\":5091,\"message\":0.0103,\"country\":\"GB\",\"sunrise\":1485762037,\"sunset\":1485794875},\"id\":2643743,\"name\":\"London\",\"cod\":200}", "{\"coord\":{\"lon\":139.01,\"lat\":35.02},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01n\"}],\"base\":\"stations\",\"main\":{\"temp\":285.514,\"pressure\":1013.75,\"humidity\":100,\"temp_min\":285.514,\"temp_max\":285.514,\"sea_level\":1023.22,\"grnd_level\":1013.75},\"wind\":{\"speed\":5.52,\"deg\":311},\"clouds\":{\"all\":0},\"dt\":1485792967,\"sys\":{\"message\":0.0025,\"country\":\"JP\",\"sunrise\":1485726240,\"sunset\":1485763863},\"id\":1907296,\"name\":\"Tawarano\",\"cod\":200}" }) {
        Atomic id = Atomic.the("WEATHER_" + (n++));
        d.believe($.inh(JsonTerm.the(json), id), Tense.Eternal);
        d.believe($.inst(id, Atomic.the("now")), Tense.Present);
    }
    d.run(256);
}
Also used : NARS(nars.NARS) Atomic(nars.term.atom.Atomic) NAR(nars.NAR) Test(org.junit.jupiter.api.Test)

Aggregations

Atomic (nars.term.atom.Atomic)12 Test (org.junit.jupiter.api.Test)7 Op (nars.Op)3 Term (nars.term.Term)3 Compound (nars.term.Compound)2 alice.tuprolog (alice.tuprolog)1 Field (java.lang.reflect.Field)1 DynBytes (jcog.data.byt.DynBytes)1 NAR (nars.NAR)1 NARS (nars.NARS)1 INT (nars.Op.INT)1 Ellipsis (nars.derive.match.Ellipsis)1 Ellipsis.firstEllipsis (nars.derive.match.Ellipsis.firstEllipsis)1 EllipsisOneOrMore (nars.derive.match.EllipsisOneOrMore)1 MaplikeConceptIndex (nars.index.term.map.MaplikeConceptIndex)1 Atom (nars.term.atom.Atom)1 NormalizedVariable (nars.term.var.NormalizedVariable)1 NotNull (org.jetbrains.annotations.NotNull)1