Fixed #55 : DefConceptParser: failed to recognize concept

Fixed #62 : DefConceptParser: parsing error
Fixed #64 : DefConceptParser: Failed to parse when too many concept keyword
Fixed #65 : DefConceptParser : Add auto_eval keyword
Fixed #66 : DefConceptParser : Add def_var keyword
Fixed #67 : Add get_errors()
This commit is contained in:
2021-04-13 15:15:17 +02:00
parent 81e67147e9
commit bef5f3208c
17 changed files with 838 additions and 235 deletions
+9 -18
View File
@@ -1,8 +1,7 @@
# question
push_ontology("english")
def concept q from q ? as question(q) pre is_question()
def concept q from q ? as question(q) pre is_question() auto_eval True
set_is_lesser(__PRECEDENCE, q, 'Sya')
set_auto_eval(c:q:)
def concept the x ret memory(x)
def concept a x where 'x is a concept' ret x
@@ -14,25 +13,17 @@ set_is_greatest(__PRECEDENCE, c:an x:, 'Sya')
def concept "x is a concept" as isinstance(x, Concept) pre is_question()
# is a
def concept x is a y as set_isa(x, y) ret x
set_auto_eval(c:x is a y:)
def concept x is an y as set_isa(x, y) ret x
set_auto_eval(c:x is an y:)
def concept x is a y as set_isa(x, y) ret x auto_eval True
def concept x is an y as set_isa(x, y) ret x auto_eval True
def concept x is a y as isa(x,y) pre is_question()
# no need to auto eval as it's a question
def concept x is an y as isa(x,y) pre is_question()
# no need to auto eval as it's a question
# has a
def concept x has a y as set_hasa(x, y) ret x
set_auto_eval(c:x has a y:)
def concept x has an y as set_hasa(x, y) ret x
set_auto_eval(c:x has an y:)
def concept x has a y as set_hasa(x, y) ret x auto_eval True
def concept x has an y as set_hasa(x, y) ret x auto_eval True
def concept x has a y as hasa(x,y) pre is_question()
# no need to auto eval as it's a question
def concept x has an y as hasa(x,y) pre is_question()
# no need to auto eval as it's a question
# AND
def concept x and y as x and y pre is_question()
@@ -45,9 +36,7 @@ set_is_lesser(__PRECEDENCE, c:x or y:, 'Sya')
set_is_greater_than(__PRECEDENCE, c:x and y:, c:x or y:, 'Sya')
set_is_less_than(__PRECEDENCE, c:q:, c:x or y:, 'Sya')
# default
# some words
def concept male
def concept female
def concept man
@@ -62,6 +51,7 @@ def concept boys
def concept girl
def concept girls
def concept shirt
def concept table
# days of the week
def concept monday
@@ -73,5 +63,6 @@ def concept saturday
def concept sunday
# questions
def concept what x is y pre is_question() where isa(x, adjective) as smart_get_attr(y, x)
def concept how is x pre is_question() as smart_get_attr(x, adjective)
def concept what x is y pre is_question() where x is an adjective as smart_get_attr(y, x)
def concept what is the x of y pre is_question() where x is an adjective as smart_get_attr(y, x)