Skip to content
This repository was archived by the owner on Aug 12, 2022. It is now read-only.

Commit 25943c0

Browse files
committed
feat(core) add processing_language in Conversation model
1 parent 9c98271 commit 25943c0

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

src/Conversation.php

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ public function __construct($json)
1414
// var_dump($json);
1515
$response = json_decode($json->body);
1616

17-
$this->raw = $response->results;
17+
$this->raw = $response->results;
1818
$this->replies = $response->results->replies;
1919
$this->action = $response->results->action;
2020
$this->nextActions = $response->results->next_actions;
21+
$this->sentiment = $response->results->sentiment;
2122
$this->memory = $response->results->memory;
2223
$this->conversationToken = $response->results->conversation_token;
24+
$this->language = $response->results->language;
25+
$this->processing_language = $response->results->processing_language;
2326
}
2427

2528
/**
@@ -92,6 +95,49 @@ public function memory($name = null)
9295
}
9396
}
9497

98+
/**
99+
* SENTIMENT HELPERS
100+
* Returns whether or not the response sentiment corresponds to the checked one
101+
* @return {boolean}: true or false
102+
*/
103+
104+
public function isPositive()
105+
{
106+
return ($this->sentiment === Constants::SENTIMENT_POSITIVE);
107+
}
108+
109+
/**
110+
* @return bool
111+
*/
112+
public function isNeutral()
113+
{
114+
return ($this->sentiment === Constants::SENTIMENT_NEUTRAL);
115+
}
116+
117+
/**
118+
* @return bool
119+
*/
120+
public function isNegative()
121+
{
122+
return ($this->sentiment === Constants::SENTIMENT_NEGATIVE);
123+
}
124+
125+
/**
126+
* @return bool
127+
*/
128+
public function isVPositive()
129+
{
130+
return ($this->sentiment === Constants::SENTIMENT_VPOSITIVE);
131+
}
132+
133+
/**
134+
* @return bool
135+
*/
136+
public function isVNegative()
137+
{
138+
return ($this->sentiment === Constants::SENTIMENT_VNEGATIVE);
139+
}
140+
95141
/**
96142
* Merge the conversation memory with the one in parameter
97143
* Returns the memory updated

0 commit comments

Comments
 (0)