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 Distribution

strive_ranker-1.6.tar.gz (40.9 MB view details)

Uploaded Source

Built Distribution

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

strive_ranker-1.6-py3-none-any.whl (41.0 MB view details)

Uploaded Python 3

File details

Details for the file strive_ranker-1.6.tar.gz.

File metadata

  • Download URL: strive_ranker-1.6.tar.gz
  • Upload date:
  • Size: 40.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for strive_ranker-1.6.tar.gz
Algorithm Hash digest
SHA256 3019b779b5f06ab1d58c4ca7a1ff46a96714a885bd4f8d2dcfaa527a36cec1fb
MD5 6d9333d5f69827efc5af076dbc87d6ce
BLAKE2b-256 0e2f911c06ee87533c5dacfa0a1b6627cebfa8b95f49f8072c9a74c4153b917a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: strive_ranker-1.6-py3-none-any.whl
  • Upload date:
  • Size: 41.0 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 55c4bc6419e94984de1959b834f8bfddf37619e250aa5496b0d08f961ecf3f0c
MD5 c170a193433f8ac1fc54e42352ff448e
BLAKE2b-256 fe2495aee8bcc4d152b704f033544a5569b2fb73886dfab32561dfda7afac8c7

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