Skip to main content

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"

# Build the index with the given corpus
textual_results = textual_reranker.rerank_documents(query, corpus, top_k=50)
semantic_results = semantic_reranker.rerank_documents(query, corpus, top_k=50)
merged_results = textual_results + semantic_results

# Deduplicate the results
deduplicated_results = deduplicate_results(merged_results, top_k=2)

print(deduplicated_results)
# [('Os nomes dos exonerados ainda não foram divulgados.', 0.30326954502292763), ('Houve exonerações no governo recentemente.', 0.30326954502292763)]

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

strive_ranker-1.8-py3-none-any.whl (49.6 MB view details)

Uploaded Python 3

File details

Details for the file strive_ranker-1.8-py3-none-any.whl.

File metadata

  • Download URL: strive_ranker-1.8-py3-none-any.whl
  • Upload date:
  • Size: 49.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for strive_ranker-1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f4311565dae2f650bb17f5d7e560e85c307a34555fcb53a8f6a3ea19d8ce56de
MD5 a3a4b3c51e29d380d9a0c19795a7db41
BLAKE2b-256 e219e06efcb0db5fe5b29bd116bdb693cb67824af1bc8cd8bf2b1252ec3572cd

See more details on using hashes here.

Supported by

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