-
Notifications
You must be signed in to change notification settings - Fork 28
/
interaction-rules.scm
112 lines (89 loc) · 2.21 KB
/
interaction-rules.scm
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
;; File: interaction-rules.scm
;; ;; Author: Eskender Besrat <[email protected]>
;; ;; License: AGPL
;; ;; Date: May, 2018
;;; -----------------------------------------------
;;; This file contains dynamic interaction rules
;;; Mainely triggered by the occurrence of events
;;; Need to be loaded after events.scm
;; ------------------------------------------------
;; Functions used by interaction rules
; The following two are used by face detection rule
(define (antecedent-face)
(if (= (psi-get-number-value event-face) 1)
(stv 1 1)
(stv 0 1)
)
)
; If face is detected set Ghost input to trigger speech output
; This is for the time being until Ghost is able to process non-speech input
(define (consequent-face)
; test-ghost is used for the time being
(test-ghost "inner msg face is detected")
; Return Meaningless atom
(Concept "")
)
; Used by smile detection rule
(define (antecedent-smile)
(if (= (psi-get-number-value event-smile) 1)
(stv 1 1)
(stv 0 1)
)
)
(define (consequent-smile)
; test-ghost is used for the time being
(test-ghost "inner msg smile is detected")
; Return Meaningless atom
(Concept "")
)
; Used by saliency detection
(define (antecedent-saliency)
(if (= (psi-get-number-value event-saliency) 1)
(stv 1 1)
(stv 0 1)
)
)
(define (consequent-saliency)
; test-ghost is used for the time being
(test-ghost "inner msg saliency is detected")
; Return Meaningless atom
(Concept "")
)
;; ----------------------------------------------------
;; Interaction rules
; Interaction rule for face detection
(psi-create-general-rule
; Antecedent
(EvaluationLink
(GroundedPredicateNode "scm: antecedent-face")
(List)
)
; Consequent
(GroundedSchemaNode "scm: consequent-face")
; Params
(List)
)
; Interaction rule for smile detection
(psi-create-general-rule
; Antecedent
(EvaluationLink
(GroundedPredicateNode "scm: antecedent-smile")
(List)
)
; Consequent
(GroundedSchemaNode "scm: consequent-smile")
; Params
(List)
)
; Interaction rule for saliency detection
(psi-create-general-rule
; Antecedent
(EvaluationLink
(GroundedPredicateNode "scm: antecedent-saliency")
(List)
)
; Consequent
(GroundedSchemaNode "scm: consequent-saliency")
; Params
(List)
)