Class PostalCodeAssociationRule

java.lang.Object
org.opensextant.extractors.geo.rules.GeocodeRule
org.opensextant.extractors.geo.rules.PostalCodeAssociationRule
All Implemented Interfaces:
org.opensextant.data.MatchSchema

public class PostalCodeAssociationRule extends GeocodeRule implements org.opensextant.data.MatchSchema
  • Field Details

  • Constructor Details

    • PostalCodeAssociationRule

      public PostalCodeAssociationRule()
  • Method Details

    • setBuffer

      public void setBuffer(String buf)
      Important - set buffer so spans for tuples can be assessed.
      Parameters:
      buf - input buffer
    • complementaryPostal

      public static boolean complementaryPostal(org.opensextant.data.Place geo1, org.opensextant.data.Place geo2)
      Determine if you have one of each, ADM1 and POSTAL. COUNTRY and POSTAL is also fine. e.g., MA 01721 is a qualified postal code. e.g., MA MA is nonsense; it looks like two province codes together. e.g., Garden City NJ USA 01721 is fine. POSTAL code follows country. Garden City 01721 -- won't work if place is P/PPL only. Must be ADM4 or PPLA for example. 90120 01721 -- also will not work; Two postal codes next to each other. Garden City 01721-0045 -- Office park in a large metro area. That could work.
      Parameters:
      geo1 - place obj
      geo2 - place obj
      Returns:
      true if place mentions complement each other.
    • evaluate

      public void evaluate(List<PlaceCandidate> names)
      Overrides:
      evaluate in class GeocodeRule
      Parameters:
      names - list of found place names
    • evaluate

      public void evaluate(PlaceCandidate name, org.opensextant.data.Place geo)
      Description copied from class: GeocodeRule
      The one evaluation scheme that all rules must implement. Given a single text match and a location, consider if the geo is a good geocoding for the match.
      Specified by:
      evaluate in class GeocodeRule
      Parameters:
      name - matched name in text
      geo - gazetteer entry or location