Examples of LuceneGazetteer


Examples of com.bericotech.clavin.gazetteer.query.LuceneGazetteer

        return locations;
    }

    @Before
    public void setUp() throws ClavinException {
        instance = new LuceneGazetteer(INDEX_DIRECTORY);
        queryBuilder = new QueryBuilder().maxResults(1).fuzzyMode(FuzzyMode.OFF);
    }
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.query.LuceneGazetteer

    /**
     * Ensure exception is thrown when trying to read non-existent index.
     */
    @Test(expected=ClavinException.class)
    public void testNonExistentIndex() throws ClavinException {
        new LuceneGazetteer(new File("./IMAGINARY_FILE"));
    }
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.query.LuceneGazetteer

     * Instantiate two {@link ClavinLocationResolver} objects, one without
     * context-based heuristic matching and other with it turned on.
     */
    @Before
    public void setUp() throws ClavinException {
        resolver = new ClavinLocationResolver(new LuceneGazetteer(new File("./IndexDirectory")));
    }
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.query.LuceneGazetteer

     * Instantiate a {@link ClavinLocationResolver} without context-based
     * heuristic matching and with fuzzy matching turned on.
     */
    @Before
    public void setUp() throws ClavinException {
        resolver = new ClavinLocationResolver(new LuceneGazetteer(new File("./IndexDirectory")));
    }
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.query.LuceneGazetteer

    private static MultipartLocationResolver resolver;

    @BeforeClass
    public static void setUpClass() throws ClavinException {
        resolver = new MultipartLocationResolver(new LuceneGazetteer(new File("./IndexDirectory")));
    }
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.query.LuceneGazetteer

    private static MultipartLocationResolver resolver;

    @BeforeClass
    public static void setUpClass() throws ClavinException {
        resolver = new MultipartLocationResolver(new LuceneGazetteer(new File("./IndexDirectory")));
    }
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.query.LuceneGazetteer

     * @throws ClavinException      If the index cannot be created.
     */
    public static GeoParser getDefault(String pathToLuceneIndex, LocationExtractor extractor, int maxHitDepth,
            int maxContentWindow, boolean fuzzy) throws ClavinException {
        // instantiate new LuceneGazetteer
        Gazetteer gazetteer = new LuceneGazetteer(new File(pathToLuceneIndex));
        return new GeoParser(extractor, gazetteer, maxHitDepth, maxContentWindow, fuzzy);
    }
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.query.LuceneGazetteer

     */
    @Deprecated
    public LuceneLocationResolver(File indexDir, int maxHitDepth, int maxContextWindow) throws IOException, ParseException {
        logger.warn("LuceneLocationResolver is deprecated.  Use ClavinLocationResolver.");
        try {
            delegate = new ClavinLocationResolver(new LuceneGazetteer(indexDir));
        } catch (ClavinException ce) {
            Throwable t = ce.getCause();
            if (t instanceof ParseException) {
                throw (ParseException)t;
            } else if (t instanceof IOException) {
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.query.LuceneGazetteer

            String modelToUse = CliffConfig.getInstance().getNerModelName();
            logger.debug("Creating extractor with "+modelToUse);
            StanfordNamedEntityExtractor locationExtractor = new StanfordNamedEntityExtractor(Model.valueOf(modelToUse));               
           
            boolean useFuzzyMatching = false;
            Gazetteer gazetteer = new LuceneGazetteer(new File(PATH_TO_GEONAMES_INDEX));
            resolver = new CliffLocationResolver(gazetteer);

            parser = new EntityParser(locationExtractor, resolver, useFuzzyMatching);
                       
            logger.info("Created parser successfully");
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.query.LuceneGazetteer

public class CustomLuceneLocationResolverTest {

    @Test
    public void testGetByGeoNameId() throws Exception {
        Gazetteer gazetteer = new LuceneGazetteer(new File(ParseManager.PATH_TO_GEONAMES_INDEX));
        CliffLocationResolver resolver = new CliffLocationResolver(gazetteer);
        GeoName geoName = resolver.getByGeoNameId(6252001);
        assertEquals(geoName.getGeonameID(),6252001);
        assertEquals(geoName.getName(),"United States");
        assertEquals(geoName.getFeatureCode(),FeatureCode.PCLI);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.