in geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/USGSProcessor.java [192:229]
private static Map<String, AdminBoundary> getProvData(File govUnitsFile, GazetteerIndexer.GazType type) {
System.out.println("Attempting to read USGS province (State) data from: " + govUnitsFile.getPath());
Map<String, AdminBoundary> outmap = new HashMap<>();
try (BufferedReader reader = new BufferedReader(new FileReader(govUnitsFile))) {
int i = 0;
String line;
String[] fields = null;
while ((line = reader.readLine()) != null) {
String[] values = line.split(type.getSeparator());
if (i == 0) {
fields = values;
i++;
continue;
}
i++;
// System.out.println(i);
String countyCode = values[2];
String countyName = values[3];
String stateCode = values[5];
String stateName = values[6];
String countryCode = values[7];
String countryName = values[8];
AdminBoundary adminBoundary = new AdminBoundary(countryCode, countryName, stateCode, stateName, countyCode,
countyName, null, null, null);
outmap.put(stateCode + "." + countyCode, adminBoundary);
// System.out.println(adminBoundary);
}
} catch (IOException ex) {
ex.printStackTrace();
}
System.out.println("Successfully read USGS province (State) data from: " + govUnitsFile.getPath());
return outmap;
}