private void fillCountyRegexMap()

in geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContextGenerator.java [392:408]


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

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

  }