Skip to content

v0.2.55..v0.2.56 changeset AddressParser.h

Garret Voltz edited this page Aug 14, 2020 · 3 revisions
diff --git a/hoot-core/src/main/cpp/hoot/core/conflate/address/AddressParser.h b/hoot-core/src/main/cpp/hoot/core/conflate/address/AddressParser.h
index 37a355e..468ed57 100644
--- a/hoot-core/src/main/cpp/hoot/core/conflate/address/AddressParser.h
+++ b/hoot-core/src/main/cpp/hoot/core/conflate/address/AddressParser.h
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 #ifndef ADDRESS_PARSER_H
 #define ADDRESS_PARSER_H
@@ -32,7 +32,6 @@
 #include <hoot/core/language/ToEnglishAddressTranslator.h>
 #include <hoot/core/elements/Element.h>
 #include <hoot/core/conflate/address/AddressNormalizer.h>
-#include <hoot/core/conflate/address/AddressTagKeys.h>
 
 // Qt
 #include <QSet>
@@ -60,6 +59,7 @@ class AddressParser : public Configurable
 public:
 
   AddressParser();
+  virtual ~AddressParser() = default;
 
   virtual void setConfiguration(const Settings& conf);
 
@@ -151,6 +151,13 @@ private:
   //when enabled, will attempt to translate address tags to English with a translator other than
   //the one built into libpostal before address normalization
   mutable bool _preTranslateTagValuesToEnglish;
+  // is the current address being parsed from an OSM address tag or some other auxiliary tag (name,
+  // etc.)?
+  mutable bool _parsedFromAddressTag;
+  // determines if the last address parsed is a street address with a house number range
+  mutable bool _isHouseNumRange;
+  // determines if the last address parsed is a street address with a subletter in its house number
+  mutable bool _isSubLetter;
 
   ToEnglishAddressTranslator _addressTranslator;
   AddressNormalizer _addressNormalizer;
@@ -159,9 +166,11 @@ private:
 
   QSet<QString> _parseAddressAsRange(const QString& houseNum, const QString& street) const;
   bool _isRangeAddress(const QString& houseNum) const;
+  bool _isSubLetterAddress(const QString& houseNum) const;
   bool _isParseableAddressFromComponents(const Tags& tags, QString& houseNum,
                                          QString& street) const;
-  bool _isValidAddressStr(QString& address, QString& houseNum,  QString& street) const;
+  bool _isValidAddressStr(QString& address, QString& houseNum,  QString& street,
+                          const bool requireStreetTypeInIntersection = false) const;
   /*
    * Parses tags which contain a complete address string
    */
Clone this wiki locally