GetQueryBasedKeywords input: string Query, string[] Documents, enum DocumentFormat, int NumberOfResults output: Keywords[] QueryBasedKeywordsResult
Takes as an input a Query, a list of Documents and their DocumentFormat : text or URL, as well as
the NumberOfResults to restrict the set of the extracted keywords.
The number of keywords returned per document is specified by NumberOfResults. This defaults to 10 if NumberOfResults is unspecified.
It is assumed that the documents match the query, e.g. were returned by a search engine.
Computes keywords (single words and phrases) expressing the key topics discussed in the same paragraphs as the Query.
The Keywords object is a list of keywords with assigned scores for an individual document.
See also Document keywords.
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.Documents = new string[] { "document text" };
request.SearchSupport.DocumentsFormat = DocumentFormat.Text;
request.Language = Language.EN;
request.SearchSupport.NumberOfResults = 10;
PingarAPIServiceSoapClient pingarAPI = new PingarAPIServiceSoapClient();
PingarAPIResponse response = pingarAPI.GetQueryBasedKeywords(request);
int count = 0;
if (response.Error == null)
{
foreach (Keywords keywords in response.SearchSupport.QueryBasedKeywordsResult)
{
Console.Write("Keywords for the document " + count);
foreach (Keyword key in keywords.keywords)
{
Console.Write(key.Title + " (" + key.Score + ") ");
}
count++;
}
}