Example post for answers with evidence
In this example, you ask for evidence to be returned with the answers from Watson. To get the API to return evidence for a particular answer, you include an evidence request with the question.
Post the question
When you ask IBM Watson™ a question, the system processes the question to find the answer. Part of that processing involves identifying one or more documents within the knowledge base that contain the answer. The document snippets that show the answer in context are referred to as evidence passages. The Question and Answer REST service returns the background passages for each answer.
The basic example for posting question included only the questionText. This JSON example includes the evidenceRequest element with two attributes: items and profile. The value of 1 for the items attribute specifies one supporting passage for each answer. The evidence profile identifies the sources of the evidence and is returned in this example:
{
"question":{
"questionText":"His 1983 hit \"Beat it\" featured Eddie Van Halen on guitar."
"evidenceRequest":{"items":1,"profile":"yes"}}
}
}
Here is the same question that is submitted as XML:
<p>
<question>
<questionText>"His 1983 hit \"Beat it\" featured Eddie Van Halen on guitar."</questionText>
<evidenceRequest items="1" profile="yes" />
</question>
</p>
Receive the response
In the response, the evidenceProfile element contains the sources for the evidence and is unique to the Watson pipeline for which it was configured. The evidence passage and related information is contained in the evidence section.
{
"question": {
"qclasslist": [
{
"value": "FACTOID"
}
],
"focuslist": [
{
"value": "His"
}
],
"latlist": [
{
"value": "he"
}
],
"pipelineid": "433259107",
"category": "",
"items": 5,
"status": "Complete",
"id": "AE71A54A2BED4AE7BAAEEA98764ECB47",
"questionText": "His 1983 hit \"Beat it\" featured Eddie Van Halen on guitar.",
"evidenceRequest": {
"items": 1,
"profile": "YES"
},
"answers": [
{
"id": 0,
"text": "Michael Jackson",
"confidence": 0.42276
"evidenceProfile": [
{
"name": "FeatureGroup_Linguistic",
"value": "0.9999993141075441"
},
{
"name": "FeatureGroup_Type",
"value": "2.9766025382203176E-7"
},
{
"name": "FeatureGroup_Spatio-temporal",
"value": "1.8527814689180015E-7"
},
{
"name": "FeatureGroup_Relevance",
"value": "2.0295405528818982E-7"
}
],
"evidence": [
{
"document": "http://myhost.example.com:8080/deepqa/v1/question/document
/611396/48/50",
"id": "611396",
"title": "Rick Derringer",
"text": "He played guitar or mandolin with \"Weird Al\" on many albums.
For example, he offered both an homage and parody to Eddie Van Halen
when we played the guitar solo on the track \"Eat It.\" Van Halen
played the solo in \"Beat It\" on a Michael Jackson album.",
"copyright": "http://en.example.org/wiki/Copyrights",
"termsOfUse": "http://en.example.org/wiki/Terms"
}
]
},
{
"id": 1,
"text": "Rick Derringer",
"confidence": 0.22121
"evidenceProfile": [
{
"name": "FeatureGroup_Linguistic",
"value": "0.9999992097788784"
},
{
"name": "FeatureGroup_Type",
"value": "3.343194026679231E-7"
},
{
"name": "FeatureGroup_Spatio-temporal",
"value": "1.9799165313408648E-7"
},
{
"name": "FeatureGroup_Relevance",
"value": "2.579100657814232E-7"
}
],
"evidence": [
{
"document": "http://myhost.example.com:8080/deepqa/v1/question/document
/243536/86/88",
"id": "243536",
"title": "Music of Louisiana",
"text": "Danny Johnson has been the guitarist in Steppenwolf for the last 16
years. He has performed with many of the greats, including Rod
Stewart, Rick Derringer, (Eddie Van Halens) Private Life, Danny
Johnson and the Bandits, and Axis.",
"copyright": "http://en.example.org/wiki/Copyrights",
"termsOfUse": "http://en.example.org/wiki/Terms"
}
]
},
{
"id": 2,
"text": "Thriller",
"confidence": 0.12293
"evidenceProfile": [
{
"name": "FeatureGroup_Linguistic",
"value": "0.9999993127936775"
},
{
"name": "FeatureGroup_Type",
"value": "3.0981451898308303E-7"
},
{
"name": "FeatureGroup_Spatio-temporal",
"value": "1.6811651172801184E-7"
},
{
"name": "FeatureGroup_Relevance",
"value": "2.0927529166792349E-7"
}
],
"evidence": [
{
"document": "http://myhost.example.com:8080/deepqa/v1/question/document/
1287699/82/83",
"id": "1287699",
"title": "1984 (Van Halen album)",
"text": "The album 1984 made it to #2 on the Billboard charts. Thriller,
by Michael Jackson was number one, and featured Van Halen on solo
for the track \"Beat It.\"",
"copyright": "http://en.example.org/wiki/Copyrights",
"termsOfUse": "http://en.example.org/wiki/Terms"
}
]
},
{
"id": 3,
"text": "Jeff Porcaro",
"confidence": 0.09981
"evidenceProfile": [
{
"name": "FeatureGroup_Linguistic",
"value": "0.9999992183919334"
},
{
"name": "FeatureGroup_Type",
"value": "3.3287720392044685E-7"
},
{
"name": "FeatureGroup_Spatio-temporal",
"value": "1.9713754980690284E-7"
},
{
"name": "FeatureGroup_Relevance",
"value": "2.5159331287407007E-7"
}
],
"evidence": [
{
"document": "http://myhost.example.com:8080/deepqa/v1/question/document/
9752690/23/24",
"id": "9752690",
"title": "Lukather",
"text": "In addition to Toto members Jeff Porcaro and David Paich, Eddie
Van Halen, Steve Stevens, Richard Marx, Jan Hammer also worked on
Lukather. ",
"copyright": "http://en.example.org/wiki/Copyrights",
"termsOfUse": "http://en.example.org/wiki/Terms"
}
]
},
{
"id": 4,
"text": "Quincy Jones",
"confidence": 0.05383
"evidenceProfile": [
{
"name": "FeatureGroup_Linguistic",
"value": "0.9999992965709585"
},
{
"name": "FeatureGroup_Type",
"value": "3.0864687031138067E-7"
},
{
"name": "FeatureGroup_Spatio-temporal",
"value": "1.7915949516887396E-7"
},
{
"name": "FeatureGroup_Relevance",
"value": "2.1562267602537032E-7"
}
],
"evidence": [
{
"document": "http://myhost.example.com:8080/deepqa/v1/question/document
/26496842/272/273",
"id": "26496842",
"title": "Eddie Van Halen",
"text": "Quincy Jones invited Eddie van Halen to play the guitar solo
on \"Beat It,\" for Michael Jackson's album Thriller. ",
"copyright": "http://en.example.org/wiki/Copyrights",
"termsOfUse": "http://en.example.org/wiki/Terms"
}
]
}
],
"errorNotifications": [],
"passthru": ""
}
}
Leave a comment