private void fillCountyRegexMap()

in geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContextGenerator.java [394:410]


  private void fillCountyRegexMap() {
    this.countyRegexMap = new HashMap<>();
    // this.adminBoundaryData
    for (AdminBoundary adm : adminBoundaryData) {

      if (countyRegexMap.containsKey(adm.getCountyCode())) {
        String currentRegex = countyRegexMap.get(adm.getCountyCode());
        if (currentRegex.length() > adm.getCountyRegex().length()) {
          // the longest one wins if they are not all the same for each entry in the file
          countyRegexMap.put(adm.getCountyCode(), currentRegex);
        }//else do nothing
      } else {
        countyRegexMap.put(adm.getCountyCode(), adm.getCountyRegex());
      }
    }

  }