Relations
Overview
A relationship extraction task requires the detection and classification of semantic relationship mentions within a set of artifacts, typically from text or XML documents.
Get Relations Using Catalyst UI
- Goto AmplifyReach Dashboard -> Bot Studio -> Left Navigation Sidebar
- Select Core Services > Text Analysis.
- Select URL or Text tab to enter the link or text for Text Analysis.
- Press Analyze button.
- Text Analysis Results will be shown.
- Check Relation section to find out relations identified by Text Analysis.
- For Developers, you can view JSON by clicking </> View JSON on right corner.
- Following relations are detected
- Is Positive
- Is Negative
- Is Question
- Subject
- Object
- Entity
- Answer Type
Extracting Relations Using AmplifyReach Catalyst API
Tip: Register your account on AmplifyReach and contact us at kick-start@amplifyreach.com to get Developer ID and Access Token.
URL & Objects
The following URLs are available.
URL | Description |
---|---|
PUT /textanalysis/v1/relations | Put URL Article/Text for relation analysis of sentence/entities |
GET /textanalysis/v1/relations/{UID} | Get relation of sentence/entities from URL Article/Text |
PUT /textanalysis/v1/relations
PUT https://launch.amplifyreach.com/textanalysis/v1/relations
Headers:
Name | Description |
---|---|
Content-Type | application/json |
authToken | YOUR_DEVELOPER_ACCESS_TOKEN |
cid | YOUR_DEVELOPER_ID |
PUT body
{ | OR | { |
cURL-PUT Request for URL Request
curl \
-H "Content-Type: application/json" \
-H "cid:<YOUR_DEVELOPER_ID>" \
-H "authtoken:<YOUR_DEVELOPER_ACCESS_TOKEN>" \
-X PUT \
-d '{"url":"<SAMPLE_URL_FOR_ANALYSIS>"}'\
https://launch.amplifyreach.com/textanalysis/v1/relations
cURL-PUT Request for Text Request
curl \
-H “Content-Type: application/json” \
-H “cid:” \
-H “authtoken:” \
-X PUT \
-d ‘{“text”:””}’ \
https://launch.amplifyreach.com/textanalysis/v1/relations
Put Response
The taxonomy put API response JSON structure.
Name | Type | Description |
---|---|---|
status | String | Request Status (Reference: Status & Error Codes ). |
uid | String | UID is unique request identifier ID which to get result in Get API. |
Example: PUT Response
{
“status”:”success”,
“uid”:”4f057e01d88ff7aa82a8610dc651e8fe”,
“license”:”By accessing AmplifyReach or using information generated by AmplifyReachAPI,
you are agreeing to be bound by the AmplifyReach Terms of Use.”
}
GET /textanalysis/v1/relations/{UID}
GET https://launch.amplifyreach.com/textanalysis/v1/relations/{UID}
Headers:
Name | Description |
---|---|
Content-Type | application/json |
authToken | YOUR_DEVELOPER_ACCESS_TOKEN |
cid | YOUR_DEVELOPER_ID |
cURL-GET Request for URL Request
Response Time:
Free Trial Account
– For URL as a payload, you can retrieve response after 10 seconds
– For Text as a payload, you can retrieve response after 1 seconds
Paid account:
– Higher QPS as per applicable plan
curl \
-H “Content-Type: application/json” \
-H “cid:” \
-H “authtoken:” \
-X GET \
https://apps.amplifyreach.com/textanalysis/v1/relations/{UID}
Relations Object
The relations response JSON structure:
Name | Type | Description |
---|---|---|
status | String | Request Status (Reference: Status & Error Codes ). |
relations | JSONArray | Object contains analysis of each sentence. |
sentence | String | Single sentence from Article/Text. |
knowledge | Array of JSONObject | Contains knowledge parameter of sentence. |
knowledge.isNegative | Boolean | True, If sentence indicates negative tone. |
knowledge.isSentence. | Boolean | True, If sentence does not indicate question tone. |
knowledge.isQuestion | Boolean | True, If sentence indicates question tone. |
knowledge.subject | String | Subject extracted from the sentence. |
knowledge.action | String | Action suggested by the sentence. |
knowledge.object | String | Object extracted from the sentence. |
knowledge.supportClause | String | Support clause of the sentence. |
knowledge.tense | String | Tense of the sentence. (Reference: Tense Codes ) |
knowledge.entity | JSONArray String | List of entities which are detected in sentence. |
knowledge.answerType | JSONObject | Answer related information. |
knowledge.answerType.answerType | String | If isQuestion is true, Then it will return what type of answer is expected. e.g. yes_no, number_count, description, location etc. |
knowledge.answerType.answerReferance. | String | If answer type is number_count, quantity is related to object/entity. e.g. How many days are required to complete task. answerType: number_count answerReferance: days |
Example: Relations Object
Example-1
{
“status”: “success”,
“relations”: [{
“sentence”: “I want to book ticket from Mumbai to Pune.”,
“knowledge”: [{
“isNegative”: false,
“isSentence”: true,
“isQuestion”: false,
“tense”: “SPR”,
“subject”: “I”,
“action”: “book”,
“object”: “ticket”,
“supportedClause”: “from Mumbai”,
“entity”: [“Mumbai”, “Pune”]
}]
}]
}
Example-2
{
“status”: “success”,
“relations”: [{
“sentence”: “His fingers poised over the keys several times as if he were going to type more.”,
“knowledge”: [{
“isNegative”: false,
“isSentence”: true,
“isQuestion”: false,
“subject”: “His fingers”,
“action”: “poised”,
“object”: “several times”,
“supportedClause”: “over the keys”,
“entity”: []
},
{
“isNegative”: false,
“isSentence”: true,
“isQuestion”: false,
“subject”: “He”,
“action”: “type”,
“object”: “more”,
“entity”: []
}]
}]
}
Example-3
{
“status”: “success”,
“relations”: [{
“sentence”: “How many days are required to complete this task”,
“knowledge”: [{
“isNegative”: false,
“isSentence”: false,
“isQuestion”: true,
“action”: “complete”,
“object”: “this task”,
“answerType”: {
“answerType”: “number_count”,
“answerReferance”: “days”
},
“entity”: []
}]
}]
}
Example-4
{
“status”: “success”,
“relations”: [{
“sentence”: “I am buying Ice Cream, Do you want?”,
“knowledge”: [{
“isNegative”: false,
“isSentence”: true,
“isQuestion”: false,
“subject”: “I”,
“action”: “buying”,
“object”: “Ice Cream”,
“entity”: []
},
{
“isNegative”: false,
“isSentence”: false,
“isQuestion”: true,
“subject”: “you”,
“action”: “want”,
“answerType”: {
“answerType”: “yes_no”,
“answerReferance”: “days”
},
“entity”: []
}]
}]
}