-
Classify
-
Sentiment
-
Entity
Classify
The Text Classification service allows you to perform the classification of many text samples using only one request to a custom or public module.
Service URL
https: //api.cognitus.ai/api/v1/classify
Method:
POST
Request Header
Authorization: Token [Token]
Usage
A JSON type is expected in the input tree. In the “module_id” section, the id of module defined by the user should written. In the “text” section, the text to be classified should be written.
Response Titles:
HTTP/1.1 200 OK Allow: POST, OPTIONS Content-Type: tr Content-Type: application/json Date: Wed, 09 Jun 2017 08:36:13 GMT Server: nginx/1.10.0 Vary: Accept-Language, Cookie X-Frame-Option: SAMEORIGIN Content-Length: 115 Connection: keep-alive
Sample Request:
{ "module_id": "[MODULE_ID]", "text": "I have a problem with my internet connection" }
Curl Request Example
curl -X POST -H "Authorization:Token [Token]" \ -H "Content-Type: application/json" \ -d '{"module_id":"[MODULE_ID]", "text": "I have a problem with my internet connection" }' \ -D - \ https://api.cognitus.ai/api/v1/classify/
Response
Text classification outputs consist of “category” and “probability”. The category of the text is stored in “category”, the probability of the classification is stored in “probability”.
Sample Response:
{ "results":[ { "category":"Trouble", "probability":89 }, { "category":"Subscription", "probability":11 } ] }
Sentiment
The Sentiment Analysis service allows you to perform sentiment analysis from many text samples by sending only one request to a module.
Service URL
https://api.cognitus.ai/api/v1/sentiment
Method:
POST
Request Header
Authorization: Token [Token]
Usage
A JSON type is expected in the input tree. In the “text” section, the text for which sentiment analysis is desired should be written.
Sample Request:
{ "text":"Cognitus analyzes are quite successful." }
Curl Request Sample
curl -X POST -H "Authorization:Token [Token]" \ -H "Content-Type: application/json" \ -d '{"text": "Cognitus analyzes are quite successful.}' \ -D - \ https://api.cognitus.ai/api/v1/sentiment/
Response Titles:
HTTP/1.1 200 OK Allow: POST, OPTIONS Content-Type: tr Content-Type: application/json Date: Wed, 21 June 2017 08:29:44 GMT Server: nginx/1.10.0 Vary: Accept-Language, Cookie X-Frame-Option: SAMEORIGIN Content-Length: 17 Connection: keep-alive
Response
Sentiment analysis output is “positive” if the sentence is positive; output is “negative” if the sentence is negative.
Output Responses
HTTP/1.1 200 OK Allow: POST, OPTIONS Content-Type: tr Content-Type: application/json Date: Wed, 21 Jun 2017 08:33:35 GMT Server: nginx/1.10.0 Vary: Accept-Language, Cookie X-Frame-Option: SAMEORIGIN Content-Length: 66 Connection: keep-alive
Sample Response:
{"polarity":0.79}
Entity
The Name Entity Recognition service allows you to identify entity names by extracting the person, organization and location information in a text and responses them.
Service URL
https://api.cognitus.ai/api/v1/entity
Method:
POST
Request Header
Authorization: Token [Token]
Usage
A JSON type is expected in the input tree. In the “text” section, the text for which name entity recognition is desired should be written.
Example Request:
{ "text":":"We will be meeting between Yilmaz Bey and Company X in Istanbul." }
Curl Request Sample
curl -X POST -H "Authorization:Token [Token]" \
-H "Content-Type: application/json" \
-d '{"text": ":"We will be meeting between Yilmaz Bey and Company X in Istanbul."}' \
-D - \
https://api.cognitus.ai/api/v1/entity/
Response
Data is identified as I-PER, I-ORG, and I-LOC which correspond to person, organization and location respectively.
Response Titles:
HTTP/1.1 200 OK Allow: POST, OPTIONS Content-Type: tr Content-Type: application/json Date: Wed, 21 Jun 2017 08:33:35 GMT Server: nginx/1.10.0 Vary: Accept-Language, Cookie X-Frame-Option: SAMEORIGIN Content-Length: 66 Connection: keep-alive
Sample Response:
[ [ "Yılmaz", "I-PER" ], [ "X Company", "I-ORG" ], [ "Istanbul", "I-LOC" ] ]