File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,17 @@ type Match struct {
55 Confidence float64
66}
77
8+ type CMatch struct {
9+ Name string
10+ Value interface {}
11+ }
12+
813type Matcher struct {
9- Entity Match
10- Intent Match
11- AND * Matcher
12- OR * Matcher
14+ Entity Match
15+ Intent Match
16+ ContextVariable CMatch
17+ AND * Matcher
18+ OR * Matcher
1319}
1420
1521func (out * Output ) Match (matcher * Matcher ) bool {
@@ -26,6 +32,16 @@ func (out *Output) Match(matcher *Matcher) bool {
2632 }
2733 }
2834
35+ if out .Context .Variables != nil {
36+ for varName , varValue := range out .Context .Variables {
37+ if matcher .ContextVariable .Name == varName {
38+ if matcher .ContextVariable .Value == varValue {
39+ ok = true
40+ }
41+ }
42+ }
43+ }
44+
2945 if matcher .AND != nil {
3046 if out .Match (matcher .AND ) && ok {
3147 ok = true
Original file line number Diff line number Diff line change 11package neocortex
22
3- func (out * Output ) AddContextVariable (name string , value interface {}) * Output {
3+ func (out * Output ) SetContextVariable (name string , value interface {}) * Output {
44 if out .Context .Variables == nil {
55 out .Context .Variables = map [string ]interface {}{}
66 }
You can’t perform that action at this time.
0 commit comments