@@ -21,9 +21,11 @@ public function __construct($token, $responseBody)
21
21
$ this ->next_actions = $ responseBody ->next_actions ;
22
22
$ this ->memory = $ responseBody ->memory ;
23
23
$ this ->entities = $ responseBody ->entities ;
24
+ $ this ->sentiment = $ responseBody ->sentiment ;
24
25
$ this ->intents = $ responseBody ->intents ;
25
26
$ this ->conversation_token = $ responseBody ->conversation_token ;
26
27
$ this ->language = $ responseBody ->language ;
28
+ $ this ->processing_language = $ responseBody ->processing_language ;
27
29
$ this ->version = $ responseBody ->version ;
28
30
$ this ->timestamp = $ responseBody ->timestamp ;
29
31
$ this ->status = $ responseBody ->status ;
@@ -83,6 +85,49 @@ public function nextActions()
83
85
return ($ this ->nextActions ? $ this ->nextActions : []);
84
86
}
85
87
88
+ /**
89
+ * SENTIMENT HELPERS
90
+ * Returns whether or not the response sentiment corresponds to the checked one
91
+ * @return {boolean}: true or false
92
+ */
93
+
94
+ public function isPositive ()
95
+ {
96
+ return ($ this ->sentiment === \RecastAI \Constants::SENTIMENT_POSITIVE );
97
+ }
98
+
99
+ /**
100
+ * @return bool
101
+ */
102
+ public function isNeutral ()
103
+ {
104
+ return ($ this ->sentiment === \RecastAI \Constants::SENTIMENT_NEUTRAL );
105
+ }
106
+
107
+ /**
108
+ * @return bool
109
+ */
110
+ public function isNegative ()
111
+ {
112
+ return ($ this ->sentiment === \RecastAI \Constants::SENTIMENT_NEGATIVE );
113
+ }
114
+
115
+ /**
116
+ * @return bool
117
+ */
118
+ public function isVPositive ()
119
+ {
120
+ return ($ this ->sentiment === \RecastAI \Constants::SENTIMENT_VPOSITIVE );
121
+ }
122
+
123
+ /**
124
+ * @return bool
125
+ */
126
+ public function isVNegative ()
127
+ {
128
+ return ($ this ->sentiment === \RecastAI \Constants::SENTIMENT_VNEGATIVE );
129
+ }
130
+
86
131
/**
87
132
* Returns the memory matching the alias
88
133
* or all the memory if no alias provided
0 commit comments