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.7.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.7-py3-none-any.whl (41.0 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: strive_ranker-1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 e54dfd87601dc852fe9433ecd9743efa49bba666dc000ea2af6affaa1b400e63
MD5 7e3db910fab2fa764cff10d46fff0163
BLAKE2b-256 6227281dd2dfc2e36c832f0a0766e66c15af8a84e5a2fa09b69097df26b44aa9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: strive_ranker-1.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0ed7682f9150c73c07fa5625e4d281d9010c132c930b0a14835ecfa2bec0385b
MD5 cd82ee07b96f38d44345ea2f6dc89f7c
BLAKE2b-256 ef8f7f02b90c3c4cd12ab72fbf14f33c618faae7e52a4382465e15fa3e4bcb4e

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