Fuzzy biject people's names between two lists.
Project description
names-matcher
Fuzzy biject people's names between two lists.
Let's define an identity as a series of names belonging to the same person. The algorithm is:
- Parse, normalize, and split names in each identity. The result is a set of strings for each identity.
- Define the similarity between identities as the Jaccard similarity between their sets of strings.
- Construct the distance matrix between identities in two specified lists.
- Solve the Linear Assignment Problem (LAP) on that matrix.
We use metaphones in the normalization step to reduce the influence of different spelling and
typos. We use lapjv to solve the LAP, so our solution scales to ~1000-s of identities.
If you have a bigger problem size, you should use MinHashes (e.g. http://ekzhu.com/datasketch/)
over the identity sets produced by reap_identity()
. Feel free to PR them.
Example:
>>> NamesMatcher()([["Vadim Markovtsev", "vmarkovtsev"], ["Long, Waren", "warenlg"]], \
[["Warren"], ["VMarkovtsev"], ["Eiso Kant"]])
array([1, 0], dtype=int32)
Installation
pip3 install names-matcher
Command line interface
Given one identity per line in two files, print the matches to standard output:
python3 -m names_matcher path/to/file/1 path/to/file/2
Each identity is several names merged with |
, for example:
Vadim Markovtsev|vmarkovtsev|vadim
Contributing
Contributions are very welcome and desired! Please follow the code of conduct and read the contribution guidelines.
License
Apache-2.0, see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for names_matcher-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 971fc749e843afb33a3bc2a06ed31e139564045b8516e0e922bfa40e2e7bad94 |
|
MD5 | bc049dcf8cd6729546d50856c1327947 |
|
BLAKE2b-256 | 99e778ce9c9143ac5b086d796407277b2526d8df3d959137e856bfd268545396 |