|
28 | 28 | import requests |
29 | 29 | import platform |
30 | 30 |
|
31 | | -_BINDING_VERSION = '1.12.1' |
| 31 | +_BINDING_VERSION = '1.14.3' |
32 | 32 | _GZIP_BYTEARRAY = bytearray([0x1F, 0x8b, 0x08]) |
33 | 33 |
|
34 | 34 | _ISPY3 = sys.version_info[0] == 3 |
@@ -246,6 +246,32 @@ def validate(self): |
246 | 246 | repr(option)) |
247 | 247 |
|
248 | 248 |
|
| 249 | +class AddressSimilarityParameters(_DocumentParamSetBase): |
| 250 | + """Parameter object for C{address-similarity} endpoint. |
| 251 | + All are required. |
| 252 | +
|
| 253 | + C{address1} The address to be matched, a C{address} object. |
| 254 | +
|
| 255 | + C{address2} The address to be matched, a C{address} object. |
| 256 | +
|
| 257 | + The C{address} object contains these optional fields: |
| 258 | + city, island, district, stateDistrict, state, countryRegion, country, worldRegion, postCode, poBox |
| 259 | + """ |
| 260 | + |
| 261 | + def __init__(self): |
| 262 | + self.use_multipart = False |
| 263 | + _DocumentParamSetBase.__init__(self, ("address1", "address2")) |
| 264 | + |
| 265 | + def validate(self): |
| 266 | + """Internal. Do not use.""" |
| 267 | + for option in ("address1", "address2"): # required |
| 268 | + if self[option] is None: |
| 269 | + raise RosetteException( |
| 270 | + "missingParameter", |
| 271 | + "Required Address Similarity parameter, " + option + ", not supplied", |
| 272 | + repr(option)) |
| 273 | + |
| 274 | + |
249 | 275 | class NameSimilarityParameters(_DocumentParamSetBase): |
250 | 276 | """Parameter object for C{name-similarity} endpoint. |
251 | 277 | All are required. |
@@ -550,6 +576,7 @@ def __init__( |
550 | 576 | } |
551 | 577 |
|
552 | 578 | self.endpoints = { |
| 579 | + 'ADDRESS_SIMILARITY': 'address-similarity', |
553 | 580 | 'CATEGORIES': 'categories', |
554 | 581 | 'ENTITIES': 'entities', |
555 | 582 | 'INFO': 'info', |
@@ -879,6 +906,15 @@ def relationships(self, parameters): |
879 | 906 | @return: A python dictionary containing the results of relationship extraction.""" |
880 | 907 | return EndpointCaller(self, self.endpoints['RELATIONSHIPS']).call(parameters) |
881 | 908 |
|
| 909 | + def address_similarity(self, parameters): |
| 910 | + """ |
| 911 | + Create an L{EndpointCaller} to perform address similarity scoring and call it. |
| 912 | + @param parameters: An object specifying the data, |
| 913 | + and possible metadata, to be processed by the name matcher. |
| 914 | + @type parameters: L{AddressSimilarityParameters} |
| 915 | + @return: A python dictionary containing the results of name matching.""" |
| 916 | + return EndpointCaller(self, self.endpoints['ADDRESS_SIMILARITY']).call(parameters) |
| 917 | + |
882 | 918 | def name_translation(self, parameters): |
883 | 919 | """ |
884 | 920 | Create an L{EndpointCaller} to perform name analysis and translation |
|
0 commit comments