Relations

Overview

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
    1. Is Positive
    2. Is Negative
    3. Is Question
    4. Subject
    5. Object
    6. Entity
    7. 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.

URLDescription
PUT /textanalysis/v1/relationsPut 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

{
    "url": "<SAMPLE_URL>"
}
OR{
    "text": "<SAMPLE_TEXT>"
}

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.

NameTypeDescription
statusStringRequest Status (Reference: Status & Error Codes ).
uidStringUID 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:

NameTypeDescription
statusStringRequest Status (Reference: Status & Error Codes ).
relationsJSONArrayObject contains analysis of each sentence.
sentenceStringSingle sentence from Article/Text.
knowledgeArray of
JSONObject
Contains knowledge parameter of sentence.
knowledge.isNegativeBooleanTrue, If sentence indicates negative tone.
knowledge.isSentence.BooleanTrue, If sentence does not indicate question tone.
knowledge.isQuestionBooleanTrue, If sentence indicates question tone.
knowledge.subjectStringSubject extracted from the sentence.
knowledge.actionStringAction suggested by the sentence.
knowledge.objectStringObject extracted from the sentence.
knowledge.supportClauseStringSupport clause of the sentence.
knowledge.tenseStringTense of the sentence. (Reference: Tense Codes )
knowledge.entityJSONArray StringList of entities which are detected in sentence.
knowledge.answerTypeJSONObjectAnswer related information.
knowledge.answerType.answerTypeStringIf 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.StringIf 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”: []
}]
}]
}