Skip to content

Commit 68f96e0

Browse files
author
DeviousStoat
committed
support tower building
1 parent 2588f9d commit 68f96e0

2 files changed

Lines changed: 28 additions & 17 deletions

File tree

‎pyap/source_US/data.py‎

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -879,37 +879,46 @@ def street_type_list_to_regex(street_type_list: list[str]) -> str:
879879
floor_indic=floor_indic
880880
)
881881

882+
tower = r"(?:{re_post_direction}\ [Tt][Oo][Ww][Ee][Rr])".format(
883+
re_post_direction=post_direction_re
884+
)
885+
882886
building = r"""
883887
(?P<building_id>
884-
(?:
885-
(?:[Bb][Uu][Ii][Ll][Dd][Ii][Nn][Gg])\.?
886-
|
887-
(?:[Bb][Ll][Dd][Gg])\.?
888-
|
889-
(?:[Bb][Ll][Vv])\.?
890-
)
891-
\
892888
(?:
893889
(?:
894-
[Aa][Nn][Dd]\
890+
(?:[Bb][Uu][Ii][Ll][Dd][Ii][Nn][Gg])\.?
895891
|
896-
{thousand}
892+
(?:[Bb][Ll][Dd][Gg])\.?
897893
|
898-
{hundred}
899-
|
900-
{zero_to_nine}
894+
(?:[Bb][Ll][Vv])\.?
895+
)
896+
\
897+
(?:
898+
(?:
899+
[Aa][Nn][Dd]\
900+
|
901+
{thousand}
902+
|
903+
{hundred}
904+
|
905+
{zero_to_nine}
906+
|
907+
{ten_to_ninety}
908+
){{1,5}}
901909
|
902-
{ten_to_ninety}
903-
){{1,5}}
910+
\d{{0,4}}(?:\.\d)?[A-Za-z]?[XxVvIi]{{0,4}}
911+
)
904912
|
905-
\d{{0,4}}(?:\.\d)?[A-Za-z]?[XxVvIi]{{0,4}}
906-
)
913+
{tower}
914+
)
907915
)
908916
""".format(
909917
thousand=thousand,
910918
hundred=hundred,
911919
zero_to_nine=zero_to_nine,
912920
ten_to_ninety=ten_to_ninety,
921+
tower=tower,
913922
)
914923

915924
occupancy_details = (

‎tests/test_parser_us.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ def test_floor(input, expected):
304304
("Building ", True),
305305
("building one ", True),
306306
("Building three ", True),
307+
("South Tower", True),
307308
# negative assertions
308309
("bldg", False),
309310
("bldgm", False),
@@ -521,6 +522,7 @@ def test_po_box_positive(input, expected):
521522
("123 Chase Wimbledom St.", True),
522523
("82 ALBRO TRACT", True),
523524
("6123 SHEFFIELD HOUSE", True),
525+
("99 Valley Greens Dr\nSouth Tower", True),
524526
# negative assertions
525527
("6 95 34 75 COMPANY PHONE IS", False),
526528
(", 666 Hell ST PMB 29700", False),

0 commit comments

Comments
 (0)