in geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesProcessor.java [146:165]
public static void writeCountryContextFile(File outfile, Map<String, AdminBoundary> adms) {
try (BufferedWriter bw = new BufferedWriter(new FileWriter(outfile, true))) {
for (String admKey : adms.keySet()) {
AdminBoundary adm = adms.get(admKey);
if (adm == null) {
continue;
}
String province = adm.provinceName();
String country = adm.countryName();
String line = adm.countryCode() + TAB + adm.getProvCode() + TAB + TAB + country + TAB + province +
TAB + TAB + "(" + country + ")" + TAB + adm.provinceName() + TAB + adm.countyName() + "\n";
bw.write(line);
}
} catch (IOException ex) {
ex.printStackTrace();
}
System.out.println("successfully wrote Geonames entries to country oontext file");
}