com.bericotech.clavin.resolver.lucene
Class LuceneLocationResolver

java.lang.Object
  extended by 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.
 
Method Summary
 List<ResolvedLocation> resolveLocations(List<LocationOccurrence> locations, boolean fuzzy)
          Resolves the supplied list of location names into ResolvedLocations containing GeoName objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final org.slf4j.Logger logger
Constructor Detail

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 loaded
maxHitDepth - number of candidate matches to consider
maxContextWindow - how much context to consider when resolving
Throws:
IOException
org.apache.lucene.queryparser.classic.ParseException
Method Detail

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 resolved
fuzzy - 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.