Package com.bericotech.clavin.gazetteer.query

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


        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


    /**
     * 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

     * 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

     * 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

    private static MultipartLocationResolver resolver;

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

    private static MultipartLocationResolver resolver;

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

     * @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

     */
    @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

            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

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

Related Classes of com.bericotech.clavin.gazetteer.query.LuceneGazetteer$QueryPart

Copyright © 2018 www.massapicom. 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.