package org.apache.tika.addon.ner.geo;

import org.apache.tika.Tika;
import org.apache.tika.exception.TikaException;
import org.apache.tika.metadata.Metadata;
import org.xml.sax.SAXException;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;

/**
 *
 * Place to experiment Tika's GeoParser with Location NER model.
 * Update src/main/res with location NER model.
 */
public class Main {

    public static void main(String[] args) throws IOException, TikaException, SAXException {

        //args = new String[]{"data/polar.geot"};
        if (args.length != 1) {
            System.err.println("Invalid Args.");
            System.err.println("Usage : <File>");
            return;
        }
        File file = new File(args[0]);
        Tika tika = new Tika();
        Metadata metadata = new Metadata();
        tika.parse(file, metadata);
        System.out.println("Metadata : ");
        //System.out.println(metadata);
        for (String name : metadata.names()) {
            System.out.print(name + "=");
            if (metadata.isMultiValued(name)) {
                System.out.println(Arrays.toString(metadata.getValues(name)));
            } else {
                System.out.println(metadata.get(name));
            }
        }
    }
}

@@ -33,16 +33,54 @@
 r.geo;%0A%0A
+import org.apache.commons.io.IOUtils;%0A
 import o
@@ -269,24 +269,47 @@
 OException;%0A
+import java.io.Reader;%0A
 import java.
@@ -894,16 +894,33 @@
 %0A       
+ Reader content =
  tika.pa
@@ -972,20 +972,74 @@
 ln(%22
-Metadata : %22
+%3EContent:%22);%0A        System.out.println(IOUtils.readLines(content)
 );%0A 
@@ -1045,18 +1045,16 @@
         
-//
 System.o
@@ -1064,24 +1064,30 @@
 println(
-m
+%22%3EM
 etadata
+ : %22
 );%0A     

Include content in output