コード例 #1
0
a.set_av(metal.h, 1)
a.set_av(move.h, 2)

a.set_av(vehicle.h, 13)
a.set_av(person.h, 12)

"""
Make test links.
"""
# A. Not duplicated link.
# TODO: We should use an InheritanceLink rather than a MemberLink
# to express something in the some class. A case in below is just example
# to show how to blending algorithm works.
l1 = MemberLink(car, metal)
a.set_tv(l1.h, TruthValue(0.6, 0.8))

# B. Duplicated, not conflicted link.
# TODO: We should use an InheritanceLink rather than a SimilarityLink
# to express something has some property.
l2 = SimilarityLink(car, move)
l3 = SimilarityLink(man, move)
a.set_tv(l2.h, TruthValue(0.9, 0.8))
a.set_tv(l3.h, TruthValue(0.7, 0.9))

# C.1 Duplicated, conflicted link.
l4 = SimilarityLink(car, vehicle)
l5 = SimilarityLink(man, vehicle)
a.set_tv(l4.h, TruthValue(0.9, 0.8))
a.set_tv(l5.h, TruthValue(0.1, 0.9))
コード例 #2
0
ファイル: convert.py プロジェクト: AdolphLua/opencog
                        concept_nodes.append(atomspace.add_node(
                            types.ConceptNode, concept))

                    # ListLink
                    list_link = atomspace.add_link(
                        types.ListLink, concept_nodes, crisp_true)

                    # EvaluationLink
                    eval_link = atomspace.add_link(
                        types.EvaluationLink, [predicate_node, list_link])
                    new_link = eval_link

                    # Determine whether the predicate is negated, and create
                    # a NotLink if necessary.
                    if negated:
                        # NotLink
                        not_link = atomspace.add_link(types.NotLink, [eval_link])

                        # TruthValue
                        atomspace.set_tv(not_link.h, crisp_true)

                        new_link = not_link
                    else:
                        # TruthValue
                        atomspace.set_tv(eval_link.h, crisp_true)

                    output.write(new_link.__str__())

except (OSError, IOError), e:
    print('Exception: {0}'.format(e))
a.set_av(man.h, 18)

a.set_av(metal.h, 1)
a.set_av(move.h, 2)

a.set_av(vehicle.h, 13)
a.set_av(person.h, 12)
"""
Make test links.
"""
# A. Not duplicated link.
# TODO: We should use an InheritanceLink rather than a MemberLink
# to express something in the some class. A case in below is just example
# to show how to blending algorithm works.
l1 = MemberLink(car, metal)
a.set_tv(l1.h, TruthValue(0.6, 0.8))

# B. Duplicated, not conflicted link.
# TODO: We should use an InheritanceLink rather than a SimilarityLink
# to express something has some property.
l2 = SimilarityLink(car, move)
l3 = SimilarityLink(man, move)
a.set_tv(l2.h, TruthValue(0.9, 0.8))
a.set_tv(l3.h, TruthValue(0.7, 0.9))

# C.1 Duplicated, conflicted link.
l4 = SimilarityLink(car, vehicle)
l5 = SimilarityLink(man, vehicle)
a.set_tv(l4.h, TruthValue(0.9, 0.8))
a.set_tv(l5.h, TruthValue(0.1, 0.9))
コード例 #4
0
ファイル: convert.py プロジェクト: Rieeda/opencog-test-cb
                            atomspace.add_node(types.ConceptNode, concept))

                    # ListLink
                    list_link = atomspace.add_link(types.ListLink,
                                                   concept_nodes, crisp_true)

                    # EvaluationLink
                    eval_link = atomspace.add_link(types.EvaluationLink,
                                                   [predicate_node, list_link])
                    new_link = eval_link

                    # Determine whether the predicate is negated, and create
                    # a NotLink if necessary.
                    if negated:
                        # NotLink
                        not_link = atomspace.add_link(types.NotLink,
                                                      [eval_link])

                        # TruthValue
                        atomspace.set_tv(not_link.h, crisp_true)

                        new_link = not_link
                    else:
                        # TruthValue
                        atomspace.set_tv(eval_link.h, crisp_true)

                    output.write(new_link.__str__())

except (OSError, IOError), e:
    print('Exception: {0}'.format(e))