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:
@@ -2,9 +2,9 @@
|
||||
push_ontology("english")
|
||||
|
||||
def concept adjective
|
||||
|
||||
def concept color
|
||||
set_isa(color, adjective)
|
||||
|
||||
def concept red
|
||||
def concept blue
|
||||
def concept orange
|
||||
@@ -31,5 +31,14 @@ set_isa(black, color)
|
||||
set_isa(white, color)
|
||||
set_isa(grey, color)
|
||||
|
||||
def concept size
|
||||
size is an adjective
|
||||
|
||||
def concept tall
|
||||
tall is a size
|
||||
def concept short
|
||||
short is a size
|
||||
|
||||
|
||||
def concept qualify x from bnf adjective x as set_attr(x, c:adjective:, adjective) ret x
|
||||
def concept qualify x from bnf x 'is' adjective as set_attr(x, c:adjective:, adjective) ret x
|
||||
+22
-47
@@ -1,57 +1,32 @@
|
||||
# admin helpers
|
||||
push_ontology("admin")
|
||||
def concept explain as get_results(id=0, depth=2)
|
||||
set_isa(c:explain:, __AUTO_EVAL)
|
||||
def concept explain as get_results(id=0, depth=2) auto_eval True
|
||||
def concept explain last as get_last_results(id=0, depth=2) auto_eval True
|
||||
def concept explain x as get_results(id=x, depth=3) auto_eval True
|
||||
|
||||
def concept explain last as get_last_results(id=0, depth=2)
|
||||
set_isa(c:explain last:, __AUTO_EVAL)
|
||||
def concept precedence a > precedence b as set_is_greater_than(__PRECEDENCE, a, b, 'Sya') auto_eval True
|
||||
|
||||
def concept explain x as get_results(id=x, depth=3)
|
||||
set_isa(c:explain x:, __AUTO_EVAL)
|
||||
def concept x is a command as set_auto_eval(x, __AUTO_EVAL) auto_eval True
|
||||
|
||||
def concept precedence a > precedence b as set_is_greater_than(__PRECEDENCE, a, b, 'Sya')
|
||||
set_isa(c:precedence a > precedence b:, __AUTO_EVAL)
|
||||
def concept activate debug as set_debug(True) auto_eval True
|
||||
def concept deactivate debug as set_debug(False) auto_eval True
|
||||
def concept debug on as set_debug(True) auto_eval True
|
||||
def concept debug off as set_debug(False) auto_eval True
|
||||
|
||||
def concept x is a command as set_auto_eval(x, __AUTO_EVAL)
|
||||
set_auto_eval(c:x is a command:)
|
||||
def concept activate debug on x as debug_var(x) auto_eval True
|
||||
def concept debug x as debug_var(x) auto_eval True
|
||||
|
||||
def concept activate debug as set_debug(True)
|
||||
set_auto_eval(c:activate debug:)
|
||||
def concept deactivate debug as set_debug(False)
|
||||
set_auto_eval(c:deactivate debug:)
|
||||
def concept debug on as set_debug(True)
|
||||
set_auto_eval(c:debug on:)
|
||||
def concept debug off as set_debug(False)
|
||||
set_auto_eval(c:debug off:)
|
||||
def concept debug var x as debug_var(variable=x) auto_eval True
|
||||
def concept debug variable x as debug_var(variable=x) auto_eval True
|
||||
def concept debug method x as debug_var(method=x) auto_eval True
|
||||
|
||||
def concept activate debug on x as debug_var(x)
|
||||
set_auto_eval(c:activate debug on x:)
|
||||
def concept debug x as debug_var(x)
|
||||
set_auto_eval(c:debug x:)
|
||||
def concept deactivate debug on x as debug_var(x, enabled=False) where x auto_eval True
|
||||
|
||||
def concept debug var x as debug_var(variable=x)
|
||||
set_auto_eval(c:debug var x:)
|
||||
def concept debug variable x as debug_var(variable=x)
|
||||
set_auto_eval(c:debug variable x:)
|
||||
def concept debug method x as debug_var(method=x)
|
||||
set_auto_eval(c:debug method x:)
|
||||
|
||||
def concept deactivate debug on x as debug_var(x, enabled=False) where x
|
||||
set_auto_eval(c:deactivate debug on x:)
|
||||
|
||||
def concept activate return values processing as set_var("sheerka.enable_process_return_values", True)
|
||||
def concept deactivate return values processing as set_var("sheerka.enable_process_return_values", False)
|
||||
set_auto_eval(c:activate return values processing:)
|
||||
set_auto_eval(c:deactivate return values processing:)
|
||||
|
||||
def concept rule x where isinstance(x, int) as r:|x:
|
||||
set_auto_eval(c:rule x:)
|
||||
def concept rule x > rule y where isinstance(x, int) and isinstance(y, int) as set_is_greater_than(__PRECEDENCE, r:|x:, r:|y:, 'Rule')
|
||||
set_auto_eval(c:rule x > rule y:)
|
||||
def concept rule x is greatest where isinstance(x, int) as set_is_greatest(__PRECEDENCE, r:|x:, 'Rule')
|
||||
set_auto_eval(c:rule x is greatest:)
|
||||
def concept rule x < rule y where isinstance(x, int) and isinstance(y, int) as set_is_less_than(__PRECEDENCE, r:|x:, r:|y:, 'Rule')
|
||||
set_auto_eval(c:rule x < rule y:)
|
||||
def concept rule x is lesser where isinstance(x, int) as set_is_lesser(__PRECEDENCE, r:|x:, 'Rule')
|
||||
set_auto_eval(c:rule x is lesser:)
|
||||
def concept activate return values processing as set_var("sheerka.enable_process_return_values", True) auto_eval True
|
||||
def concept deactivate return values processing as set_var("sheerka.enable_process_return_values", False) auto_eval True
|
||||
|
||||
def concept rule x where isinstance(x, int) as r:|x: auto_eval True
|
||||
def concept rule x > rule y where isinstance(x, int) and isinstance(y, int) as set_is_greater_than(__PRECEDENCE, r:|x:, r:|y:, 'Rule') auto_eval True
|
||||
def concept rule x is greatest where isinstance(x, int) as set_is_greatest(__PRECEDENCE, r:|x:, 'Rule') auto_eval True
|
||||
def concept rule x < rule y where isinstance(x, int) and isinstance(y, int) as set_is_less_than(__PRECEDENCE, r:|x:, r:|y:, 'Rule') auto_eval True
|
||||
def concept rule x is lesser where isinstance(x, int) as set_is_lesser(__PRECEDENCE, r:|x:, 'Rule') auto_eval True
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user