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)]
Metadata
Release files for nanoranker 1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| nanoranker-1.2.tar.gz | 94.3 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nanoranker-1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 188.7 MB
Release files / nanoranker-1.2.tar.gz
| Download URL | nanoranker-1.2.tar.gz |
|---|---|
| Size | 94.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9794ef0c7e1e75557ffde5d654c9cf6729793ad02399e4e1ff141611d29a806
|
|
BLAKE2b-256 checksum How to use checksums |
4d950dfe13dc9f62cc6c57c1e95c8340ef0c4ed703ee7da31780cb1cda066c00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / nanoranker-1.2-py3-none-any.whl
| Download URL | nanoranker-1.2-py3-none-any.whl |
|---|---|
| Size | 94.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25fb8815daba9434ae3b8f8f3f0f8814b06bb62fbbbc8ed883ce1114ef319223
|
|
BLAKE2b-256 checksum How to use checksums |
4ab7339c2e78cfb69f3462d47f2811e219f42e19b69bae5b8c14a5bffd46c1f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Security for nanoranker 1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.