Skip to content

v0.2.55..v0.2.56 changeset AddressScoreExtractor.h

Garret Voltz edited this page Aug 14, 2020 · 3 revisions
diff --git a/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/AddressScoreExtractor.h b/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/AddressScoreExtractor.h
index 648dd44..4fae103 100644
--- a/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/AddressScoreExtractor.h
+++ b/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/AddressScoreExtractor.h
@@ -44,7 +44,8 @@ class Address;
 
 /**
  * Calculates the address similarity score of two features involved in certain types of conflation.
- * Only exact string matches yield a positive score (no partial matching...for now).
+ * Only exact string matches yield a 1.0 score that is considered a match. There is limited support
+ * for partial matching.
  *
  * Some effort was spent in validating addresses with libaddressinput
  * (https://github.com/googlei18n/libaddressinput).  It was found that yields no utility since the
@@ -59,6 +60,7 @@ public:
   static std::string className() { return "hoot::AddressScoreExtractor"; }
 
   AddressScoreExtractor();
+  virtual ~AddressScoreExtractor() = default;
 
   virtual std::string getClassName() const { return AddressScoreExtractor::className(); }
 
@@ -112,6 +114,28 @@ private:
    */
   QList<Address> _getElementAddresses(const OsmMap& map, const ConstElementPtr& element,
                                       const ConstElementPtr& elementBeingComparedWith) const;
+
+  /*
+   * Checks to see if two address warrant a partial match score. This is still fairly experimental.
+   */
+  double _getPartialMatchScore(const Address& address1, const Address& address2) const;
+
+  /*
+   * Drop the street types (suffixes) and see if we have a address string match
+   */
+  bool _addressesMatchWithSuffixesRemoved(const Address& address1, const Address& address2) const;
+
+  /*
+   * Drop the house numbers and see if we have a address string match
+   */
+  bool _intersectionAndStreetAddressesMatchWithHouseNumbersRemoved(
+    const Address& address1, const Address& address2) const;
+
+  /*
+   * Go a little easier on the street name comparison; good for resolving typos in the name
+   */
+  bool _addressesMatchWithNameComparisonRelaxed(
+    const Address& address1, const Address& address2) const;
 };
 
 }
Clone this wiki locally