-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinquiry-implementations-english.lisp
executable file
·3489 lines (2896 loc) · 136 KB
/
inquiry-implementations-english.lisp
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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(in-package :penman)
;;; Inquiry implementations. Mostly drawn from the inquiry implementations
;;; accompanying the Penman91 release of Nigel. Extensions and changes
;;; include those necessary for the merged upper model and the inquiries
;;; necessary for controlling morphological systems.
;;;
;;; Current inquiry implementations are used by both English and Dutch.
;;;
;;; General cleaning up has been begun.
;;;
;;; Last Update:
;;; 12.11.96: John: cardinal number inqcodes have been patched.
(defun encaps-fetch-feature (feature term)
(if (kpml::term-graph-p (symbol-value term))
(kpml::fetch-feature feature term) nil
))
(defun encaps-fetch-subc-feature (feature term)
(if (kpml::term-graph-p (symbol-value term))
(kpml::fetch-subc-feature feature term) nil
))
(defun encaps-fetch-subc-feature-2 (feature term)
(if (kpml::term-graph-p (symbol-value term))
(kpml::fetch-subc-feature feature term) nil
))
(defun encaps-term-graph-type (term)
(if (kpml::term-graph-p (symbol-value term))
(kpml::term-graph-type term) nil
)ma)
(defun Ability-Q-Code (modal-property process participant)
"See if the MODAL-PROPERTY is one of ABILITY."
(declare (ignore process participant))
(if (term-type-p modal-property '|Ability|) 'ability 'nonability))
(defun Above-Ten-Type-Q-Code (number)
"Give back NUMBER, spelled."
(case number
(11 'eleven)
(12 'twelve)
(otherwise 'ten)))
(defun Above-Twenty-Q-Code (number)
"Test magnitude of NUMBER."
(if (< number 20) 'below 'above))
(defun Absolute-Extent-Q-Code (reln range)
"Depends on type of RELN."
(declare (ignore range))
(if (term-type-p reln '|AbsoluteExtent|) 'absolute
(if (term-type-p reln '|RelativeExtent|) 'nonabsolute)))
(defun Abstraction-Q-Code (conjunctive)
"If an RST-ELABORATION, then ABSTRACTION."
(if (term-type-p conjunctive '|uio#RSTElaboration|) 'abstraction 'notabstraction))
(defun Accompaniment-ID-Code (process)
"Return the accompaniment feature."
(fetch-relation-spec process '|accompaniment| 'Accompaniment-ID))
(defun Accompaniment-Mod-ID-Code (process)
"Return the accompaniment feature as a reified relation."
(fetch-relation-spec process '|accompaniment| 'Accompaniment-MOD-ID))
(defun Accompaniment-Modification-Q-Code (process)
"Look for an accompaniment feature."
(if (fetch-subc-feature '|accompaniment| process) 'accompanying))
(defun Accompaniment-Q-Code (process)
"Look for an accompaniment feature."
(if (fetch-relation '|accompaniment| process) 'Accompaniment))
(defun Accompaniment-Relation-Q-Code (process)
"Is it an accompaniment relation?"
(if (term-type-p process '|accompaniment|) 'Accompaniment 'notaccompaniment))
(defun Actor-ID-Code (process)
"Return the actor feature."
(fetch-subc-feature '|actor| process))
(defun Actualization-Constrainer-ID-Code (spec process)
"Return some appropriate role."
(declare (ignore spec)) ;;;Which arg do we really need?
(or ; (fetch-subc-feature 'beneficiary process)
(fetch-subc-feature '|domain| process)
(fetch-subc-feature '|range| process)
(fetch-subc-feature '|actor| process)
(fetch-subc-feature '|actee| process)
(fetch-subc-feature '|senser| process)
(fetch-subc-feature '|sayer| process)
(fetch-subc-feature '|saying| process)
(fetch-subc-feature '|addressee| process)))
(defun Actualization-Constrainer-Q-Code (spec process)
"ACTUALIZATIONCONSTRAINER only if there's no theme."
(declare (ignore spec))
(if (fetch-feature '|theme| process) 'nonactualizationconstrainer))
(defun Addition-Q-Code (reln range)
"If RELN is of type ADDITIVE."
(declare (ignore range))
(if (term-type-p reln '|additive|) 'addition 'nonaddition))
(defun Address-Q-Code (process)
"If there is an ADDRESSEE feature, then ADDRESS."
(if (fetch-subc-feature '|addressee| process) 'address 'nonaddress))
(defun Addressee-ID-Code (process)
"If there is an ADDRESSEE feature, then ADDRESS."
(fetch-subc-feature '|addressee| process))
(defun Addressee-Oriented-Q-Code (process)
"If the process type is Addressee-Oriented-Verbal-Process, then ADDRESSEEORIENTED."
(if (term-type-p process '|AddresseeOriented|)
'addresseeoriented
'notaddresseeoriented))
(defun AddressSpecificity-Q-Code (object)
"If it's a date, with month/day or month/year features, to position."
(if (or (and (term-type-p object '|Date|)
(or (fetch-subc-feature '|Day| object)
(fetch-subc-feature '|Month| object))
(or (fetch-subc-feature '|Month| object)
(fetch-subc-feature '|Year| object)))
(and (term-type-p object '|ZeroDLocation|)
(fetch-subc-feature '|Latitude| object)
(fetch-subc-feature '|Longitude| object)))
'ToPosition
'ToRegion))
(defun affected-id-code (p)
(setf r (sub-affected-id-code p))
r)
(defun sub-Affected-ID-Code (process)
"Return the actee of a DIRECTED-ACTION and actor of a NONDIRECTED-ACTION."
(if (term-type-p process '|space#SpatialLocating|)
(fetch-subc-feature '|attribute| process)
(if (term-type-p process '|NonAffectingAction|)
(fetch-subc-feature '|actor| process)
(fetch-subc-feature '|actee| process))))
(defun Age-Modification-Q-Code (object)
"Look for an AGE feature."
(if (fetch-subc-feature '|AgePropertyAscription| object) 'age))
(defun Age-Modifier-ID-Code (object)
"Return the AGE feature."
(fetch-subc-feature '|AgePropertyAscription| object))
;(defun Agent-Mention-Q-Code (actee)
; "Look for inverse speaker, creator features."
; (if (or (fetch-subc-feature 'inverse-creator actee)
; (fetch-subc-feature 'inverse-speaker actee)) 'mention))
;(defun Agent-Mention-Q-Code (process)
; "Look for an ACTOR."
; (if (fetch-subc-feature 'actor process) 'mention))
; Patch: mick, to allow instrument to become subject
; see also Causer-ID-Code, Know-Manner-Q-Code
(defun Agent-Mention-Q-Code (process)
"Look for an ACTOR."
(if (or (fetch-subc-feature '|actor| process)
(fetch-subc-feature '|instrumental| process)) 'mention))
(defun Agent-Qualifier-ID-Code (activity)
"Return the ACTOR."
(fetch-subc-feature '|actor| activity))
(defun Agentive-Q-Code (manner process)
"Is MANNER an AGENTIVE?"
(declare (ignore process))
(if (term-type-p manner '|agentive|) 'agentive 'nonagentive))
(defun Alternative-Q-Code (reln range)
"If RELN is of type ALTERNATIVE."
(declare (ignore range))
(if (term-type-p reln '|alternative|) 'alternative 'nonalternative))
(defun Ambient-Q-Code (process)
(if (term-type-p process '|Ambience|) 'ambient))
(defun Amount-Attention-Q-Code (object)
"Who knows?"
(if (not
(or (eq (fetch-feature '|determiner| object) 'all)
(eq (fetch-feature '|determiner| object) 'the)
(eq (fetch-feature '|determiner| object) 'nodet)) )
'minimalattention ))
(defun Answer-Q-Code (speech-act)
"Is the type of the speech-act term ANSWER?"
(if (term-type-p speech-act '|answer|) 'answer 'nonanswer))
(defun Anterior-Q-Code (temporal-relation)
"Is TEMPORAL-RELATION anterior?"
(if (term-type-p temporal-relation '|anterior|) 'anterior 'notanterior))
(defun Anteriority-Q-Code (temporal-relation)
"We are not sure what it means for anteriority to be specifed, (for a nonanterior relation)."
(if (term-type-p temporal-relation '|anterior|) 'anteriority 'noanteriority))
(defun Ascription-Q-Code (reln)
"We just look to see if the variable--a relation--is an ascription."
(if (term-type-p reln '|Ascription|) 'Ascription 'notascription))
#+ignore
(defun Attribuend-ID-Code (reln)
"Return the PROPERTY-ASCRIPTION feature, or look for the DOMAIN feature of the parent term."
(if (fetch-minimal-relation '|PropertyAscription| reln)
(fetch-subc-feature '|domain| (fetch-minimal-relation '|PropertyAscription| reln))
(if (and (not (term-type-p reln '|SimpleQuality|))
(not (fetch-subc-feature '|range| reln)))
(fetch-subc-feature '|domain| reln)
(or (fetch-subc-feature '|domain| (term-graph-parent (symbol-value reln)))
(term-graph-parent (symbol-value reln))))))
(defun Attribuend-ID-Code (property)
"Previously Dimension-ID code - but works better for Attribuend-id: give the relation of which PROPERTY is the range."
(or (when (or (term-type-p property '|SimpleQuality|)
(term-type-p property '|Quantity|)
(term-type-p property '|SimpleThing|))
(term-graph-parent (symbol-value property)))
(when (term-type-p property '|PropertyAscription|)
(fetch-subc-feature '|domain| property))))
(defun Attribuend-Qualification-Q-Code (obj)
"Look for any PROPERTY-ASCRIPTION feature, making sure you only pick out RANGEs."
(if (or
(and (fetch-minimal-relation '|PropertyAscription| obj)
(fetch-subc-feature '|range|
(fetch-minimal-relation '|PropertyAscription| obj))
(eq (term-graph-symbol
(symbol-value
(fetch-subc-feature '|range|
(fetch-minimal-relation '|PropertyAscription| obj))))
(term-graph-symbol (symbol-value obj))))
(and ;(not (pledged-p obj))
(term-type-p obj 'two-place-relation)
(fetch-subc-feature '|domain| obj)
(not (fetch-subc-feature '|range| obj))))
'attribuendqualification))
(defun Attribute-ID-Code (reln)
"Find the RANGE feature."
(or (fetch-subc-feature '|range| reln)
reln))
(defun Axis-Of-Orientation-Q-Code (reln range)
"Use the type of RELN."
(declare (ignore range))
(setf t1 (fetch-subc-feature '|space#hasSpatialModality| range))
(when (not t1) (setf t1 (fetch-feature '|space#hasSpatialModality| (fetch-subc-feature '|attribute| range))) )
(if (term-type-p t1 '|space#HorizontalProjection|) 'horizontal
(if (term-type-p t1 '|space#VerticalProjection|) 'vertical)))
(defun Behalf-Q-Code (relation)-
"Is the relation a CLIENT?"
(if (term-type-p relation '|client|) 'behalf 'nonbehalf))
(defun Behalf-ID-Code (process)
"Return the CLIENT feature."
(fetch-relation-spec process '|client| 'Behalf-ID))
(defun Below-Hundred-Q-Code (number)
"Just test magnitude of NUMBER."
(if (> number 99) 'notbelowhundred 'belowhundred))
(defun Below-Ten-Q-Code (number)
"Just test magnitude of NUMBER."
(if (> number 9) 'notbelowten 'belowten))
; john patch 20/5/96 - did not have zero...
(defun BelowTen-Type-Q-Code (item)
"Just give back ITEM, spelled out."
(Case item
(0 'zero)
(1 'one)
(2 'two)
(3 'three)
(4 'four)
(5 'five)
(6 'six)
(7 'seven)
(8 'eight)
(otherwise 'nine)))
(defun Beneficiary-ID-Code (process)
"Return the beneficiary or recipient."
(or (fetch-feature '|beneficiary| process)
(fetch-feature '|recipient| process)))
(defun Between-Q-Code (reln range)
"Look for a between feature."
(declare (ignore range))
(if (term-type-p reln '|between| ) 'between 'notbetween))
(defun Body-Of-Water-Q-Code (object)
"Is it an ocean?"
(if (term-type-p object '|Ocean|) 'bodyofwater 'notbodyofwater))
(defun Cardinal-Complexity-Q-Code (number)
"If number is less than 20, or a multiple of ten, it's expressed by a single position."
(if (or (< number 20)
(and (< number 100)
(eql 0 (rem number 10)))
(and (not (< number 100))
(< number 1000)
(eql 0 (rem number 100)))
(and (not (<= number 1000)) ;; changed for 1000
(< number 10000)
(eql 0 (rem number 1000)))
(and (not (< number 10000))
(> number 999999)
(eql 0 (rem number 1000000))))
'singleposition
'multiplepositions))
(defun Carrier-ID-Code (reln)
"Find the DOMAIN feature."
(fetch-subc-feature '|domain| reln))
(defun Causal-Relation-Q-Code (process)
"Is it a causal relation?"
(if (term-type-p process '|causalRelation|) 'causalrelation 'notcausalrelation))
(defun Causation-And-Behalf-Q-Code (process)
"Look for a client feature."
(if (fetch-subc-feature '|client| process) 'behalf))
(defun Causation-And-Concession-Q-Code (process)
"Look for a CONCESSIVE feature."
(if (fetch-subc-feature '|concessive| process) 'concession))
(defun Causation-And-Purpose-Q-Code (process)
"Look for a PURPOSE feature."
(if (fetch-subc-feature '|purpose| process) 'purpose))
(defun Causation-And-Reason-Q-Code (process)
"Look for a REASON feature."
(if (fetch-subc-feature '|reason| process) 'reason))
(defun Causation-Q-Code (process)
"Look for a causation feature, or for a beneficiary."
(if (and (fetch-subc-feature '|causalRelation| process)
(not (pledged-p (fetch-subc-feature '|causalRelation| process))))
'cause))
(defun Causative-Mention-Q-Code (causer activity)
"WITHHOLD only if causer is unknown."
(declare (ignore activity))
(if (eq causer '?actor) 'withhold))
(defun Cause-Condition-Q-Code (part1 part2)
"See if the parent is a CAUSE."
(declare (ignore part2))
(if (term-type-p (term-graph-parent (symbol-value part1)) '|causeEffect|)
'causecondition
'noncausecondition))
(defun Cause-ID-Code (process)
"Return the causation feature."
(or (fetch-relation-spec process '|causalRelation| 'Cause-ID)
(fetch-relation-spec process '|beneficiary| 'Cause-ID)))
(defun Caused-Process-Q-Code (process)
"Is the action directed? If not, is it a mental activity?"
(if (or (term-type-p process '|AffectingAction|)
(term-type-p process '|MentalActive|)) 'caused 'independent))
;(defun Causer-ID-Code (process)
; "Return the actor."
; (or (fetch-subc-feature 'actor process)
; (if (term-type-p process 'mental-active)
; (fetch-subc-feature 'senser process))))
; mick patch 11/15/90 - allow instrument to become agent
; See also Agent-Mention-Q-Code, Know-Manner-Q-Code
(defun Causer-ID-Code (process)
"Return the actor."
(or (fetch-subc-feature '|actor| process)
(if (term-type-p process '|MentalActive|)
(fetch-subc-feature '|senser| process))
(fetch-subc-feature '|instrumental| process)))
; john patch 20/5/96 - was unprepared for numbers...
(defun Circumstance-Q-Code (arg)
"Is its type circumstantial?"
(cond ((numberp arg)
'notcircumstance)
((or (term-type-p arg '|Circumstantial|)
(term-type-p (term-graph-parent (symbol-value arg)) '|Circumstantial|)
(when (term-graph-parent (symbol-value arg))
(term-role-p
(term-graph-parent (symbol-value arg)) arg '|Circumstantial|)))
'circumstance)
(t 'notcircumstance)))
(defun Circumstantial-Domain-ID-Code (reln)
"Return the DOMAIN feature."
(fetch-subc-feature '|domain| reln))
(defun Circumstantial-Q-Code (reln)
"We just look to see if the variable--a relation--is a circumstantial relation."
(if (term-type-p reln '|Circumstantial|) 'circumstantial 'noncircumstantial))
(defun Circumstantial-Range-ID-Code (reln)
"Return the RANGE feature."
(fetch-subc-feature '|range| reln)
)
(defun Circumstantial-Relation-And-Range-ID-Code (reln)
"Return the relation: its range comes with it."
(setf temp (or (fetch-subc-feature '|attribute| reln) (fetch-subc-feature '|space#temporalLocating| reln)))
temp)
(defun Circumstantial-Relation-ID-Code (reln)
"Just give the relation back."
reln)
(defun Circumstantial-Theme-Q-Code (circumstance spec)
"If CIRCUMSTANCE is a member of the THEME feature of spec, then CONTEXT."
(if (fetch-feature '|theme| spec)
(dolist (theme (term-graph-symbol (symbol-value (fetch-feature '|theme| spec))))
(if (or (term-eq-p circumstance theme)
(term-eq-p (global-fetch-feature '|range| theme) circumstance)
(term-eq-p (fetch-subc-feature '|range| circumstance) theme))
(return 'context)))))
(defun Class-Q-Code (range)
"If the argument is NOT a QUALITY, then return CLASS."
(if (term-type-p range '|SimpleQuality|) 'nonclass 'class))
(defun Clause-As-Nominal-Q-Code (onus)
"If it's a process....but not a relational-process(?)"
(if (and (term-type-p onus '|Process|)
(not (term-type-p onus '|BeingANDHaving|)) )
'nominal-clause
'nonnominal-clause))
(defun Cliency-Q-Code (service )
"look for a beneficiary--only works for CREATION."
(if (fetch-feature '|beneficiary| service) 'cliency))
(defun Client-ID-Code (service)
"Return BENEFICIARY."
(fetch-feature '|beneficiary| service))
(defun Cognition-Q-Code (process)
"If PROCESS is a COGNITION...."
(if (term-type-p process '|Cognition|) 'cognition 'noncognition))
(defun Cognitive-Phenomenon-ID-Code (process)
"Return the PHENOMENON feature."
(fetch-subc-feature '|phenomenon| process))
(defun Cognitive-Phenomenon-Q-Code (process)
"If there is a PHENOMENON feature...."
(if (and (fetch-subc-feature '|phenomenon| process)
(not (term-type-p (fetch-subc-feature '|phenomenon| process) '|Process|)))
'phenomenon))
(defun Colour-Modification-Q-Code (object)
"Look for a COLOUR (COLOR) feature."
(if (fetch-subc-feature '|ColorPropertyAscription| object) 'colour))
(defun Colour-Modifier-ID-Code (object)
"Return the color feature."
(fetch-subc-feature '|ColorPropertyAscription| object))
(defun Command-Offer-Q-Code (report)
"If the type of the projector of REPORT is Non-Addressee-Oriented, then not command offer."
(if (or (and (term-type-p (term-graph-parent (symbol-value report)) '|Internal|)
(not (term-type-p (term-graph-parent (symbol-value report)) '|ReactionAndEmotion|)))
(term-type-p (term-graph-parent (symbol-value report)) '|NonAddressing|))
'notcommandoffer
'commandoffer))
(defun Command-Q-Code (speech-act)
"Is the type of the speech-act term COMMAND?"
(if (term-type-p speech-act '|uio#Directive|) 'command 'nocommand))
(defun Command-Responsible-ID-Code (speechact)
"Pick up the HEARER feature, if any. If not, value will default."
(fetch-feature '|hearer| speechact))
(defun Comparison-Representative-ID-Code (concept)
"A guess--depends on representation chosen.
Here we return the RANGE of an expected IDENTITY involving CONCEPT as DOMAIN."
(fetch-subc-feature '|range| (term-graph-parent (symbol-value concept))))
(defun Complex-Thing-Part1-ID-Code (onus)
"Pop the first member of the set, and use its id."
(if (or (term-type-p onus '|Conjunction|)
(term-type-p onus '|Disjunction|))
(fetch-feature '|domain| onus)
(if (symbolp (first (term-graph-symbol (symbol-value onus))))
(first (term-graph-symbol (symbol-value onus)))
(term-graph-id (first (term-graph-symbol (symbol-value onus)))))))
(defun Complex-Thing-Part2-ID-Code (onus)
"Modify the spec: the first elt is consumed. If one only is left, give back its id."
(if (or (term-type-p onus '|Conjunction|)
(term-type-p onus '|Disjunction|))
(fetch-feature '|range| onus)
(if (< 2 (length (term-graph-symbol (symbol-value onus))))
(and (setf (term-graph-symbol (symbol-value onus))
(rest (term-graph-symbol (symbol-value onus))))
onus)
(if (symbolp (second (term-graph-symbol (symbol-value onus))))
(second (term-graph-symbol (symbol-value onus)))
(term-graph-id (second (term-graph-symbol (symbol-value onus)))))
)))
(defun ComplexCardinalDigit-Q-Code (number)
"Is it less than 10?"
(if (< number 10) 'simplex 'complex))
(defun Conceptual-Correlate-ID-Code (spec) spec)
;(defun Conceptual-Correlate-ID-Code (spec)
; "Get the symbol of this term, unless it's a set."
; (if (and (boundp spec)
; (eq (type-of (symbol-value spec)) 'symbol))
; (symbol-value spec)
; (if (and (boundp spec)
; (not (term-type-p spec 'um-set))
; (eq (type-of (symbol-value spec)) 'term-graph))
; (term-graph-symbol (symbol-value spec))
; spec)))
(defun Concession-Q-Code (reln)
"If the type of RELN is CONCESSIVE...."
(if (term-type-p reln '|concessive|) 'concession 'nonconcession))
(defun Concession-ID-Code (process)
"Return the CONCESSION feature."
(fetch-relation-spec process '|concession| 'Concession-ID))
(defun Concessive-Condition-Q-Code (part1 part2)
"See if the parent is a CONCESSIVE."
(declare (ignore part2))
(if (term-type-p (term-graph-parent (symbol-value part1)) '|uio#RSTConcessive|)
'concessive
'notconcessive))
(defun Concessive-Relation-Q-Code (reln)
"If the type of RELN is CONCESSIVE...."
(if (term-type-p reln '|concessive|) 'concession 'notconcession))
(defun Conditional-Relation-Q-Code (reln)
"If the type of RELN is LOGICAL...."
"Or CONDITION...UM reln added 7/90"
(if (or (term-type-p reln '|Extension|)
(term-type-p reln '|condition|))
'condition
'notcondition))
(defun Conditioning-Q-Code (part1 part2)
"Ask if the conjunctive relation governing the two parts is a conditioning relation."
;(declare (ignore part2))
(if (and (or (term-type-p (term-graph-parent (symbol-value part1)) '|causalRelation|)
(term-type-p (term-graph-parent (symbol-value part1)) '|uio#LogicalCondition|) ;;; REUTERS
(term-type-p (term-graph-parent (symbol-value part1)) '|space#TemporalLocating|) ;;; EX-SET-8
(term-type-p (term-graph-parent (symbol-value part1)) 'static-spatial)
(term-type-p (term-graph-parent (symbol-value part1)) '|generalizedMeans|) ;;; FINANCE DOMAIN
(term-eq-p part2 (fetch-subc-feature '|causalRelation| part1))
(term-eq-p part2 (fetch-subc-feature '|space#TemporalLocating| part1))
(term-eq-p part2 (fetch-subc-feature 'static-spatial part1))) ;;; EX-SET-13
(not (dolist (graph *plan-graphs*)
(if (and (consp (term-graph-symbol (symbol-value graph)))
(member part1 (term-graph-symbol (symbol-value graph)))
(or (term-type-p graph '|UMSet|)
(term-type-p graph '|DisjunctiveSet|)))
(return t)))))
'conditioning
'nonconditioning))
(defun Conjunctive-Extension-Q-Code (initiating continuing)
"If type of continuing is SET, or the pair are elements of a set, then conjunctive.
Also, if INITIATING & CONTINUING are related by CONJUNCTION."
(if (or (term-type-p continuing '|UMSet|)
(term-type-p initiating '|Conjunction|)
(dolist (graph *plan-graphs*)
(if (and (term-type-p graph '|UMSet|)
(not (term-type-p graph '|DisjunctiveSet|)) ;; 2.0
(consp (term-graph-symbol (symbol-value graph)))
; (member initiating (term-graph-symbol (symbol-value graph)))
(member continuing (term-graph-symbol (symbol-value graph))))
(return 't))
(if (and (term-type-p graph '|Conjunction|)
(term-eq-p initiating (fetch-subc-feature '|domain| graph))
(term-eq-p continuing (fetch-subc-feature '|range| graph)))
(return 't))))
'conjunctive
'nonconjunctive))
(defun Conjunctive-Relation-ID-Code (process)
"Two cases: when the conjunctive relation is a feature of the process, and when the
process is a feature (domain or range) of a rhetorical relation."
(or (fetch-subc-feature '|uio#RhetoricalRelation| process)
(fetch-subc-feature-name '|Circumstantial| (term-graph-parent (symbol-value process)))
(term-graph-parent (symbol-value process))))
(defun Conjunctive-Relation-Q-Code (process)
"Is there a conjunctive relation feature?"
(if (and (fetch-subc-feature '|uio#RhetoricalRelation| process)
(not (term-role-p process
(fetch-subc-feature '|uio#RhetoricalRelation| process)
'|uio#RSTMeans|)))
'conjunctive))
(defun Consciousness-Q-Code (obj)
"Is it a conscious being?"
(if (term-type-p obj '|ConsciousBeing|) 'conscious 'nonconscious))
(defun Contrastive-Q-Code (reln)
"Is RELN a CONTRASTIVE?"
;;(if (term-type-p reln '|contrastive|) 'contrastive 'notcontrastive))
(if (term-type-p reln '|uio#RSTContrastive|) 'contrastive 'notcontrastive))
(defun Contrastive-Extension-Q-Code (initiating continuing)
"If type of relation between initiating and continuing is RST-Contrastive"
(declare (ignore initiating))
(if (term-type-p (term-graph-parent (symbol-value continuing)) '|uio#RSTContrastive|)
'contrastive
'noncontrastive))
(defun Countability-Q-Code (thing)
"COUNTABLE if not MASS."
(if (term-type-p thing '|mass|) 'mass 'countable))
(defun Current-Representative-ID-Code (obj) obj)
(defun Dependent-Beta-Theme-Q-Code (dependent spec)
"CONTEXT, if there is a THEME feature in SPEC involving DEPENDENT."
(if (fetch-feature '|theme| spec)
(dolist (theme (term-graph-symbol (symbol-value (fetch-feature '|theme| spec))))
(if (term-eq-p dependent theme)
(return 'context)))))
(defun Destination-Process-Q-Code (locativerelation place)
"Is the relation one of destination?"
(declare (ignore place))
(if (term-type-p locativerelation '|space#destination|)
'destination
'nondestination))
(defun Destination-Q-Code (reln process)
"Is the relation a destination?"
(declare (ignore process))
(if (term-type-p reln '|space#destination|)
'destination
'notdestination))
(defun DigitValue-Q-Code (number)
"just give it back as a word."
(case number
(1 'one)
(2 'two)
(3 'three)
(4 'four)
(5 'five)
(6 'six)
(7 'seven)
(8 'eight)
(9 'nine)
(t 'zero)))
(defun Dimension-ID-Code (property)
"Not clear: for the time being, give the relation of which PROPERTY is the range."
(term-graph-parent (symbol-value property)))
(defun Dimension-Relation-Q-Code (relation range)
"Use type of RANGE."
(let ((dimension (if (term-type-p range '|UMSet|)
(first (term-graph-symbol (symbol-value range)))
range)))
(setf test (cond ((term-type-p dimension '|SpacePoint|) 'ZeroDimension)
((term-type-p dimension '|OneOrTwoDLocation|) 'OneTwoDimension)
((term-type-p dimension '|ThreeDLocation|) 'ThreeDimension)))
test))
(defun Disjunctive-Extension-Q-Code (initiating continuing)
"If type of continuing is DISJUNCTIVE-SET (SPL) or DISJUNCTION (UM), then DISJUNCTIVE."
(if (or (term-type-p continuing '|DisjunctiveSet|)
(term-type-p continuing '|Disjunction|)
(dolist (graph *plan-graphs*)
(if (and (term-type-p graph '|DisjunctiveSet|)
(consp (term-graph-symbol (symbol-value graph)))
; (member initiating (term-graph-symbol (symbol-value graph)))
(member continuing (term-graph-symbol (symbol-value graph))))
(return 't))
(if (and (term-type-p graph '|Disjunction|)
(term-eq-p initiating (fetch-subc-feature '|domain| graph))
(term-eq-p continuing (fetch-subc-feature '|range| graph)))
(return 't))))
'disjunctive
'nondisjunctive))
(defun Disliking-Q-Code (mentalprocess)
"Is it of type LIKING?"
(if (term-type-p mentalprocess '|Disliking|) 'disliking 'nondisliking))
(defun Dual-Process-Part1-ID-Code (onus)
"For rhetorical relations, return DOMAIN (unless it is nil).
For ONUS which is a set, return the next element."
(if (or (term-type-p onus '|uio#RhetoricalRelation|)
(term-type-p onus '|temporalRelation|) ;;; PRIMER-49
(term-type-p onus 'static-spatial) ;;; EX-SET-13
(term-type-p onus '|Conjunction|)
(term-type-p onus '|Disjunction|))
(let* ((result (fetch-feature '|domain| onus)))
(modification-specification-id-code
nil
(if result result
(fetch-feature '|range| onus))))
(if (or (term-type-p onus '|UMSet|)
(term-type-p onus '|DisjunctiveSet|))
(dolist (term (term-graph-symbol (symbol-value onus)))
(if (not (member term *consumed-terms*))
(return term)))
;;; Default for, e.g., temporal roles: after, when, etc.
onus)))
(defun Dual-Process-Part2-ID-Code (onus part1)
"For rhetorical relations, return RANGE.
For ONUS which is a set, return either the last element or ONUS."
(if (or (term-type-p onus '|uio#RhetoricalRelation|)
(term-type-p onus '|temporalRelation|) ;;; PRIMER-49
(term-type-p onus 'static-spatial)
(term-type-p onus '|Conjunction|)
(term-type-p onus '|Disjunction|))
(modification-specification-id-code nil (fetch-feature '|range| onus))
(if (or (term-type-p onus '|UMSet|)
(term-type-p onus '|DisjunctiveSet|))
(if (< (+ (position part1 (term-graph-symbol (symbol-value onus))) 2)
(length (term-graph-symbol (symbol-value onus))))
onus
(first (last (term-graph-symbol (symbol-value onus)))))
(or (fetch-subc-feature '|space#temporalOrdering| onus) ;;; PRIMER-49
(fetch-subc-feature 'static-spatial onus) ;;; EX-SET-13
(fetch-subc-feature '|condition| onus)))))
(defun Duration-Q-Code (reln range)
"Depends on type of RELN."
(declare (ignore range))
(if (term-type-p reln '|exhaustiveDuration|) 'duration
(if (term-type-p reln '|nonExhautiveDuration|) 'nonduration)))
(defun Elaborated-Thing-ID-Code (spec)
"Pick up the DOMAIN of the elaboration."
(fetch-subc-feature '|domain| spec))
(defun Elaborating-Thing-ID-Code (spec)
"Pick up the RANGE of the elaboration."
(fetch-subc-feature '|range| spec))
(defun Elaboration-Q-Code (part1 part2)
"Are PART1 and PART2 related by an ELABORATION?"
(declare (ignore part2))
(if (term-type-p (term-graph-parent (symbol-value part1)) '|uio#RSTElaboration|)
'same
'distinct))
(defun Empty-Gender-Multiplicity-Q-Code (obj)
"First cut: no :favor-q feature & :express-type is NO."
(if (not
(or (fetch-feature 'favor-q obj)
(not (eq (fetch-feature 'express-type obj) 'no))))
'empty))
(defun Empty-Number-Q-Code (obj)
"If EITHER there are no features (or :identifiability identifiable only)
and the goodie has been mentioned before
and nothing more recently mentioned has same number & gender
or it has the most general type
OR :EXPRESS-TYPE is not YES, and MULTIPLICITY-Q is given, then EMPTY."
;;; or it should have been anyway. But making this change causes
;;; far too many empty's to be returned and wrecks lots of examples.
;;; So revert to the original definition. This entire thing should
;;; be overhauled sometime in any case.
(if (or (and (or (null (term-graph-features (symbol-value obj)))
(equal (term-graph-features (symbol-value obj))
'((identifiability-q . identifiable))))
(if (eq obj (first *consumed-terms*))
(or (dolist (term (rest *consumed-terms*) nil)
(if (term-eq-p term obj)
(return t))
(if (and (term-type-p term '|SimpleThing|)
(eq (operator-run `(gender-q ,term))
(operator-run `(gender-q ,obj)))
(eq (operator-run `(multiplicity-q ,term))
(operator-run `(multiplicity-q ,obj))))
(return nil)))
(eq (term-graph-type (symbol-value obj)) 'thing))))
(and (eq (fetch-feature 'express-type obj) 'no)
(fetch-feature 'multiplicity-q obj)))
'empty))
(defun Enabling-Q-Code (manner process)
"Is MANNER an ENABLEMENT?"
(declare (ignore process))
(if (term-type-p manner '|enablement|) 'enabling 'nonenabling))
(defun Event-Q-Code (item)
(if (term-type-p item '|Process|) 'event 'object))
(defun Example-Elaboration-Q-Code (one two)
"If the parent is an EXEMPLIFICATION...."
(declare (ignore two))
(if (term-type-p (term-graph-parent (symbol-value one)) '|uio#Exemplification|)
'example
'notexample))
(defun Exceed-Q-Code (one two)
"Depends on the kind of parent relation."
(if (or (and (term-type-p (term-graph-parent (symbol-value one)) '|GreaterThanComparison|)
(term-role-p (term-graph-parent (symbol-value one)) one '|greater|))
(and (term-type-p (term-graph-parent (symbol-value two)) '|LessThanComparison|)
(term-role-p (term-graph-parent (symbol-value two)) two '|lesser|)))
'exceed
'nonexceed))
(defun Existent-ID-Code (reln)
"Return the DOMAIN."
(fetch-subc-feature '|participantInConfiguration| reln))
(defun Exist-Speech-Act-Q-Code (onus)
"SPEECHACT, if PROCESS"
;;; (if (or (term-type-p onus '|Process|)
(if (or (term-type-p onus '|Configuration|)
(and (term-type-p onus '|UMSet|)
;;; (term-type-p (first (term-graph-symbol (symbol-value onus))) '|Process|)))
(term-type-p (first (term-graph-symbol (symbol-value onus))) '|Configuration|)))
'Speechact 'nospeechact))
(defun Existential-Q-Code (reln)
"We just look to see if the variable--a relation--is an existence."
(if (term-type-p reln '|Existence|) 'existential 'nonexistential))
(defun Exists-Focuser-Q-Code (process)
"Look for a LOGICAL-PROPERTY-ASCRIPTION feature."
(if (fetch-feature '|LogicalPropertyAscription| process) 'focuser-exists))
(defun Experiential-Complexity-Q-Code (arg)
"Experientially complex if arg is a set. Then we express each member."
(if (and (boundp arg)
(typep (symbol-value arg) 'term-graph)
(or (and (term-type-p arg '|UMSet|)
(consp (term-graph-symbol (symbol-value arg))) ;;; EX-SET-10
(not (and (eq 'included (member-set-q-code '|speaker| arg)) ;;; EX-SET-13
(eq 'included (member-set-q-code '|hearer| arg)))))
(term-type-p arg '|Conjunction|)
(term-type-p arg '|Disjunction|)
(term-type-p arg '|DisjunctiveSet|)))
'complex
'simplex))
(defun Express-Hearer-Q-Code (hearer onus)
"Depends on the speech-act type of ONUS."
(declare (ignore hearer))
(if (term-type-p (fetch-feature '|uio#SpeechAct| onus) '|uio#Question|)
'expresshearer
'withholdhearer))
(defun Extent-Q-Code (reln)
"We just look to see if the variable--a relation--is an extent."
(if (term-type-p reln '|extent|) 'extent 'nonextent))
(defun Extracted-Variable-ID-Code (process)
"If NOT a process involved in a RHETORICAL-RELATION, get the parent term.
If it is such a process, identify a point of overlap."
(if (and (boundp process)
(typep (symbol-value process) 'term-graph))
(if (term-type-p (term-graph-parent (symbol-value process)) '|uio#RhetoricalRelation|)
(first
(intersection
(remove nil
(mapcar #'(lambda (a-feature)
(if (or (term-type-p (first a-feature) '|participantInConfiguration|)
(term-type-p (first a-feature) '|place|))
(term-graph-symbol (rest a-feature))))
(term-graph-features (symbol-value process))))
(remove nil
(mapcar #'(lambda (a-feature)
(if (or (term-type-p (first a-feature) '|participantInConfiguration|)
(term-type-p (first a-feature) '|place|)
(term-type-p (first a-feature) '|BeingANDHaving|));;;To pick up other connexions
(term-graph-symbol (rest a-feature))))
(term-graph-features
(symbol-value
(fetch-subc-feature
'|domain|
(term-graph-parent (symbol-value process)))))))))
(term-graph-symbol (symbol-value (term-graph-parent (symbol-value process)))))
(term-graph-symbol (symbol-value (term-graph-parent (get-symbol-term process))))))
(defun Favor-Q-Code (object feature)
"Look for a name feature, or a date."
(case feature
(propernoun
(if (or (fetch-feature '|Name| object)
(term-type-p object '|date|))
'classify 'outclassify))
(t nil)))
(defun Fearing-Q-Code (mentalprocess)
"Is it of type FEARING?"
(if (term-type-p mentalprocess '|Fearing|) 'fearing 'nonfearing))
(defun Focuser-ID-Code (process)
"Return the LOGICAL-PROPERTY-ASCRIPTION feature."
(fetch-feature '|LogicalPropertyAscription| process))
(defun Formal-Register-Q-Code (reln)
"Look for a between feature."
(if (term-type-p reln '|formal| ) 'formal 'nonformal))
(defun Gender-Q-Code (obj)
"Go by types MALE and FEMALE, otherwise NEUTRAL."
(if (term-type-p obj '|Female|) 'female
(if (term-type-p obj '|Male|) 'male
'neutral)))
(defun General-Subclass-Q-Code (item)
(when (fetch-feature '|ClassAscription| item) 'subclass))
(defun Generalization-Direction-Q-Code (conjunctive)
"Depends on nature of CONJUNCTIVE."
(if (term-type-p conjunctive '|Elaboration|) 'example 'generalization))
(defun Generalized-Modification-Q-Code (object)
"Is there any kind of modification (ascription, possession)?"
(if (or (fetch-relation '|PropertyAscription| object)
(fetch-relation '|GeneralizedPossession| object)
(functional-role-p object))
'possessor))
(defun Hearer-ID-Code (onus)
"Return the HEARER feature?"
(fetch-feature '|hearer| onus))
(defun Horizontal-Orientation-Q-Code (reln range)
"Use the type of RELN."
;(declare (ignore range))
(setf t1 (fetch-subc-feature '|space#hasSpatialModality| range))
(when (not t1) (setf t1 (fetch-feature '|space#hasSpatialModality| (fetch-subc-feature '|attribute| range))) )
(if (term-type-p t1 '|space#FrontalProjection|) 'facing
(if (term-type-p t1 '|space#BackProjection|) 'behind)))
(defun Hundred-Digit-ID-Code (number)
"Return the number of hundreds."
(floor (mod number 1000) 100))
(defun Hundred-Digit-Q-Code (number)
"Only if greater than 99."
(if (> number 99) 'yes 'no))
(defun Hundred-Position-ID-Code (number)
"Return the integer part of the quotient, mod thousands."
(floor (mod number 1000) 100))
(defun Hundred-Position-Q-Code (entity)
"Only if greater than 99."
(if (or (and (> entity 1000)
(> (- entity (* (floor entity 1000) 1000)) 99))
(and (< entity 1000)
(> entity 99)))
'hundredposition
'nothundredposition))
(defun Hundred-Unit-Q-Code (entity)
"Only if greater than 100."
(if (>= entity 100) 'hundred 'nothundred))
(defun Identifiability-Q-Code (item &optional (recursive-limit nil))