GetLocationSuggestions input: string Query, string[] Documents, enum DocumentFormat, int NumberOfResults output: GeoFacet[] LocationSuggestionsResult
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 aspect suggestions.
It is assumed that the documents match the query, e.g. were returned by a search engine.
Finds locations in the input that can help narrow the search.
The GeoFacet object stores the location term and its score.
The score is defined by the co-occurrence with the query terms offset by the total frequency.
Locations that do-not co-occur with the query term are not extracted.
See also Entity extraction.
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.NumberOfResults = 5;
request.SearchSupport.Documents = new string[] { "document text" };
request.SearchSupport.DocumentsFormat = DocumentFormat.Text;
request.Language = Language.EN;
PingarAPIServiceSoapClient pingarAPI = new PingarAPIServiceSoapClient();
PingarAPIResponse response = pingarAPI.GetLocationSuggestions(request);
if (response.Error == null)
{
Console.WriteLine("Location Suggestions: ");
foreach (GeoFacet location in response.SearchSupport.LocationSuggestionsResult)
{
Console.WriteLine(location.Title + " (" + location.Score + ")");
}
}