Dense-retrieval core for JuriCode-JP: artefact loading, query embedding, cosine top-k, and article-level dedup as the single source of truth
Project description
juricode-retrieval
Dense-retrieval core for JuriCode-JP, packaged (MIT) as the single source of truth for the parity-critical primitives.
What it provides
| primitive | purpose |
|---|---|
_load_artefacts |
Load the embedding matrix (.npy), records (.meta.jsonl), and provider state (.vec.json, .vec.pkl fallback). Missing artefacts fail loudly. |
_encode_queries |
Embed query strings via the artefact's provider (gemini / openai / tfidf). The openai and gemini clients are imported lazily. |
_cosine_topk |
Cosine-similarity top-k of a query matrix against the corpus matrix. |
dedup_by_article |
Collapse duplicate segments of the same article to the top-ranked one. |
Why a package
tools/embed/retrieve.py re-imports these four objects, so every eval and
service caller runs the identical function objects rather than a copy. The
retrieval math is therefore unchanged by construction, and a test asserts the
object identity (retrieve._load_artefacts is juricode_retrieval._load_artefacts).
Dependencies
numpy is required (imported lazily inside each primitive, so importing the
package itself needs no numpy). google-genai is the production embedding
provider; the openai and tfidf branches are optional and imported only when
selected.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file juricode_retrieval-0.1.0.tar.gz.
File metadata
- Download URL: juricode_retrieval-0.1.0.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32fabf565b2c78db2103f789fac343402bd056417d619dcd4395aefa98086335
|
|
| MD5 |
68cf7627a8507a5c485db50652e564e8
|
|
| BLAKE2b-256 |
91ca5d5d2d74bfccd2c55710d5cc7092e70892962626ce508a0f330fa5710a54
|
Provenance
The following attestation bundles were made for juricode_retrieval-0.1.0.tar.gz:
Publisher:
publish-juricode-retrieval.yml on JuriCode-JP/JuriCode-JP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
juricode_retrieval-0.1.0.tar.gz -
Subject digest:
32fabf565b2c78db2103f789fac343402bd056417d619dcd4395aefa98086335 - Sigstore transparency entry: 2194771818
- Sigstore integration time:
-
Permalink:
JuriCode-JP/JuriCode-JP@139eb091ee4385af3990991c3353754aa21215c4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/JuriCode-JP
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-juricode-retrieval.yml@139eb091ee4385af3990991c3353754aa21215c4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file juricode_retrieval-0.1.0-py3-none-any.whl.
File metadata
- Download URL: juricode_retrieval-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48e21d360e0274b55dffff00cb74cad8e4f5cc26f28941b67c643e16717217e6
|
|
| MD5 |
23fe7f01c8213baead5e98c0da043aa9
|
|
| BLAKE2b-256 |
1f67f905f7184e8ca4793c986310d9c7707c078379903f6cd4f317dfb66b405f
|
Provenance
The following attestation bundles were made for juricode_retrieval-0.1.0-py3-none-any.whl:
Publisher:
publish-juricode-retrieval.yml on JuriCode-JP/JuriCode-JP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
juricode_retrieval-0.1.0-py3-none-any.whl -
Subject digest:
48e21d360e0274b55dffff00cb74cad8e4f5cc26f28941b67c643e16717217e6 - Sigstore transparency entry: 2194771826
- Sigstore integration time:
-
Permalink:
JuriCode-JP/JuriCode-JP@139eb091ee4385af3990991c3353754aa21215c4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/JuriCode-JP
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-juricode-retrieval.yml@139eb091ee4385af3990991c3353754aa21215c4 -
Trigger Event:
workflow_dispatch
-
Statement type: