No project description provided
Project description
STRIVE: Semantic Tokenized Ranking via Vectorization & Embeddings
from strive.reranker import Reranker, EmbeddingType, deduplicate_results
textual_reranker = Reranker(embedding_type=EmbeddingType.textual)
semantic_reranker = Reranker(embedding_type=EmbeddingType.semantic)
# Supports English and Portuguese
corpus = [
"O presidente anunciou novas políticas econômicas.",
"Houve exonerações no governo recentemente.",
"Os nomes dos exonerados ainda não foram divulgados.",
"O mercado financeiro reagiu positivamente às mudanças.",
"O congresso discutirá reformas tributárias esta semana."
]
query = "danças" # parte de "mudanças"
# Build the index with the given corpus
textual_results = textual_reranker.rerank_documents(query, corpus, top_k=len(corpus))
semantic_results = semantic_reranker.rerank_documents(query, corpus, top_k=len(corpus))
merged_results = textual_results + semantic_results
# Deduplicate the results
deduplicated_results = deduplicate_results(merged_results, top_k=2)
print(deduplicated_results)
# [('O mercado financeiro reagiu positivamente às mudanças.', 0.7980238199234009), ('O presidente anunciou novas políticas econômicas.', 0.37016284745050076)]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
strive_ranker-2.42.tar.gz
(48.7 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strive_ranker-2.42.tar.gz.
File metadata
- Download URL: strive_ranker-2.42.tar.gz
- Upload date:
- Size: 48.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91c8475cd4f618ac6fc8173ac7794eb8237eac7c44996c37fbb39734d9a2b56d
|
|
| MD5 |
6d08910d81b1060e5766cf7dc0001105
|
|
| BLAKE2b-256 |
dafd6a420da5d2f10c3a84f1112bbd317d391f40382d3fae33a37690d5942f6b
|
File details
Details for the file strive_ranker-2.42-py3-none-any.whl.
File metadata
- Download URL: strive_ranker-2.42-py3-none-any.whl
- Upload date:
- Size: 48.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0179f54fdc9999c2033a93bcf396708212ece5851174077b7ffd374064268a2a
|
|
| MD5 |
463fa12ee19a8cbdb2de3598505192b3
|
|
| BLAKE2b-256 |
9c13faaac977f10b58b789b9f7be5fd50bcf0baf7bfb85cdb48ce131a508a7a9
|