63 lines
2.5 KiB
Hy
63 lines
2.5 KiB
Hy
(import [..knowledge_base [KnowledgeBase]])
|
|
|
|
(setv knowledge-base
|
|
{
|
|
"icecream" { "groups" (set ["noun" "object" "comestible" "sweet"]) }
|
|
|
|
"lava" { "groups" (set ["noun" "object"]) }
|
|
"earth" { "groups" (set ["noun" "object" "planet"]) }
|
|
"io" { "groups" (set ["noun" "object"]) }
|
|
"green" { "groups" (set ["noun" "color" "concept"]) }
|
|
"plane" { "groups" (set ["noun" "object" "vehicle" "fast"]) }
|
|
"car" { "groups" (set ["noun" "object" "vehicle" "slow-ish"]) }
|
|
"wale" { "groups" (set ["noun" "object" "living-being"]) }
|
|
"cold" { "groups" (set ["property" "temperature"]) "as_property" "temperature" }
|
|
"dangerous" { "groups" (set ["property"]) "as_property" "safety" }
|
|
"planet" { "groups" (set ["noun" "group"]) }
|
|
"moon" { "groups" (set ["noun" "group"]) }
|
|
"color" { "groups" (set ["property" "group"]) }
|
|
"fly" { "groups" (set ["verb"]) }
|
|
"swim" { "groups" (set ["verb"]) }
|
|
}
|
|
)
|
|
|
|
(setv examples
|
|
[
|
|
{ "text" "icecream is cold"
|
|
"parsed" '(exists-property-with-value icecream cold) }
|
|
{ "text" "is icecream cold?"
|
|
"parsed" '(question (exists-property-with-value icecream cold)) }
|
|
{ "text" "lava is dangerous"
|
|
"parsed" '(exists-property-with-value lava dangerous) }
|
|
{ "text" "is lava dangerous?"
|
|
"parsed" '(question (exists-property-with-value lava dangerous)) }
|
|
{ "text" "earth is a planet"
|
|
"parsed" '(pertenence-to-group earth planet) }
|
|
{ "text" "io is a moon"
|
|
"parsed" '(pertenence-to-group io moon) }
|
|
{ "text" "is earth a moon?"
|
|
"parsed" '(question (pertenence-to-group earth moon)) }
|
|
{ "text" "Green is a color"
|
|
"parsed" '(pertenence-to-group green color) }
|
|
{ "text" "a plane can fly"
|
|
"parsed" '(has-capacity plane fly) }
|
|
{ "text" "a wale can swim"
|
|
"parsed" '(has-capacity wale swim) }
|
|
{
|
|
"text" "if earth is a planet it is big"
|
|
"parsed" '(implies
|
|
(pertenence-to-group earth planet)
|
|
(exists-property-with-value earth big)) }
|
|
|
|
]
|
|
)
|
|
|
|
(defn run_tests []
|
|
[
|
|
(setv knowledge (KnowledgeBase
|
|
knowledge=base_knowledge,
|
|
)
|
|
)
|
|
]
|
|
)
|