private static Map getCountryCodes()

in geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesProcessor.java [112:145]


  private static Map<String, String> getCountryCodes(File countryContextFile) {
    Map<String, String> ccs = new HashMap<>();
    BufferedReader reader;
    try {

      reader = new BufferedReader(new FileReader(countryContextFile));
      int i = 0;
      String line;
      boolean start = false;
      while ((line = reader.readLine()) != null) {
        if (!line.toLowerCase().startsWith("#iso\t") && !start) {

          continue;
        } else {
          start = true;
        }
        String[] values = line.split("\t");

        String ccode = values[0].toLowerCase();//this is the 2 digit ISO code
        String cname = values[4].toLowerCase();
        if (!ccode.equals("")) {
          ccs.put(ccode, cname);
        }

      }
      reader.close();
    } catch (IOException ex) {
      ex.printStackTrace();
    }
    ccs.put("SS", "South Sudan");
    ccs.put("CS", "Kosovo");
    return ccs;

  }