Exemple #1
0
import os, sys
sys.path.append(os.path.abspath("../"))
from d4d import d4d

d4d.normalize("d1",
              """cats desire food
                 dogs desire food
                 cats desire fish
              """,
              principal_component_count=1)

d4d.d1.how_true_is("dogs desire fish")

d4d.normalize("d1",
              """cats desire food
                 dogs desire food
                 cats desire outdoors
                 dogs desire outdoors
                 cats desire human
                 dogs desire human
                 cats desire warmth
                 dogs desire warmth
                 cats desire fish              
              """,
              principal_component_count=3)

d4d.d1.how_true_is("dogs desires fish")
Exemple #2
0
import os, sys
sys.path.append(os.path.abspath("../"))
from d4d import d4d


d4d.normalize("books",
"""
knowledge PartOf book
page PartOf book
book UsedFor reading

knowledge PartOf magazine
page PartOf magazine
magazine UsedFor reading

ice HasProperty cold
page PartOf newspaper
newspaper UsedFor reading
""", principal_component_count=None) #value of 100 causes below how_true_is to return close to zero.
                                  #value of 3 yields below how_true_is result of 0.48
                                  
#same thing but closer to English:
d4d.normalize("books", """
Knowledge is part of books. 
A Page is part of a book.
Books are used for reading.

Knowledge is part of a magazine.
A page is part of a magazine.
Magazines are used for reading.
Exemple #3
0
import os, sys
sys.path.append(os.path.abspath("../"))
from d4d import d4d

d4d.normalize("d1", 
              """cats desire food
                 dogs desire food
                 cats desire fish
              """,
              principal_component_count=1)

d4d.d1.how_true_is("dogs desire fish")

d4d.normalize("d1", 
              """cats desire food
                 dogs desire food
                 cats desire outdoors
                 dogs desire outdoors
                 cats desire human
                 dogs desire human
                 cats desire warmth
                 dogs desire warmth
                 cats desire fish              
              """,
    principal_component_count=3)

d4d.d1.how_true_is("dogs desires fish")