# 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
```bash
pip install spacyrerank
```
- Code for simple implementation
```python
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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Vishnunkumar/spacyrerank",
"name": "spacyrerank",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "reranker, spacy, transformers",
"author": "Vishnu Nandakumar",
"author_email": "nkumarvishnu25@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/bc/2d/1d5d998c5934fd5472ff000a6fb24fd515e09bdb34c38e00d06f30ea629f/spacyrerank-0.0.6.tar.gz",
"platform": null,
"description": "# spacy-rerank\nRank phrases and text based on query by leveraging hugging-face models. Currently, we are only leveraging tiny-bert model.\n\n## Installation and Implementation\n\n- Install the package using the below\n```bash\npip install spacyrerank\n```\n\n- Code for simple implementation\n\n```python\nfrom spacyrerank.rerank import Reranker\n\nquery = \"done effort is wasted\"\ntexts = [\"work done\", \"valuable man\", \"effort wasted\", \"Great work\", \"great work mate\"]\n\nreranker = Reranker(query, texts=texts)\nreranker()\n\n[{'rank': 2, 'text': 'effort wasted', 'similarity-score': 0.877},\n {'rank': 0, 'text': 'work done', 'similarity-score': 0.86},\n {'rank': 3, 'text': 'Great work', 'similarity-score': 0.773},\n {'rank': 4, 'text': 'great work mate', 'similarity-score': 0.757},\n {'rank': 1, 'text': 'valuable man', 'similarity-score': 0.719}]\n\nCPU times: user 331 ms, sys: 76 ms, total: 407 ms\nWall time: 564 ms\n```\n\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "Rank phrases and text based on query by leveraging hugging-face models.",
"version": "0.0.6",
"project_urls": {
"Homepage": "https://github.com/Vishnunkumar/spacyrerank"
},
"split_keywords": [
"reranker",
" spacy",
" transformers"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bb9c95910151e714402cd955bbedefd6583fcadd185c9d46551540199b8c8507",
"md5": "ab8d9e984ee49e23a0acd7de4a0fd686",
"sha256": "3f4ffe5b34062657072dc7d3d2bf14953f8c9d193e13b8fbf0b40daf84e92a4b"
},
"downloads": -1,
"filename": "spacyrerank-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ab8d9e984ee49e23a0acd7de4a0fd686",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3906,
"upload_time": "2024-05-17T06:44:02",
"upload_time_iso_8601": "2024-05-17T06:44:02.062692Z",
"url": "https://files.pythonhosted.org/packages/bb/9c/95910151e714402cd955bbedefd6583fcadd185c9d46551540199b8c8507/spacyrerank-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bc2d1d5d998c5934fd5472ff000a6fb24fd515e09bdb34c38e00d06f30ea629f",
"md5": "eddd0208efb135d216fd561356a2256b",
"sha256": "1e5db9ead33143a492651da16c58640044cd0f956ac576775e73e1d84bc4ea49"
},
"downloads": -1,
"filename": "spacyrerank-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "eddd0208efb135d216fd561356a2256b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3596,
"upload_time": "2024-05-17T06:44:03",
"upload_time_iso_8601": "2024-05-17T06:44:03.151265Z",
"url": "https://files.pythonhosted.org/packages/bc/2d/1d5d998c5934fd5472ff000a6fb24fd515e09bdb34c38e00d06f30ea629f/spacyrerank-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-17 06:44:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Vishnunkumar",
"github_project": "spacyrerank",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "spacyrerank"
}