Skip to main content

Downloads

Downloads

Downloads

Minimal dependencies — powered purely by ONNX Runtime (no PyTorch, no scikit-learn).

  • pip install nanoranker
from nanoranker import rank

query = "Who directed 'Inception'?"
documents = [
    "'Inception' is a 2010 science fiction film directed by Christopher Nolan. It explores the concept of dream invasion and manipulation.",
    "Steven Spielberg is one of the most well-known directors of all time, famous for films like 'E.T.', 'Jaws', and 'Jurassic Park'.",
    "'Titanic', directed by James Cameron, was released in 1997 and became one of the highest-grossing films of all time.",
    "Christopher Nolan is a British-American filmmaker known for his cerebral and nonlinear storytelling in movies like 'Memento', 'The Dark Knight', and 'Inception'.",
    "Martin Scorsese directed the crime drama 'Goodfellas', which is considered a masterpiece in the gangster film genre."
]
rank(query, documents)
# Output:
# [("'Inception' is a 2010 science fiction film directed by Christopher Nolan. It explores the concept of dream invasion and manipulation.",
#   0.3140751875733907),
#  ("Christopher Nolan is a British-American filmmaker known for his cerebral and nonlinear storytelling in movies like 'Memento', 'The Dark Knight', and 'Inception'.",
#   0.2776111024668988),
#  ("'Titanic', directed by James Cameron, was released in 1997 and became one of the highest-grossing films of all time.",
#   0.23555834379639545),
#  ("Martin Scorsese directed the crime drama 'Goodfellas', which is considered a masterpiece in the gangster film genre.",
#   0.13833970116570868),
#  ("Steven Spielberg is one of the most well-known directors of all time, famous for films like 'E.T.', 'Jaws', and 'Jurassic Park'.",
#   0.03441566499760637)]

query = "What is the speed of light?"
documents = [
    "The speed of light in a vacuum is approximately 299,792 kilometers per second (km/s), or about 186,282 miles per second.",
    "Isaac Newton's laws of motion and gravity laid the groundwork for classical mechanics.",
    "The theory of relativity, proposed by Albert Einstein, has revolutionized our understanding of space, time, and gravity.",
    "The Earth orbits the Sun at an average distance of about 93 million miles, taking roughly 365.25 days to complete one revolution.",
    "Light can be described as both a wave and a particle, a concept known as wave-particle duality."
]
rank(query, documents)
# Output:
# [('The speed of light in a vacuum is approximately 299,792 kilometers per second (km/s), or about 186,282 miles per second.',
#   0.30580432492241644),
#  ('Light can be described as both a wave and a particle, a concept known as wave-particle duality.',
#   0.28595544542990103),
#  ('The Earth orbits the Sun at an average distance of about 93 million miles, taking roughly 365.25 days to complete one revolution.',
#   0.26599248433979883),
#  ("Isaac Newton's laws of motion and gravity laid the groundwork for classical mechanics.",
#   0.07144421109976119),
#  ('The theory of relativity, proposed by Albert Einstein, has revolutionized our understanding of space, time, and gravity.',
#   0.07080353420812247)]

query = "Who wrote 'Pride and Prejudice'?"
documents = [
    "Pride and Prejudice is a novel written by Jane Austen, first published in 1813. It is a classic of English literature.",
    "Charlotte Brontë, known for her novel Jane Eyre, was a 19th-century English novelist.",
    "William Shakespeare is often considered the greatest playwright in the English language, famous for works such as Hamlet, Romeo and Juliet, and Macbeth.",
    "Pride and Prejudice explores themes of love, social status, and individual growth, set in the British Regency era.",
    "Jane Austen, an English novelist, is renowned for her works that critique the British landed gentry of the 18th century."
]
rank(query, documents)
# Output:
# [('Pride and Prejudice is a novel written by Jane Austen, first published in 1813. It is a classic of English literature.',
#   0.3413168531560433),
#  ('Pride and Prejudice explores themes of love, social status, and individual growth, set in the British Regency era.',
#   0.31806861613354287),
#  ('Jane Austen, an English novelist, is renowned for her works that critique the British landed gentry of the 18th century.',
#   0.19975825998268765),
#  ('William Shakespeare is often considered the greatest playwright in the English language, famous for works such as Hamlet, Romeo and Juliet, and Macbeth.',
#   0.07942214548601552),
#  ('Charlotte Brontë, known for her novel Jane Eyre, was a 19th-century English novelist.',
#   0.06143412524171063)]

