Auto Mapper
A package that maps a set of strings to another set of objects where each object is described as:
{
'code': 'unique_code',
'name': 'given name'
}
How it works
Tha process mainly starts by a text-cleaning, which is just another way of saying text processing, with the help of certain dependencies (NLTK for the current release).
The cleaning operation transforms each string to a list of tokens. By running a text similarity algorithm on the resulting vectors we're able to map certain fields with the most similar columns.
Another phase of mapping consist of an additional text processing step, which is stemming, combined with a lower similarity threshold is applyed on the unmapped fields.
The final step is to measure the semantic similarity between the unmapped fields and columns. Thanks to Datamuse and their greate API we were able to ~externalize this operation.
Installation
First you need to install the package, then run a setup script that will download the necessary ntlk packages
$ pip install auto-mapper
$ setup-nltk
NOTE: if you are using a virtual environment, please check it out before running the nltk setup It downloads the packages to the environment folder
Usage
It's pretty straightforward
>>> from mapper import AutoMapper
>>> mapper = AutoMapper()
>>> cols = ['city', 'Location Name']
>>> fields = [{'code': 'loc_name', 'name': 'location names'}, {'code': 'town', 'name': 'Town'}]
>>> mapping_result, unmapped_columns_indices, unmapped_fields_indices = mapper.map(column_names=cols, fields=fields)
>>> print(mapping_result)
[{'source': ['city'], 'target': 'town'}, {'source': ['Location Name'], 'target': 'loc_name'}]
>>> print(unmapped_columns_indices)
set()
>>> print(unmapped_fields_indices)
set()
Metadata
Release files for auto-mapper 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| auto-mapper-0.1.2.tar.gz | 9.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| auto_mapper-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.8 kB
Release files / auto-mapper-0.1.2.tar.gz
| Download URL | auto-mapper-0.1.2.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c02d1921e072e700c16a38bb55aaec3c608265c31743338b9f1aa3e9ba91bf9
|
|
BLAKE2b-256 checksum How to use checksums |
741c19e8adbcbc3c5ba679d4ce660c93ce2f7fd85da1f88dc717a2188b92dcf4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
|
Release files / auto_mapper-0.1.2-py3-none-any.whl
| Download URL | auto_mapper-0.1.2-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6bdef520dff11642a3e8c1651b82ffee9eb85800eb648b66fd243b79a6097461
|
|
BLAKE2b-256 checksum How to use checksums |
4958c13940b3461cf600c76aba64d381b47c5d096f7f20239511354dad96d207
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
|
Security for auto-mapper 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.