GetQueryBasedSummary input: string Query, string[] Documents, enum DocumentFormat, int SummaryLength output: Summary[] QueryBasedSummaryResult
Takes as an input a Query, a list of Documents and their DocumentFormat : text or URL.
The document content is then summarized to a given SummaryLength, i.e. the number of core paragraphs to extract as a summary.
Paragraphs, in which the Query appears are given preference.
Summary stores a collection of Paragraph.
Paragraph stores an Id and Score, and a collection of Sentence.
Sentence stores an Id, Score, Text and the Marked up sentence.
See also Document summarization.
Sample code in C#:
PingarAPIRequest request = new PingarAPIRequest();
request.AppID = "your app id";
request.AppKey = "your app key";
request.SearchSupport = new SearchSupportRequest();
request.SearchSupport.Query = "sample query";
request.SearchSupport.SummaryLength = 3;
request.SearchSupport.Documents = new string[] { "document text" };
request.SearchSupport.DocumentsFormat = DocumentFormat.Text;
request.Language = Language.EN;
PingarAPIServiceSoapClient pingarAPI = new PingarAPIServiceSoapClient();
PingarAPIResponse response = pingarAPI.GetQueryBasedSummary(request);
int count = 0;
if (response.Error == null)
{
foreach (Summary summary in response.SearchSupport.QueryBasedSummaryResult)
{
Console.WriteLine("Summary for the document " + count);
foreach (Paragraph paragraph in summary.Paragraphs)
{
foreach (Sentence sentence in paragraph.Sentences)
{
Console.WriteLine(sentence.Text);
}
Console.Write("\n\n");
}
count++;
}
}