query = "Quem escreveu 'Dom Casmurro'?"
documents = [
    "'Dom Casmurro' é um romance escrito por Machado de Assis, publicado pela primeira vez em 1899. É considerado uma das obras-primas da literatura brasileira.",
    "Machado de Assis, um dos maiores escritores da literatura brasileira, é autor de obras como 'Dom Casmurro', 'Memórias Póstumas de Brás Cubas' e 'Quincas Borba'.",
    "'O Guarani', um romance escrito por José de Alencar, é um marco do romantismo no Brasil e foi publicado em 1857.",
    "Clarice Lispector foi uma importante escritora brasileira, conhecida por obras como 'A Hora da Estrela' e 'Perto do Coração Selvagem'.",
    "'Dom Casmurro' narra a vida de Bento Santiago, conhecido como Bentinho, e seus complexos sentimentos de amor e ciúmes em relação a Capitu."
]
rank(query, documents)
# Output:
# [("'Dom Casmurro' é um romance escrito por Machado de Assis, publicado pela primeira vez em 1899. É considerado uma das obras-primas da literatura brasileira.",
#   0.3487686026605069),
#  ("'Dom Casmurro' narra a vida de Bento Santiago, conhecido como Bentinho, e seus complexos sentimentos de amor e ciúmes em relação a Capitu.",
#   0.24520132359838245),
#  ("Machado de Assis, um dos maiores escritores da literatura brasileira, é autor de obras como 'Dom Casmurro', 'Memórias Póstumas de Brás Cubas' e 'Quincas Borba'.",
#   0.2189232997713971),
#  ("'O Guarani', um romance escrito por José de Alencar, é um marco do romantismo no Brasil e foi publicado em 1857.",
#   0.13183125469333265),
#  ("Clarice Lispector foi uma importante escritora brasileira, conhecida por obras como 'A Hora da Estrela' e 'Perto do Coração Selvagem'.",
#   0.05527551927638088)]

Download files

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

Source Distribution

nanoranker-1.2.tar.gz (94.3 MB view details)

Uploaded Source

Built Distribution

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

nanoranker-1.2-py3-none-any.whl (94.4 MB view details)

Uploaded Python 3

File details

Details for the file nanoranker-1.2.tar.gz.

File metadata

  • Download URL: nanoranker-1.2.tar.gz
  • Upload date:
  • Size: 94.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for nanoranker-1.2.tar.gz
Algorithm Hash digest
SHA256 f9794ef0c7e1e75557ffde5d654c9cf6729793ad02399e4e1ff141611d29a806
MD5 620120748f6ebcb8bd30678461ede145
BLAKE2b-256 4d950dfe13dc9f62cc6c57c1e95c8340ef0c4ed703ee7da31780cb1cda066c00

See more details on using hashes here.

File details

Details for the file nanoranker-1.2-py3-none-any.whl.

File metadata

  • Download URL: nanoranker-1.2-py3-none-any.whl
  • Upload date:
  • Size: 94.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for nanoranker-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 25fb8815daba9434ae3b8f8f3f0f8814b06bb62fbbbc8ed883ce1114ef319223
MD5 8d8758f15589a4fe2195bf7ffdf572a4
BLAKE2b-256 4ab7339c2e78cfb69f3462d47f2811e219f42e19b69bae5b8c14a5bffd46c1f0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2 This release

2 files

1.1

2 files

1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page