public class ClavinLocationResolver extends Object
LocationExtractor and resolves them into the appropriate
geographic entities (as intended by the document's author based on
context) by finding the best match in a gazetteer.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_CONTEXT_WINDOW
The default context window to consider when resolving matches.
|
static int |
DEFAULT_MAX_HIT_DEPTH
The default number of candidate matches to consider.
|
| Constructor and Description |
|---|
ClavinLocationResolver(Gazetteer gazetteer)
Create a new ClavinLocationResolver.
|
| Modifier and Type | Method and Description |
|---|---|
Gazetteer |
getGazetteer()
Get the Gazetteer used by this resolver.
|
static boolean |
isDemonym(LocationOccurrence extractedLocation)
Various named entity recognizers tend to mistakenly extract
demonyms (i.e., names for residents of localities (e.g.,
American, British)) as place names, which tends to gum up the
works for the resolver, so this method filters them out from
the list of
LocationOccurrences passed to the resolver. |
List<ResolvedLocation> |
resolveLocations(List<LocationOccurrence> locations,
boolean fuzzy)
Resolves the supplied list of location names into
ResolvedLocations containing GeoName objects
using the defaults for maxHitDepth and maxContentWindow. |
List<ResolvedLocation> |
resolveLocations(List<LocationOccurrence> locations,
int maxHitDepth,
int maxContextWindow,
boolean fuzzy)
Resolves the supplied list of location names into
ResolvedLocations containing GeoName objects. |
public static final int DEFAULT_MAX_HIT_DEPTH
public static final int DEFAULT_MAX_CONTEXT_WINDOW
public ClavinLocationResolver(Gazetteer gazetteer)
gazetteer - the Gazetteer to querypublic Gazetteer getGazetteer()
public List<ResolvedLocation> resolveLocations(List<LocationOccurrence> locations, boolean fuzzy) throws ClavinException
ResolvedLocations containing GeoName objects
using the defaults for maxHitDepth and maxContentWindow.
Calls Gazetteer.getClosestLocations(com.bericotech.clavin.gazetteer.query.GazetteerQuery) on
each location name to find all possible matches, then uses
heuristics to select the best match for each by calling
pickBestCandidates(java.util.List<java.util.List<com.bericotech.clavin.resolver.ResolvedLocation>>).locations - list of location names to be resolvedfuzzy - switch for turning on/off fuzzy matchingResolvedLocation objectsClavinException - if an error occurs parsing the search termspublic List<ResolvedLocation> resolveLocations(List<LocationOccurrence> locations, int maxHitDepth, int maxContextWindow, boolean fuzzy) throws ClavinException
ResolvedLocations containing GeoName objects.
Calls Gazetteer.getClosestLocations(com.bericotech.clavin.gazetteer.query.GazetteerQuery) on
each location name to find all possible matches, then uses
heuristics to select the best match for each by calling
pickBestCandidates(java.util.List<java.util.List<com.bericotech.clavin.resolver.ResolvedLocation>>).locations - list of location names to be resolvedmaxHitDepth - number of candidate matches to considermaxContextWindow - how much context to consider when resolvingfuzzy - switch for turning on/off fuzzy matchingResolvedLocation objectsClavinException - if an error occurs parsing the search termspublic static boolean isDemonym(LocationOccurrence extractedLocation)
LocationOccurrences passed to the resolver.extractedLocation - extraction location name to filterCopyright © 2012–2014 Berico Technologies. All rights reserved.