Sparkly
Welcome to Sparkly! Sparkly is a TF/IDF top-k blocking for entity matching system built on top of Apache Spark and PyLucene.
Paper and Data
A link to our paper can be found here. Data used in the paper can be found here.
Quick Start: Sparkly in 30 Seconds
There are three main steps to running Sparkly,
- Reading Data
spark = SparkSession.builder.getOrCreate()
table_a = spark.read.parquet('./examples/data/abt_buy/table_a.parquet')
table_b = spark.read.parquet('./examples/data/abt_buy/table_b.parquet')
- Index Building
config = IndexConfig(id_col='_id')
config.add_field('name', ['3gram'])
index = LuceneIndex('/tmp/example_index/', config)
index.upsert_docs(table_a)
- Blocking
query_spec = index.get_full_query_spec()
candidates = Searcher(index).search(table_b, query_spec, id_col='_id', limit=50)
candidates.show()
Installing Dependencies
Python
Sparkly has been tested for Python 3.10 on Ubuntu 22.04.
PyLucene
Unfortunately PyLucene is not available in PyPI, to install PyLucene see PyLucene docs. Sparkly has been tested with PyLucene 9.4.1.
Other Requirements
Once PyLucene has been installed, Sparkly can be installed with pip by running the following command in the root directory of this repository.
$ python3 -m pip install .
Tutorials
To get started with Sparkly we recommend starting with the IPython notebook included with the repository examples/example.ipynb.
Additional examples of how to use Sparkly are provided under the examples/ directory in this repository.
How It Works
Sparkly is built to do blocking for entity matching. There have been many solutions developed to address this problem, from basic SQL joins to deep learning based approaches. Sparkly takes a top-k approach to blocking, in particular, each search record is paired with the top-k records with the highest BM25 scores. In terms of SQL this might look something like executing this query for each record,
SELECT id, BM25(<QUERY>, name) AS score
FROM table_a
ORDER BY score DESC
LIMIT <K>;
where QUERY derived from the search record.
This kind of search is very common in information retrieval and keyword search applications. In fact, this is exactly what Apache Lucene is designed to do. While this form of search produces high quality results, it can also be very compute intensive, hence to speed up search, we leverage PySpark to distribute the computation. By using PySpark we can easily leverage a large number of machines to perform search without having to rely on approximation algorithms.
API Docs
API docs can be found here
Tips for Installing PyLucene
For tips on installing PyLucene take a look at this readme.
Metadata
Release files for sparkly-em 0.1.0
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 | Actions |
|---|---|---|---|---|
| sparkly_em-0.1.0.tar.gz | 758.0 kB | Without provenance | Details for sparkly_em-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sparkly_em-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sparkly_em-0.1.0-py3-none-any.whl |
Total release size: 796.8 kB
Release files / sparkly_em-0.1.0.tar.gz
| Download URL | sparkly_em-0.1.0.tar.gz |
|---|---|
| Size | 758.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13ce764fc7943a7c4a21f8f64def34a698f8b1b71901be9912d37cbc946dbef6
|
|
BLAKE2b-256 checksum How to use checksums |
64905426bf7d7032d9f93d2f1362dde69b1aabab17d11f1877f7041a03be1e23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.7
|
Release files / sparkly_em-0.1.0-py3-none-any.whl
| Download URL | sparkly_em-0.1.0-py3-none-any.whl |
|---|---|
| Size | 38.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aaadcbeab5426d64ef2ae67fc5f46112cee218d2aa6d24c66068d72fdbfc1033
|
|
BLAKE2b-256 checksum How to use checksums |
b1a135a4b686ad921adab06dd263aa1edf1fbd655ce3e83efa8bcde0b8ce1df0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.7
|
Security for sparkly-em 0.1.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.