Skip to main content

Rank phrases and text based on query by leveraging hugging-face models.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spacyrerank-0.0.5.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

spacyrerank-0.0.5-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file spacyrerank-0.0.5.tar.gz.

File metadata

  • Download URL: spacyrerank-0.0.5.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for spacyrerank-0.0.5.tar.gz
Algorithm Hash digest
SHA256 b7fadeb5825d44ebd8e5c3b58c7b07c8164ea65d2f88de8efc537d8a89a87ab2
MD5 f7a0f97af2e492cb08e10166187e01f9
BLAKE2b-256 557633bee869318f0649491daffa2a2a5fe4f4e00803592485578825d34efea0

See more details on using hashes here.

Provenance

File details

Details for the file spacyrerank-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: spacyrerank-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for spacyrerank-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 56f27ffacf33cc1a2ef937dff32c495e50bb405aaa22d5233b34d26dfc6dee8b
MD5 e13f8996f48e375fae73f391593a2e8b
BLAKE2b-256 4b0b8325e1409c07685b3caeda421774917fe6ed587572aa5832ae6a46cf9ac8

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page