-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathtest.top
147 lines (93 loc) · 4.06 KB
/
test.top
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#### This file is used to try Ghost features.
#### It tries to cover every synatx and basic usage.
# Ghost Rules have the following format
# (pattern && action) ==> goal
# That is if a pattern is matched action is then executed and the goal is said to be achieved.
# A goal also has an urge to express the level of need to achieve that goal.
# Rules are organized into topics.
# Ghost action selector runs in a loop to select a single rule and execute it.
# Rule is selected based on the following criteria:
# whether a pattern is matched or not
# the strength of the goal
# the urge of the goal
# importance of the rule (rules just selected are considered less important)
# whether a rule is in the current topic (priority is given)
### Urge
# Set initial urges for the goal.
# By increasing the urge of a goal, one can increase the chance of rules containing the goal
# to be selected by the action selector.
urge: (please_user=1 introduction=1 curiosity=0.7 stay_awake=1)
### Concept
### Sequence enclosed in parenthesis
# Concepts used to group similar words and phrases together
concept: ~HI [hi hello hey (how be you)]
# Rules are organized into topics.
# The topic definition here applies to all rules below until
# the next topic definition.
# The ff topic has 'keep' feature. It means all rules in this topic can be
# considered by the action selector many times as oppossed to other rules
# which are never reconsidered once they get executed.
topic: ~GREETING keep [~HI]
# Top level goal shared by all rules under it until the next top level goal.
goal: (stay_awake=0.7)
### Ghost rule with a kind, a label, a pattern, an action and a rule-level goal.
#goal: (introduction=0.6)
?: (what be you) I am a robot
#goal: (introduction=0.7)
?: (what be you name) My name is Dr. Roboto
### Randomized output
u: (~HI) [hi] [hello] [hey] [how are you] there
### Gambits
##goal: (curiosity=0.7)
# t: what is your name?
### Match variable (start with _)
### User variables (start with $)
#goal: (please_user=0.6)
u: (me name be _*) $name= '_0 Hi '_0
?: (do you eat _[meat fish chicken]) No, I hate _0
?: (do you use _*1 or _*1) I neither use _0 nor _1
### Multi-goaled rule
#goal: (please_user=0.8 introduction=0.5)
u: (what be me name $name) Your name is $name
### Rejoinders
u: (you hate human) no. you are very interesting. Do you hate robots?
a: (yes) I am sure you are going to like me though
a: (no) We will get along fine
### Choices
?: (you [swim ride fish ]) I do.
### Indefinite wildcards
?: (when * you * home) I go home tomorrow
### Precise wildcards
?: (when *1 you *1 school) I went to school yestearday
### Range restricted wildcards
?: (you *~2 go *~2 office) I often go to the office
### Unordered matching
s: ( << I birds love >> ) I love birds too
### Sentence boundaries
u: (what is an elephant > ) An elephant is a pachyderm
u: ( roses < I like ) I like roses too
### Negation
u: (!hate I *1 meat) Is meat good for you?
### Use of functions in contexts
# The functions are defined in functions.scm and return either (stv 0 1) or (stv 1 1) ==> (falase or true)
# u: ( * ^func-true) This always runs
u: ( * ^func-false) This never runs
### Functions with arguments
u: (are you happy ^is-happy(.7)) Yes I am happy
u: (are you happy ^neg-is-happy(.7)) No I am not happy
### Use of functions in actions
# The functions are defined in functions.scm and return list of word nodes if need be
u: (who killed the _*) I think ^func-findkiller killed the '_0
### Sample rule for face detection
u: (inner msg face is detected) I see your face!
### Sample rule for demonstrating returning and looping C++ detector functions
#goal: (testing_goal=0.5)
u:(returning detector function) Random returning number is ^func-returning-result
#goal: (testing_goal=0.5)
u: (looping detector function) Random looping number is ^func-looping-result
### Ordered Goal
# Goal of next rules decrease in a geometric sequence with a factor 0.5
## ordered-goal: (curiosity=0.8)
# u: (what be _*) please define '_0
# u: (why be _*) why not
# and so on.. as there are more rules the geometric sum converges to 0.8