Skip to content

Commit

Permalink
Detect postal code after a line break
Browse files Browse the repository at this point in the history
  • Loading branch information
lmelninkas committed Apr 25, 2024
1 parent ea976bc commit 2918212
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyap/source_US/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ def _indexed_region1(idx: Optional[str] = None):
_postal_code = f"""(?:{part_div}|\-)? {postal_code}"""
return rf"""
(?:{_indexed_region1("a")}?{_postal_code}{_indexed_region1("b")}?
|{_indexed_region1("c")}(?![-,.\ A-Za-z]{{0,10}}{postal_code_re}))
|{_indexed_region1("c")}(?![-,.\sA-Za-z]{{0,10}}{postal_code_re}))
"""


Expand Down
1 change: 1 addition & 0 deletions tests/test_parser_us.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ def test_full_street_positive(input, expected):
[
# positive assertions
("P.O. BOX 10323 PH (205) 595-3511\nBIRMINGHAM, AL 35202", True),
("25 HARBOR PARK DRIVE\nPORT WASHINGTON\nNY 11050", True),
("1100 VIRGINIA DR\nFORT WASHINGTON, PA, 19034", True),
("3602 HIGHPOINT\nSAN ANTONIO TX78217", True),
("8025 BLACK HORSE\nSTE 300\nPLEASANTVILLE NJ 08232", True),
Expand Down

0 comments on commit 2918212

Please sign in to comment.