Author: joern
Date: Thu Aug 6 13:22:59 2015
New Revision: 1694491
URL: http://svn.apache.org/r1694491
Log:
OPENNLP-804 Added arguments to main for hard coded paths.
Modified:
opennlp/addons/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java
Modified:
opennlp/addons/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java
URL:
http://svn.apache.org/viewvc/opennlp/addons/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java?rev=1694491&r1=1694490&r2=1694491&view=diff
==============================================================================
---
opennlp/addons/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java
(original)
+++
opennlp/addons/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java
Thu Aug 6 13:22:59 2015
@@ -33,22 +33,39 @@ import org.apache.lucene.store.MMapDirec
import org.apache.lucene.util.Version;
/**
- *
- * Creates two lucene indexes, geonames and usgs for use in GeoEntityLinker
+ * Creates two lucene indexes, geonames and usgs for use in GeoEntityLinker.
*/
public class GazetteerIndexer {
public static void main(String[] args) {
+
+ if (args.length != 8) {
+ System.out.println("Usage: GazetteerIndexer geonamesData
geoNamesCountryInfo geonamesAdmin1CodesASCII "
+ + "usgsDataFile usgsGovUnitsFile outputIndexDir
outputCountryContextFile regionsFile");
+ System.out.println();
+ System.out.println("The GazetteerIndexer.index methods javadoc explains
how to retrieve the data files.");
+ return;
+ }
+
+ File geonamesData = new File(args[0]);
+ File geoNamesCountryInfo = new File(args[1]);
+ File geonamesAdmin1CodesASCII = new File(args[2]);
+ File usgsDataFile = new File(args[3]);
+ File usgsGovUnitsFile = new File(args[4]);
+ File outputIndexDir = new File(args[5]);
+ File outputCountryContextFile = new File(args[6]);
+ File regionsFile = new File(args[7]);
+
try {
GazetteerIndexer i = new GazetteerIndexer();
- i.index(new
File("C:\\temp\\gazetteers\\geonamesdata\\allcountries\\allCountries.txt"),
- new File("C:\\temp\\gazetteers\\geonamesdata\\countryinfo.txt"),
- new
File("C:\\temp\\gazetteers\\geonamesdata\\admin1CodesASCII.txt"),
- new
File("C:\\temp\\gazetteers\\usgsdata\\NationalFile_20141202.txt.txt"),
- new
File("C:\\temp\\gazetteers\\usgsdata\\GOVT_UNITS_20140601.txt"),
- new File("C:\\temp\\gazetteers\\"),
- new File("C:\\temp\\gazetteers\\newCountryContextFile.txt"),
- new File("C:\\temp\\gazetteers\\regions.txt"));
+ i.index(geonamesData,
+ geoNamesCountryInfo,
+ geonamesAdmin1CodesASCII,
+ usgsDataFile,
+ usgsGovUnitsFile,
+ outputIndexDir,
+ outputCountryContextFile,
+ regionsFile);
} catch (Exception ex) {
ex.printStackTrace();
}