prelims-cli
CLI for prelims.
Install
Run:
pip install prelims-cli
If you need Japanese tokenization, run:
pip install prelims-cli[ja]
Usage
Assuming the following folder directory:
- content
| ├── post
| └── blog
└─ scripts
└ config
└ myconfig.yaml
where, post and blog are pages, and scripts is the place to put scripts.
Here is the example of configuration for the normal recommender:
handlers:
- target_path: "content/blog"
ignore_files:
- _index.md
processors:
- type: recommender
permalink_base: "/blog"
tfidf_options:
stop_words: english
max_df: 0.95
min_df: 2
tokenizer: null
- target_path: "content/post"
ignore_files:
- _index.md
processors:
- type: recommender
permalink_base: "/post"
tfidf_options:
max_df: 0.95
min_df: 2
tokenizer:
lang: ja
type: sudachi
mode: C
dict: full
Here is the example of configuration for the embedding-based recommender:
handlers:
- target_path: "content/blog"
ignore_files:
- _index.md
processors:
- permalink_base: "/blog"
type: embedding_recommender
language: en # Use onnx-community/granite-embedding-small-english-r2-ONNX
topk: 3
cache_db: ".prelims_embedding_cache_en.db"
- target_path: "content/post"
ignore_files:
- _index.md
processors:
- permalink_base: "/post"
type: embedding_recommender
language: ja # Use sirasagi62/ruri-v3-30m-ONNX
topk: 3
cache_db: ".prelims_embedding_cache_ja.db"
language picks both the model and its pooling method (en uses CLS pooling,
ja uses mean pooling). When you point the recommender at another model with
model_name, you must also state its pooling (mean or cls) — check the
model card, because the wrong pooling degrades the embeddings without raising
an error:
- permalink_base: "/blog"
type: embedding_recommender
model_name: "your-org/your-model-ONNX"
model_file: "onnx/model_quantized.onnx"
pooling: cls
Model revisions are pinned to a commit in LANGUAGE_MODELS. Without a pin,
an upstream re-upload would leave vectors from two different models in the same
cache DB, compared against each other — same dimensions, no error, quietly worse
recommendations. To take an upstream update, bump the revision there; the
whole cache re-embeds and stays one generation. revision is also accepted in
the config for a custom model_name.
Cached embeddings are keyed by the model, its revision, pooling and prefix as
well as the article content, so changing any of them re-embeds the affected
articles instead of reusing stale vectors. Changes to the embedding code itself are not
visible in those settings, so EMBEDDING_CACHE_VERSION in
prelims_cli/embedding/inference.py is part of the key too — bump it in any
change that makes embed() return different vectors for the same input.
$ prelims-cli --config ./scripts/config/myconfig.yaml
target: /user/chezo/src/chezo.uno/content/blog
target: /users/chezo/src/chezo.uno/content/post
Then your articles' front matter were updated.
Articles whose front matter did not change are left untouched, and updated ones are written in block style:
tags:
- AI
- Hugo
This keeps the output stable across runs, so a CMS or an editor writing the same style does not produce a diff on every run.
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 prelims_cli-0.0.10.tar.gz.
File metadata
- Download URL: prelims_cli-0.0.10.tar.gz
- Upload date:
- Size: 103.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a1ee16a975803f6c3fe01cac6c8e34fecbeef7bfc2eebbd43cf1c1aa337bd96
|
|
| MD5 |
f90b6f563f85656120f20d1142cc6880
|
|
| BLAKE2b-256 |
00dbb936eea883d1c8a35dd037ed6fd71bec9dc825cf9ed6bc541663b6080c20
|
Provenance
The following attestation bundles were made for prelims_cli-0.0.10.tar.gz:
Publisher:
release.yml on chezou/prelims-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prelims_cli-0.0.10.tar.gz -
Subject digest:
4a1ee16a975803f6c3fe01cac6c8e34fecbeef7bfc2eebbd43cf1c1aa337bd96 - Sigstore transparency entry: 2339127708
- Sigstore integration time:
-
Permalink:
chezou/prelims-cli@2b11808e90ed3e6bbf7fcedd34a55f28959bcdbf -
Branch / Tag:
refs/tags/v0.0.10 - Owner: https://github.com/chezou
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b11808e90ed3e6bbf7fcedd34a55f28959bcdbf -
Trigger Event:
release
-
Statement type:
File details
Details for the file prelims_cli-0.0.10-py3-none-any.whl.
File metadata
- Download URL: prelims_cli-0.0.10-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b22939b934ffc0d5377a5bd442d4012eab29ca80053202be8f6b5bcd03decaa
|
|
| MD5 |
66edca0dae725d8d2e68a169af8cd2d9
|
|
| BLAKE2b-256 |
ac50b81e873d35edad3e6b7e35fe768fd79fbe07710d272a0c1e1c6c3751b25e
|
Provenance
The following attestation bundles were made for prelims_cli-0.0.10-py3-none-any.whl:
Publisher:
release.yml on chezou/prelims-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prelims_cli-0.0.10-py3-none-any.whl -
Subject digest:
6b22939b934ffc0d5377a5bd442d4012eab29ca80053202be8f6b5bcd03decaa - Sigstore transparency entry: 2339127714
- Sigstore integration time:
-
Permalink:
chezou/prelims-cli@2b11808e90ed3e6bbf7fcedd34a55f28959bcdbf -
Branch / Tag:
refs/tags/v0.0.10 - Owner: https://github.com/chezou
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b11808e90ed3e6bbf7fcedd34a55f28959bcdbf -
Trigger Event:
release
-
Statement type: