Skip to main content

spacy-rerank

Rank phrases and text based on query by leveraging hugging-face models. Currently, we are only leveraging tiny-bert model.

Installation and Implementation

  • Install the package using the below
pip install spacyrerank
  • Code for simple implementation
from spacyrerank.rerank import Reranker

query = "done effort is wasted"
texts = ["work done", "valuable man", "effort wasted", "Great work", "great work mate"]

reranker = Reranker(query, texts=texts)
reranker()

[{'rank': 2, 'text': 'effort wasted', 'similarity-score': 0.877},
 {'rank': 0, 'text': 'work done', 'similarity-score': 0.86},
 {'rank': 3, 'text': 'Great work', 'similarity-score': 0.773},
 {'rank': 4, 'text': 'great work mate', 'similarity-score': 0.757},
 {'rank': 1, 'text': 'valuable man', 'similarity-score': 0.719}]

CPU times: user 331 ms, sys: 76 ms, total: 407 ms
Wall time: 564 ms

Release files for spacyrerank 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spacyrerank 0.0.6
File Size Uploaded
spacyrerank-0.0.6.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spacyrerank 0.0.6
File Interpreter ABI Platform
spacyrerank-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / spacyrerank-0.0.6.tar.gz

Download URL spacyrerank-0.0.6.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1e5db9ead33143a492651da16c58640044cd0f956ac576775e73e1d84bc4ea49
BLAKE2b-256 checksum
How to use checksums
bc2d1d5d998c5934fd5472ff000a6fb24fd515e09bdb34c38e00d06f30ea629f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release files / spacyrerank-0.0.6-py3-none-any.whl

Download URL spacyrerank-0.0.6-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f4ffe5b34062657072dc7d3d2bf14953f8c9d193e13b8fbf0b40daf84e92a4b
BLAKE2b-256 checksum
How to use checksums
bb9c95910151e714402cd955bbedefd6583fcadd185c9d46551540199b8c8507
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page