Skip to content

Commit a3ac82e

Browse files
RLPNC-5319: update example, support unfielded addresses
1 parent b97dd17 commit a3ac82e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

examples/address_similarity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def run(key, alt_url='https://api.rosette.com/rest/v1/'):
1818

1919
params = AddressSimilarityParameters()
2020
params["address1"] = {"houseNumber": "1600", "road": "Pennsylvania Ave NW", "city": "Washington", "state": "DC", "postCode": "20500"}
21-
params["address2"] = {"houseNumber": "160", "road": "Pennsilvana Avenue", "city": "Washington", "state": "D.C.", "postCode": "20500"}
21+
params["address2"] = "160 Pennsilvana Avenue, Washington, D.C., 20500"
2222

2323
try:
2424
return api.address_similarity(params)

rosette/api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ class AddressSimilarityParameters(_DocumentParamSetBase):
250250
"""Parameter object for C{address-similarity} endpoint.
251251
All are required.
252252
253-
C{address1} The address to be matched, a C{address} object.
253+
C{address1} The address to be matched, a C{address} object or address string.
254254
255-
C{address2} The address to be matched, a C{address} object.
255+
C{address2} The address to be matched, a C{address} object or address string.
256256
257257
The C{address} object contains these optional fields:
258258
city, island, district, stateDistrict, state, countryRegion, country, worldRegion, postCode, poBox
@@ -455,7 +455,8 @@ def call(self, parameters):
455455
if not isinstance(parameters, _DocumentParamSetBase):
456456
if self.suburl != self.api.endpoints['NAME_SIMILARITY'] \
457457
and self.suburl != self.api.self.api.endpoints['NAME_TRANSLATION'] \
458-
and self.suburl != self.api.self.api.endpoints['NAME_DEDUPLICATION']:
458+
and self.suburl != self.api.self.api.endpoints['NAME_DEDUPLICATION'] \
459+
and self.suburl != self.api.self.api.endpoints['ADDRESS_SIMILARITY']:
459460
text = parameters
460461
parameters = DocumentParameters()
461462
parameters['content'] = text

0 commit comments

Comments
 (0)