Repository navigation
Expand file tree
/
Copy pathmodel1.lisp
More file actions
345 lines (287 loc) · 6.77 KB
/
Copy pathmodel1.lisp
File metadata and controls
345 lines (287 loc) · 6.77 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
;;; Model 1: Reitter Declarative model
;;;####################################################################################################################
;;; Summary of Model
; The model1 relies on retrieval module to decide syntactic structure
;
;
; First, the model parses in prime sentence from visual buffer (step1-1)
; Then it requests a retrieval of either DO/PO based on prime (step2)
; After successfully retrieves (step3-1) or failed to retrieve(step3-2), the model proceeds to the picture description
; task, parsing in the target picture from visual buffer (step1-2)
; Then the model requests a retrieval of any available syntactic structure(step4)
; Given the retrieval outcomes, the model applies the syntactic structure (step5-1), or the model fails to retrieve any
; syntax (step5-2)
; Lastly, the model speaks out the syntactic structure DO(step6-1), PO(step6-2), or unknown(step6-3)
; to simulate the process of producing a full sentence
;
;;; Notes: one additional parameter is set the base level for DO-FORM to create a bias for DO constructions.
;;;####################################################################################################################
(clear-all)
;;; --------- PARAMETERS ---------
(define-model model1 "A declarative model"
(sgp ;:seed (250 20)
:er t; Enable randomness, how deterministically
:esc t ; Subsymbolic computations
:v nil
:style-warnings nil
:model-warnings nil
:trace-detail low ; high/medium/low
:act t ; Activation trace
:ans .2 ; Activation noise
:bll 0.5 ; Decay
:lf 1.0 ; Memory decay
:rt -100 ; Threshold
)
;;; --------- CHUNK TYPE ---------
(chunk-type goal-state
state
retrieved-syntax)
(chunk-type sentence
string
noun1
noun2
verb
syntax
syntax-corr)
(chunk-type semantics
agent
patient
action
syntax
syntax-corr)
(chunk-type picture
agent
patient
action)
(chunk-type syntactic-structure
syntax
english)
;;; --------- DM ---------
(add-dm
(state) (wait) (next) (end) (yes) (no)
(step1) (step2) (step3) (step4) (step5) (step6) (step7)
(comprehend-sentence) (comprehend-picture)
(syntactic-structure) (syn-corr) (syntax) (retrieved-syntax)
(DO) (PO) (unknown)(english)
(wait-for-screen isa goal-state state wait)
(wait-for-next-screen isa goal-state state next)
(DO-form ISA syntactic-structure syntax DO english t)
(PO-form ISA syntactic-structure syntax PO english t)
)
; ----- BIAS toward DO ----
;(set-base-levels (DO-form .5) (PO-form 0))
;;;---------------- COMPREHEND ----------------
(p step1-1
"parse in the prime sentence, create a semantic representation in imaginal buffer"
=goal>
ISA goal-state
state wait
?imaginal>
state free
buffer empty
=visual>
ISA sentence
; noun1 =n1
; noun2 =n2
; verb =verb
syntax =syntax
syntax-corr =syntax-corr
==>
=visual>
*goal>
state step2
+imaginal>
ISA semantics
; agent =n1
; patient =n2
; action =verb
syntax =syntax
syntax-corr =syntax-corr
;!output! ("in step 1")
;!output! (the syntax is =syntax =syntax-corr)
)
(p step2
"request a retrieval of syntactic structure(DO/PO) based on prime"
=goal>
ISA goal-state
state step2
?imaginal>
state free
=imaginal>
ISA semantics
syntax =syntax
?retrieval>
state free
buffer empty
==>
=imaginal>
*goal>
state step3
+retrieval>
ISA syntactic-structure
syntax =syntax
english t
)
(p step3-1
"successfully retrieved"
=goal>
ISA goal-state
state step3
=retrieval>
ISA syntactic-structure
- syntax nil
syntax =syn
english t
==>
*goal>
state next
)
(p step3-2
"failed to retrieve"
=goal>
ISA goal-state
state step3
?retrieval>
buffer failure
==>
*goal>
state next
)
;------------- PRODUCTION -------------
(p step1-2
"parse in the target picture, create a semantic representation in imaginal buffer"
=goal>
ISA goal-state
state next
?imaginal>
state free
; buffer empty
=imaginal>
- syntax nil
syntax =syn
=visual>
ISA picture
agent =agent
patient =patient
action =action
==>
*goal>
state step4
*imaginal>
; agent =agent
; patient =patient
; action =action
; !output! ("in step 1-2 comprehend picture, in imaginal")
; !output! =syn
)
(p step4
"request a retrieval of any syntactic structure"
=goal>
ISA goal-state
state step4
?imaginal>
state free
buffer full
=imaginal>
ISA semantics
- syntax nil
syntax =syn
; agent =agent
; patient =patient
; action =action
?retrieval>
state free
buffer empty
==>
*goal>
state step5
=imaginal>
+retrieval>
ISA syntactic-structure
english t
; !output! ('in imaginal' =syn)
)
(p step5-1
"sucessfully retrieved syntax and apply it"
=goal>
isa goal-state
state step5
?retrieval>
state free
buffer full
=retrieval>
isa syntactic-structure
english t
syntax =syn
==>
*goal>
state step6
retrieved-syntax =syn
)
(p step5-2
"failed to retrieve any syntax, apply failure to imaginal buffer"
=goal>
isa goal-state
state step5
?retrieval>
buffer failure
==>
*goal>
state step6
retrieved-syntax unknown
)
(p step6-1
"produce DO sentence"
=imaginal>
isa semantics
- syntax nil
=goal>
ISA goal-state
state step6
retrieved-syntax DO
?vocal>
state free
==>
*goal>
state end
+vocal>
cmd speak
string "DO"
)
(p step6-2
"produce PO sentence"
=imaginal>
isa semantics
- syntax nil
=goal>
ISA goal-state
state step6
retrieved-syntax PO
?vocal>
state free
==>
*goal>
state end
+vocal>
cmd speak
string "PO"
)
(p step6-3
"failed to produce sentence"
=imaginal>
isa semantics
- syntax nil
=goal>
ISA goal-state
state step6
retrieved-syntax unknown
?vocal>
state free
==>
*goal>
state end
+vocal>
cmd speak
string "unknown"
)
)