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

Class Response

Jasmine Anteunis edited this page Jan 15, 2019 · 2 revisions

Instantiation

A Response is generated after a call to either textRequest or fileRequest Client methods.

Attributes

An instance of the Response class provides each of the following attributes:

Attributes Type
raw String: the raw unparsed json response
uuid String: the uuid of the request
source String: the user input
intents Array[object]: all the matched intents
act String: the act of the processed sentence
type String: the type of the processed sentence
sentiment String: the sentiment of the processed sentence
entities Array[Entity]: the array of entities
language String: the language of the input
version String: the version of the json
timestamp String: the timestamp at the end of the processing
status String: the status of the response

Methods

Get the first detected intent

Method Params Return
getIntent() Object: the first detected intent
Response reponse = client.textRequest(YOUR_TEXT);
Intent intent = reponse.getIntent();

Act helpers

Method Params Return
isAssert() Bool: whether or not the act is an assertion
isCommand() Bool: whether or not the act is a command
isWhQuery() Bool: whether or not the act is a question
isYnQuery() Bool: whether or not the act is a query

Type helpers

Method Params Return
isAbbreviation() Bool: whether or not the sentence is asking for an abbreviation
isEntity() Bool: whether or not the sentence is asking for an entity
isDescription() Bool: whether or not the sentence is asking for a description
isHuman() Bool: whether or not the sentence is asking for a human
isLocation() Bool: whether or not the sentence is asking for a location
isNumber() Bool: whether or not the sentence is asking for a number

Sentiment helpers

Method Params Return
isVPositive() Bool: whether or not the sentiment is very positive
isPositive() Bool: whether or not the sentiment is positive
isNeutral() Bool: whether or not the sentiment is neutral
isNegative() Bool: whether or not the sentiment is negative
isVNegative() Bool: whether or not the sentiment is very negative