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" # parte de "mudanç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)
# [('o mercado financeiro reagiu positivamente às mudanças.', 0.7980238199234009), ('os nomes dos exonerados ainda não foram divulgados.', 0.7464433312416077)]

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-2.0.tar.gz (49.4 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-2.0-py3-none-any.whl (49.6 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for strive_ranker-2.0.tar.gz
Algorithm Hash digest
SHA256 98de97a178a60ecacff52c8c292806eef0385c4790424356c64a742aadfe7cb6
MD5 a1e5fc97aa6e66330ecc1b456e27c8f7
BLAKE2b-256 53cce34a395ce9c64d17a5cc8af81f61f594d13d06f2b2714ef263e03bbb7014

See more details on using hashes here.

File details

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

File metadata

  • Download URL: strive_ranker-2.0-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-2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da0f1de23c56c7aa7dfd83a6f1733c7517072df5527f9e74200336bfaf269d1a
MD5 e5d2fd941781bacb5573ee5f1fb63ba3
BLAKE2b-256 b06e229394ccf5a46b58d232a8e3029765201aab95e4053c2b0af8706e36cbdf

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