Package com.bericotech.clavin

Examples of com.bericotech.clavin.GeoParser


     *
     * @throws Exception
     */
    private static void getparseArticle() throws Exception {
        // Instantiate a CLAVIN GeoParser using the StanfordExtractor
        GeoParser parser = GeoParserFactory.getDefault("./IndexDirectory", new StanfordExtractor(), 1, 1, false);
       
        // Unstructured text file about Somalia to be geoparsed
        File inputFile = new File("src/test/resources/sample-docs/Somalia-doc.txt");
       
        // Grab the contents of the text file as a String
        String inputString = TextUtils.fileToString(inputFile);
       
        // Parse location names in the text into geographic entities
        List<ResolvedLocation> resolvedLocations = parser.parse(inputString);
       
        // Display the ResolvedLocations found for the location names
        for (ResolvedLocation resolvedLocation : resolvedLocations)
            System.out.println(resolvedLocation);
       
View Full Code Here


     *
     * @throws Exception
     */
    private static void geoparseUppercaseArticle() throws Exception {
        // Instantiate a CLAVIN GeoParser using the StanfordExtractor with "caseless" models
        GeoParser parser = GeoParserFactory.getDefault("./IndexDirectory", new StanfordExtractor("english.all.3class.caseless.distsim.crf.ser.gz", "english.all.3class.caseless.distsim.prop"), 1, 1, false);
       
        // Unstructured uppercase text file about Somalia to be geoparsed
        File inputFile = new File("src/test/resources/sample-docs/Somalia-doc-uppercase.txt");
       
        // Grab the contents of the text file as a String
        String inputString = TextUtils.fileToString(inputFile);
       
        // Parse location names in the text into geographic entities
        List<ResolvedLocation> resolvedLocations = parser.parse(inputString);
       
        // Display the ResolvedLocations found for the location names
        for (ResolvedLocation resolvedLocation : resolvedLocations)
            System.out.println(resolvedLocation);
    }
View Full Code Here

     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
       
        // Instantiate a CLAVIN GeoParser using the StanfordExtractor
        GeoParser parser = GeoParserFactory.getDefault("./IndexDirectory", new StanfordExtractor(), 1, 1, false);
       
        // Unstructured text file about Somalia to be geoparsed
        File inputFile = new File("src/test/resources/sample-docs/Somalia-doc.txt");
       
        // Grab the contents of the text file as a String
        String inputString = TextUtils.fileToString(inputFile);
       
        // Parse location names in the text into geographic entities
        List<ResolvedLocation> resolvedLocations = parser.parse(inputString);
       
        // Display the ResolvedLocations found for the location names
        for (ResolvedLocation resolvedLocation : resolvedLocations)
            System.out.println(resolvedLocation);
       
View Full Code Here

TOP

Related Classes of com.bericotech.clavin.GeoParser

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.