Ejemplo n.º 1
0
data = ["opencog/atomspace/core_types.scm",
        "opencog/scm/utilities.scm",
        "opencog/python/pln/examples/tuffy/smokes/smokes.scm"]

if EXTRA_DATA:
    data.append("opencog/python/pln/examples/tuffy/smokes/extra-data.scm")

for item in data:
    load_scm(atomspace, item)

atoms = atomspace.get_atoms_by_type(types.Atom)
for atom in atoms:
    print(atom)
MAX_STEPS = 500

chainer = InferenceAgent()
chainer.create_chainer(atomspace=atomspace, stimulate_atoms=False)

answer = False
outputs_produced = 0

for i in range(0, MAX_STEPS):
    result = chainer.run(atomspace)

    output = None
    input = None
    rule = None
    if result is not None:
        (rule, input, output) = result
        outputs_produced += 1
Ejemplo n.º 2
0
"""
For testing smokes_agent.py without the cogserver
"""

from __future__ import print_function
from opencog.atomspace import AtomSpace, TruthValue, types
from data import *
from pln.examples.tuffy.smokes.smokes_agent import InferenceAgent

__author__ = 'Cosmo Harrigan'
atoms = atomspace.get_atoms_by_type(types.Atom)
for atom in atoms:
    print(atom)
MAX_STEPS = 500

chainer = InferenceAgent()
chainer.create_chainer(atomspace=atomspace)


def check_result():
    # Searches for EvaluationLinks where the first argument is: PredicateNode
    # "cancer" and the target of the predicate is a ConceptNode (representing a
    # person)
    eval_links = atomspace.get_atoms_by_type(types.EvaluationLink)

    num_results = 0
    for eval_link in eval_links:
        out = [atom for atom in atomspace.get_outgoing(eval_link.h)
               if atom.is_a(types.PredicateNode) and atom.name == "cancer"]
        if out:
            list_link = atomspace.get_outgoing(eval_link.h)[1]
data = ["opencog/scm/core_types.scm",
        "opencog/scm/utilities.scm",
        "opencog/python/pln_old/examples/tuffy/smokes/smokes.scm"]

if EXTRA_DATA:
    data.append("opencog/python/pln_old/examples/tuffy/smokes/extra-data.scm")

for item in data:
    load_scm(atomspace, item)

atoms = atomspace.get_atoms_by_type(types.Atom)
for atom in atoms:
    print(atom)
MAX_STEPS = 500

chainer = InferenceAgent()
chainer.create_chainer(atomspace=atomspace, stimulate_atoms=False)

answer = False
outputs_produced = 0

for i in range(MAX_STEPS):
    result = chainer.run(atomspace)

    output = None
    input = None
    rule = None
    if result is not None:
        (rule, input, output) = result
        outputs_produced += 1
Ejemplo n.º 4
0
data = ["opencog/atomspace/core_types.scm",
        "opencog/scm/utilities.scm",
        "opencog/python/pln/examples/tuffy/smokes/smokes.scm"]

if EXTRA_DATA:
    data.append("opencog/python/pln/examples/tuffy/smokes/extra-data.scm")

for item in data:
    load_scm(atomspace, item)

atoms = atomspace.get_atoms_by_type(types.Atom)
for atom in atoms:
    print(atom)
MAX_STEPS = 500

chainer = InferenceAgent()
chainer.create_chainer(atomspace=atomspace)


def check_result():
    # Searches for EvaluationLinks where the first argument is: PredicateNode
    # "cancer" and the target of the predicate is a ConceptNode (representing a
    # person)
    eval_links = atomspace.get_atoms_by_type(types.EvaluationLink)

    num_results = 0
    for eval_link in eval_links:
        out = [atom for atom in atomspace.get_outgoing(eval_link.h)
               if atom.is_a(types.PredicateNode) and atom.name == "cancer"]
        if out:
            list_link = atomspace.get_outgoing(eval_link.h)[1]