diff --git a/pypostalwin/src/pypostalwin.py b/pypostalwin/src/pypostalwin.py index 1218b6e..a643dbf 100644 --- a/pypostalwin/src/pypostalwin.py +++ b/pypostalwin/src/pypostalwin.py @@ -22,7 +22,7 @@ def _validate_address(address): @staticmethod def _remove_special_chars(address): - special_chars = r"≈≠><+≥≤±*÷√°⊥~Δπ≡≜∝∞≪≫⌈⌉⌋⌊∑∏γφ⊃⋂⋃μσρλχ⊄⊆⊂⊇⊅⊖∈∉⊕⇒⇔↔∀∃∄∴∵ε∫∮∯∰δψΘθαβζηικξτω∇" + special_chars = r"≈≠><+≥≤±*÷√°⊥~Δπ≡≜∝∞≪≫⌈⌉⌋⌊∑∏γφ⊃⋂⋃μσρλχ⊄⊆⊂⊇⊅⊖∈∉⊕⇒⇔↔∀∃∄∴∵ε∫∮∯∰δψΘθαβζηικξτω∇’" translator = str.maketrans("", "", special_chars) return address.translate(translator) @@ -48,8 +48,6 @@ def parse_address(self, address): json_data = result[json_start:json_end] return json.loads(json_data) - - def expand_address(self, address): self._validate_address(address) address = self._remove_special_chars(address) @@ -63,14 +61,14 @@ def terminate_parser(self): if __name__ == '__main__': - address_parser_path = "" - libpostal_path = "" + address_parser_path = r'C:\Workbench\libpostal\src\address_parser.exe' + libpostal_path = r'C:\Workbench\libpostal\src\libpostal.exe' logging.basicConfig(level=logging.INFO) parser = AddressParser(address_parser_path, libpostal_path) - address = "123 Main Street, City" + address = 'District Science Cntr, Kokkirakulam’ Rd, Tirunelveli, Tamil Nadu 627009' try: parsed_address = parser.parse_address(address) logging.info("Parsed Address: %s", parsed_address)