com.bericotech.clavin.resolver.lucene
Class LuceneLocationResolver
java.lang.Object
com.bericotech.clavin.resolver.lucene.LuceneLocationResolver
- All Implemented Interfaces:
- LocationResolver
public class LuceneLocationResolver
- extends Object
- implements LocationResolver
Resolves location names into GeoName objects.
Takes location names extracted from unstructured text documents by
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.
|
Field Summary |
static org.slf4j.Logger |
logger
|
|
Constructor Summary |
LuceneLocationResolver(File indexDir,
int maxHitDepth,
int maxContextWindow)
Builds a LuceneLocationResolver by loading a pre-built Lucene
index from disk and setting configuration parameters for
resolving location names to GeoName objects. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
public static final org.slf4j.Logger logger
LuceneLocationResolver
public LuceneLocationResolver(File indexDir,
int maxHitDepth,
int maxContextWindow)
throws IOException,
org.apache.lucene.queryparser.classic.ParseException
- Builds a
LuceneLocationResolver by loading a pre-built Lucene
index from disk and setting configuration parameters for
resolving location names to GeoName objects.
- Parameters:
indexDir - Lucene index directory to be loadedmaxHitDepth - number of candidate matches to considermaxContextWindow - how much context to consider when resolving
- Throws:
IOException
org.apache.lucene.queryparser.classic.ParseException
resolveLocations
public List<ResolvedLocation> resolveLocations(List<LocationOccurrence> locations,
boolean fuzzy)
throws IOException,
org.apache.lucene.queryparser.classic.ParseException
- Resolves the supplied list of location names into
ResolvedLocations containing GeoName objects.
Calls getCandidateMatches(com.bericotech.clavin.extractor.LocationOccurrence, boolean) 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>).
- Specified by:
resolveLocations in interface LocationResolver
- Parameters:
locations - list of location names to be resolvedfuzzy - switch for turning on/off fuzzy matching
- Returns:
- list of
ResolvedLocation objects
- Throws:
org.apache.lucene.queryparser.classic.ParseException
IOException
Copyright © 2013 Berico Technologies. All rights reserved.