Repository navigation
Expand file tree
/
Copy pathmodel2.lisp
More file actions
401 lines (330 loc) · 7.83 KB
/
Copy pathmodel2.lisp
File metadata and controls
401 lines (330 loc) · 7.83 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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
;;; Model 2: Surprisal model
;;;####################################################################################################################
;;; Summary of Model
; The model2 accounts for the low-frequency priming effects
;
;
; 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 model2 "A surprisal model"
(sgp ;:seed (250 20)
:er t; Enable randomness, how deterministically
:esc t ; Subsymbolic computations
:v nil
:trace-detail low ;high/medium/low
:act t ; Activation trace
;:show-focus t ; Debug focus of visual
:ans 0.5 ; Activation noise
;:egs 0.01 ; Utility noise parameter
:rt -100 ; Threshold
:bll 0.5 ; Decay
:lf 1.0 ; Memory decay
:mas 3.2 ; Maximum activation strength
:ga 1 ; Spreading from goal buffer
:imaginal-activation 0 ; Spreading from imaginal buffer
)
(sgp :style-warnings nil)
;;; --------- CHUNK TYPE ---------
(chunk-type goal-state
state
spread-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) (spread-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 1) (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 ; prime syntax
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-1
"if find no error(high-freq construction), no spreading activation
and 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
syntax-corr yes
; 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 step4-2
"if find error(low-freq construction), spreading activation to this structure
and 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
syntax-corr no
; agent =agent
; patient =patient
; action =action
?retrieval>
state free
buffer empty
==>
*goal>
state step5
spread-syntax =syn ; prime syntax
-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
?imaginal>
state free
buffer empty
==>
*goal>
state step6
+imaginal>
isa semantics
syntax =syn
)
(p step5-2
"failed to retrieve any syntax, apply failure to imaginal buffer"
=goal>
isa goal-state
state step5
?retrieval>
buffer failure
?imaginal>
state free
buffer empty
==>
*goal>
state step6
+imaginal>
isa semantics
syntax unknown
)
(p step6-1
"produce DO sentence"
=imaginal>
isa semantics
syntax DO
=goal>
ISA goal-state
state step6
?vocal>
state free
==>
*goal>
state end
+vocal>
cmd speak
string "DO"
)
(p step6-2
"produce PO sentence"
=imaginal>
isa semantics
syntax PO
=goal>
ISA goal-state
state step6
?vocal>
state free
==>
*goal>
state end
+vocal>
cmd speak
string "PO"
)
(p step6-3
"failed to produce sentence"
=imaginal>
isa semantics
syntax unknown
=goal>
ISA goal-state
state step6
?vocal>
state free
==>
*goal>
state end
+vocal>
cmd speak
string "unknown"
)
)