send_the_raven.address.compare#

send_the_raven.address.compare(a, b)[source]#

This compares two Address objects and returns a similarity score between 0 and 1. The comparison takes into account differences in street number, street name, unit number, etc.

Addresses should be normalize() prior to comparing for best results. return 0 if either a.street or b.street is None. doesn’t check full_address

Example

>>> addr1 = Address(street="12 Main St", city="Boston", state="MA")
>>> addr2 = Address(street="12 Main Street", city="Boston", state="MA")
>>> addr3 = Address(street="13 Main St", city="Boston", state="MA")
>>> assert compare(addr1, addr3) > compare(addr2, addr3)

The first comparison has a higher score than the second comparison because “12 Main St” is more similar to “12 Main Street” than “13 Main St”.

Parameters:
  • a (Address) – Address to compare

  • b (Address) – Address to compare

Returns:

similarity between 0.0 and 1.0

Return type:

float

See also

__eq__()