Install pg_tokenizer via Pigsty native Linux packages, Docker, Debian/ZIP archives, or cargo-pgrx.
This is the multi-page printable view of this section. .
pg_tokenizer Documentation
- 1: Installation
- 2: Tokenizer Architecture & Usage
- 3: Text Analyzers & Filters
- 4: Tokenization Models
- 5: Multilingual Recipes & Limitations
- 6: SQL & TOML Reference
pg_tokenizer (maintained by Pigsty at pgsty/pg_tokenizer) is a standalone multilingual tokenization extension for PostgreSQL built in Rust (pgrx). It provides customizable text analyzers, character/token filters, and vocabulary models to convert raw text into integer token ID arrays (INT[]) and sparse bm25vector embeddings for vchord_bm25.
How Text Analyzers and Models combine to turn raw text into token IDs.
Configure character filters, pre-tokenizers (Unicode, Regex, Jieba), stemmers (30 languages), stopwords, synonyms, and n-grams.
Use built-in models (llmlingua2, bert_base_uncased, wiki_tocken, gemma2b), train custom corpus models, or import HuggingFace & Lindera models.
Ready-to-use configurations for English, Chinese (Jieba), Japanese (Lindera), and custom domain corpora.
Complete reference for all tokenizer_catalog SQL functions and TOML configuration options.
1 - Installation
Linux Packages via pig (Recommended)
On EL 8/9/10, Debian 12/13, and Ubuntu 22.04/24.04 (PostgreSQL 14–18), you can install pre-built native packages from the Pigsty repository (see package matrix on pgext.cloud):
Docker (vchord-suite)
The tensorchord/vchord-suite Docker image comes pre-configured with the Vchord extension suite:
pg_tokenizer— Standalone multilingual tokenizer (pgsty/pg_tokenizer)vchord_bm25— Native BM25 ranking index (pgsty/vchord_bm25)vchord— Scalable, disk-friendly vector search (pgsty/vchord)pgvector— Standard PostgreSQL vector data types
Connect with psql and enable the extension:
Configuration (shared_preload_libraries & search_path)
When installing via native packages or archives, add pg_tokenizer.so to shared_preload_libraries (required for model preloading) and include tokenizer_catalog in search_path:
Then enable the extension in your target database:
From Debian Package or ZIP Archive
Pre-built .deb and .zip release archives (GLIBC >= 2.35, x86_64 and aarch64) are available on the pgsty/pg_tokenizer Releases page:
From Source (cargo-pgrx)
Upgrading to 0.1.2
The 0.1.2 source changes are not yet a published release. After installing the matching library and SQL files, restart PostgreSQL to load the new preloaded library, then update each database as the extension owner/administrator:
Both 0.1.0 and 0.1.1 have upgrade paths. The upgrade replaces trigger/helper definitions and grants catalog access without rebuilding custom vocabularies or changing existing token IDs. Six-argument helper dependencies remain valid. Standard cargo pgrx install/package and tools/package.sh include the migration scripts. Lindera’s separate dictionary-ID migration still requires re-tokenization as described in the model notes.
Database-owner permissions
Installation and upgrade grant pg_database_owner USAGE/CREATE on tokenizer_catalog, EXECUTE on its functions, SELECT/INSERT/UPDATE/DELETE on catalog and model tables, and USAGE/SELECT on their sequences. Future objects created in that schema by the installing role receive the same table/sequence/function defaults; newly created custom models also explicitly grant access. The grants follow a database ownership change.
A non-superuser database owner can create/drop its own custom models, analyzers, tokenizers, stopwords, and synonyms after an administrator installs the extension. Grants do not transfer table ownership: dropping a model created by a different role still needs that object’s owner or an administrator. Other application roles require explicit grants; the extension does not give PUBLIC schema access or catalog write privileges. Functions continue to execute with the caller’s privileges.
2 - Tokenizer Architecture & Usage
Two-Stage Tokenization Pipeline
A tokenizer in pg_tokenizer consists of up to two stages that transform a raw TEXT string into an INT[] array of integer token IDs:
flowchart LR
A["Raw Text\\n(TEXT)"] --> B["Stage 1: Text Analyzer\\n1. character_filters\\n2. pre_tokenizer\\n3. token_filters"]
B --> C["Normalized Tokens\\n(TEXT[])"]
C --> D["Stage 2: Model\\nVocabulary Mapping / Subword BPE"]
D --> E["Token ID Array\\n(INT[] → bm25vector)"]- Text Analyzer (
text_analyzer): Splits raw text into aTEXT[]array of normalized string tokens by applying a sequential pipeline of:- Character Filters (
character_filters): Transform the raw string before splitting (e.g.,to_lowercase,unicode_normalization). - Pre-tokenizer (
pre_tokenizer): Splits the string into initial substrings (unicode_segmentation,regex, or Chinesejieba). - Token Filters (
token_filters): Filter or transform individual tokens (skip_non_alphanumeric,stemmer,stopwords,synonym,pg_dict,ngram).
- Character Filters (
- Model (
model): Maps the string tokens (or raw text, for standalone subword models likellmlingua2,bert_base_uncased,gemma2b, HuggingFace, orlindera) into integer token IDs (INT[]).
- Pretrained subword models (
llmlingua2,bert_base_uncased,gemma2b), HuggingFace models, and Lindera models include their own built-in tokenization rules and do not require a separatetext_analyzerstage. - Dictionary/corpus models (
wiki_tockenand custom models created viacreate_custom_model) require atext_analyzerstage to split and normalize text before looking up token IDs in the model’s vocabulary table.
Creating and Using a Tokenizer
All configuration in pg_tokenizer uses TOML format passed as a dollar-quoted string ($$ ... $$).
Option 1: Single-Stage Tokenizer (Built-in Model)
Option 2: Inline Text Analyzer + Model
You can define the text_analyzer pipeline directly inside create_tokenizer:
Option 3: Reusable Named Text Analyzer + Custom Model
You can create a standalone text_analyzer once with create_text_analyzer and reference it across multiple custom models and tokenizers:
Managing Tokenizers
Native PostgreSQL full-text search (0.1.2, unreleased)
Version 0.1.2 adds two functions returning the native tsvector type. analyze_to_tsvector uses the text analyzer’s string tokens as lexemes, making it useful for Jieba and custom stemmer/filter pipelines. tokenize_to_tsvector instead uses the model’s token IDs as decimal lexemes, supporting built-in, custom, Hugging Face, and Lindera models. No model decoding or second PostgreSQL text normalization is performed.
Both functions preserve repeated output tokens and assign positions from the final output sequence (default weight D). Positions are not source-text offsets: filters can remove, expand, or reorder tokens, and model output can contain subwords. Quotes, backslashes, whitespace, and punctuation in lexemes are preserved. Empty tokens are omitted; an empty output produces an empty vector, and NULL input returns NULL.
PostgreSQL’s native limits apply: lexemes must be shorter than 2 KB, each lexeme stores at most 256 positions, and positions above 16,383 are clamped. Long input can therefore lose term-frequency/proximity detail. See PostgreSQL text search limits.
Use the same analyzer/model and lexeme representation for documents and queries. plainto_tsquery('english', ...) does not generate model token IDs or reproduce a custom Chinese analyzer. These functions do not add a custom text search parser or a tsquery builder. They are STABLE because definitions live in catalogs: store/update the resulting vector in a column and index that column with GIN/GiST. When an installed BM25 implementation accepts native tsvector, it can consume these values too; check that implementation’s SQL API before migrating an existing bm25vector index.
3 - Text Analyzers & Filters
A Text Analyzer processes raw text through three sequential stages:
- Character Filters (
character_filters) — Zero or more character-level transformations on the full text string. - Pre-tokenizer (
pre_tokenizer) — Exactly one splitter that breaks the string into initial tokens. - Token Filters (
token_filters) — Zero or more token-level transformations, expansions, or filters.
You can test any text analyzer directly using SELECT apply_text_analyzer('Sample text here', 'analyzer1'); to inspect the resulting TEXT[] array before wiring it to a model.
1. Character Filters (character_filters)
to_lowercase
Converts all characters in the input text to lowercase.
unicode_normalization
Applies Unicode Normalization Forms (UAX #15) to standardize composed/decomposed characters, accents, and full-width/half-width variants.
Supported modes:
"nfc"— Normalization Form C (Canonical Decomposition followed by Canonical Composition)"nfd"— Normalization Form D (Canonical Decomposition)"nfkc"— Normalization Form KC (Compatibility Decomposition followed by Canonical Composition)"nfkd"— Normalization Form KD (Compatibility Decomposition)
2. Pre-Tokenizers (pre_tokenizer)
A text analyzer may specify at most one pre_tokenizer.
unicode_segmentation
Splits text on Unicode word boundaries according to the Unicode Standard Annex #29 (UAX #29) specification (via the Rust unicode-segmentation crate). Ideal for space-delimited and Western languages.
regex
Extracts tokens matching a custom regular expression (powered by the Rust regex crate):
jieba (Chinese Word Segmentation)
Segments Chinese text into words using the jieba-rs dictionary and Hidden Markov Model (HMM):
| Parameter | Type | Default | Description |
|---|---|---|---|
mode |
string |
"search" |
"full" (standard jieba.cut), "precise" (jieba.cut_all scanning all dictionary matches), or "search" (jieba.cut_for_search finer-grained segmentation for search recall). |
enable_hmm |
bool |
true |
Enables HMM recognition for out-of-vocabulary words ("full" and "search" modes only). |
3. Token Filters (token_filters)
Token filters run in the exact order listed in your TOML array.
skip_non_alphanumeric
Drops any token that contains no alphanumeric characters (such as standalone punctuation marks ,, ., ! left behind by word segmentation).
stemmer (Snowball Stemming — 30 Languages)
Reduces inflected words to their root stem using the Snowball stemming algorithms.
Supported stemmer values:
| Language | stemmer Value |
Language | stemmer Value |
|---|---|---|---|
| Arabic | arabic |
Lithuanian | lithuanian |
| Armenian | armenian |
Nepali | nepali |
| Basque | basque |
Norwegian | norwegian |
| Catalan | catalan |
Portuguese | portuguese |
| Danish | danish |
Romanian | romanian |
| Dutch | dutch |
Russian | russian |
| English (Porter) | english_porter |
Serbian | serbian |
| English (Porter2) | english_porter2 |
Spanish | spanish |
| Esperanto | esperanto |
Swedish | swedish |
| Estonian | estonian |
Tamil | tamil |
| Finnish | finnish |
Turkish | turkish |
| French | french |
Yiddish | yiddish |
| German | german |
||
| Greek | greek |
||
| Hindi | hindi |
||
| Hungarian | hungarian |
||
| Indonesian | indonesian |
||
| Irish | irish |
||
| Italian | italian |
stopwords
Removes common stopwords that carry little lexical signal.
- Built-in dictionaries:
"lucene_english"— Apache Lucene standard English stopword list"nltk_english"— NLTK standard English stopword list"iso_english"— Stopwords ISO English stopword list
- Custom stopword dictionary: Create your own with
create_stopwords(name, text)(one word per line) and reference it by name.
synonym
Normalizes synonymous terms to a single canonical token. Create a synonym dictionary with create_synonym(name, text) where each line contains space-separated synonyms (all words on a line are replaced by the first word on that line):
pg_dict (PostgreSQL Full-Text Dictionaries)
Delegates token filtering to any existing PostgreSQL Full-Text Search Dictionary (pg_ts_dict, including Simple, Ispell, Snowball, and Synonym dictionaries; note that Thesaurus dictionaries are not supported because they operate on multi-word phrases rather than single tokens):
ngram
Splits each token into character n-grams (useful for substring, prefix, CJK without dictionaries, or code/identifier search):
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
min_gram |
int |
1 |
1..=255 (<= max_gram) |
Minimum character length of generated n-grams. |
max_gram |
int |
2 |
1..=255 (>= min_gram) |
Maximum character length of generated n-grams. |
preserve_original |
bool |
false |
true / false |
Whether to also emit the original unsplit token if its length falls outside [min_gram, max_gram]. |
4 - Tokenization Models
In pg_tokenizer, a Model maps string tokens (or raw text) to integer token IDs (INT[]). You can choose from four built-in pretrained models, train a custom vocabulary model directly on your PostgreSQL table, import any HuggingFace tokenizer.json, or use a Lindera morphological model.
1. Built-in Pretrained Models
| Model Name | Source / Architecture | Requires text_analyzer? |
Memory Footprint | Best For |
|---|---|---|---|---|
llmlingua2 |
microsoft/llmlingua-2-xlm-roberta-large-meetingbank (XLM-RoBERTa multilingual subword) |
No (forbidden) | ~200 MB (default preloaded) | Multilingual general text out of the box without training a custom vocabulary. |
bert_base_uncased |
google-bert/bert-base-uncased (WordPiece, 30,522 vocab) |
No (forbidden) | ~15 MB | General English text; fast startup and compact vocabulary. |
wiki_tocken |
Snowolf/wiki-tocken (Built-in English Wikipedia token dictionary) |
Yes (required) | ~30 MB | English full-text search combined with custom stemmers, stopwords, and synonyms. |
gemma2b |
google/gemma-2b (SentencePiece BPE, 256k vocab) |
No (forbidden) | ~100 MB | Code, technical identifiers, and multilingual LLM workloads. |
Example: Using bert_base_uncased or llmlingua2
2. Custom Corpus Models (create_custom_model)
For maximum BM25 accuracy and minimal memory footprint, you can build a custom vocabulary model directly from your own table column. Unlike subword LLM tokenizers (which split rare domain words into multiple sub-tokens), a custom model assigns a dedicated 1:1 integer ID to every unique normalized token produced by your text_analyzer—and weighs only a few megabytes in memory.
Option A: One-Step Helper (create_custom_model_tokenizer_and_trigger)
This convenience function creates the custom model, creates the tokenizer, populates the target bm25vector column for all existing rows, and installs a BEFORE INSERT OR UPDATE trigger that automatically learns new vocabulary tokens and updates the bm25vector column when rows change:
Option B: Step-by-Step (create_custom_model Without Trigger)
If you prefer not to attach an automatic trigger (or want to control when embedding is populated):
3. Importing HuggingFace Tokenizers (create_huggingface_model)
You can import any HuggingFace tokenizers JSON specification (tokenizer.json) into PostgreSQL using create_huggingface_model.
In psql, you can fetch tokenizer.json directly from HuggingFace Hub into a variable using \set and pass it to create_huggingface_model:
Or pass the contents of a tokenizer.json file directly as a dollar-quoted string:
4. Lindera Morphological Models (create_lindera_model)
For East Asian languages such as Japanese, Korean, and Chinese that benefit from morphological dictionary analysis, pg_tokenizer integrates lindera.
For builds using Lindera 6.2, [segmenter] dictionary = "embedded://ipadic" is the native dictionary configuration. Existing [segmenter.dictionary] kind = "ipadic" configurations in the catalog and preload files remain supported, as do legacy dictionary and user-dictionary path tables. External compiled dictionaries must be rebuilt with Lindera 6.
Lindera 6.2 embeds the 2025-09-20 IPADIC edition instead of the 2007-08-01 edition used by Lindera 0.42. Token IDs change: regenerate stored Lindera token arrays and rebuild indexes that use them before querying with the upgraded tokenizer. Unknown words continue to be omitted.
If you build pg_tokenizer from source, enable the desired Lindera dictionary features at compile time:
Example configuration using ipadic with iteration mark normalization, NFKC Unicode normalization, character mapping, compound word merging, number normalization, Japanese part-of-speech stop-tags, Katakana stemming, and diacritical mark removal:
5. Model Preloading (add_preload_model)
Large models (llmlingua2 at ~200 MB, gemma2b at ~100 MB, japanese_ipadic) take several seconds and significant RAM to load on first query in each new PostgreSQL backend process. By preloading models during shared_preload_libraries startup, PostgreSQL loads the model once in the postmaster process and shares it across all backend connections via copy-on-write memory (llmlingua2 is preloaded by default):
Restart PostgreSQL after calling add_preload_model(...) (with shared_preload_libraries = 'pg_tokenizer.so' set in postgresql.conf) for preloading to take effect across all backends.
Custom model updates in 0.1.2 (unreleased)
Concurrent writes (0.1.2)
Vocabulary triggers deduplicate and sort new tokens and take a transaction-level advisory lock per model before writing. This serializes writers to the same vocabulary across all rows and statements in a transaction, preventing the opposite token-lock order that caused concurrent batch inserts to deadlock. Ordinary tokenization reads and writes to different models can proceed independently. Keep transactions short; when writing multiple models or locking application rows, use a consistent order and retain normal deadlock/serialization retry handling.
The embedding trigger refreshes its SPI snapshot after the vocabulary trigger, so at READ COMMITTED it can see token IDs committed by a writer it waited for. At REPEATABLE READ or SERIALIZABLE, a conflicting writer can receive SQLSTATE 40001 and must retry the whole transaction. Existing vocabulary IDs are preserved during upgrade; new IDs are internal mappings and are not guaranteed to match a separately created model.
Filtering a corpus (0.1.2)
Set filter in the custom model’s TOML configuration, or pass a seventh filter argument to the convenience helper:
The predicate uses source column names without NEW. or WHERE, and is evaluated with the caller’s privileges. Only TRUE matches; FALSE and NULL do not. Use a deterministic predicate of ordinary source columns, independent of the embedding target column; system columns such as ctid and volatile predicates are not supported. Provide a trusted SQL expression, with schema-qualified functions if needed; corpus selection does not replace row-level security. Empty or invalid expressions raise an error even for an empty table.
The filter applies to the initial vocabulary scan, embedding backfill, and future inserts/updates. Filtered models observe every UPDATE so changing only a predicate column can bring a row into the corpus. Nonmatching rows are left untouched, including existing embeddings; when a row leaves the corpus, its old embedding and vocabulary entries remain. Apply the same predicate when querying the corpus, or clear excluded embeddings in the application. Vocabulary is append-only and is not pruned on UPDATE/DELETE. A matching row with a NULL source has a NULL embedding.
Omitting filter (or passing SQL NULL to the helper) retains the whole-table behavior. Existing models and six-argument helper calls remain supported. Schema-qualified table names and quoted column names are supported; the stored table name is qualified when the model is created. Qualified names take precedence over a literal name containing a dot; use SQL double quotes (for example, '"corpus.docs"') to select the latter explicitly.
5 - Multilingual Recipes & Limitations
This page provides production-ready tokenization recipes for English, Chinese, and Japanese full-text BM25 search, followed by important operational limitations to keep in mind.
Recipe 1: English with Stemming & Stopwords (wiki_tocken)
Combines Unicode word segmentation, NLTK stopwords removal, and Porter2 stemming with the built-in Wikipedia vocabulary (wiki_tocken):
Recipe 2: English Custom Corpus Model with Trigger
From the upstream pg_tokenizer examples, this workflow builds a domain-specific English vocabulary from your documents table and keeps embeddings updated automatically via trigger:
Recipe 3: Chinese Full-Text Search (jieba + Custom Model)
For Chinese text, combine the jieba pre-tokenizer (mode = "search", enable_hmm = true) with a custom corpus model trained on your table (demonstrated below using passages from Qian Zhongshu’s Fortress Besieged / 《围城》):
Recipe 4: Japanese Full-Text Search (lindera IPADIC)
When upgrading from Lindera 0.42 to 6.2, regenerate stored token arrays and rebuild their indexes because the IPADIC token IDs change. The dictionary configuration below remains supported; see the Lindera migration notes.
For Japanese text, create a Lindera IPADIC morphological model with iteration mark normalization, NFKC normalization, Japanese stop-tag filtering, and Katakana stemming (demonstrated below using passages from Natsume Sōseki’s I Am a Cat / 《吾輩は猫である》):
Operational Notes & Known Limitations
- Object Name Validation: All names for tokenizers, text analyzers, models, stopword dictionaries, and synonym dictionaries must contain only alphanumeric characters and underscores (
[A-Za-z0-9_]), and must not start with a digit. - Transaction Rollback & Per-Connection Object Cache: Each PostgreSQL connection caches
tokenizer,text_analyzer,model,stopwords, andsynonymobjects in backend memory (DashMap). Because this in-memory object pool is not tied to PostgreSQL’s transaction rollback callbacks, rolling back a transaction (ROLLBACK) reverts thetokenizer_catalogtables on disk, but the current connection’s in-memory cache still holds the created object. After aROLLBACK, explicitly call the correspondingdrop_*function (or reconnect) to clear the in-memory cache: - Preload Models Across Replicas:
add_preload_modelwrites the preload model list to the local$PGDATA/pg_tokenizerdirectory on the primary node. Because filesystem files outside PostgreSQL relations are not replicated via WAL, you should runadd_preload_modelon read replicas independently if you preload models there. - Memory Consumption of Built-in LLM Models: Models like
llmlingua2(~200 MB),gemma2b(~100 MB), andlinderaconsume significant memory. Always useadd_preload_modelin production so the model is loaded once in the postmaster process rather than duplicated per connection, or prefer a custom corpus model (create_custom_model) which uses only a few megabytes.
6 - SQL & TOML Reference
SQL Functions (tokenizer_catalog)
Text Analyzer & Dictionaries
| Function Signature | Return Type | Description |
|---|---|---|
tokenizer_catalog.create_text_analyzer(name TEXT, config TEXT) |
VOID |
Creates a named text analyzer pipeline from a TOML string. |
tokenizer_catalog.drop_text_analyzer(name TEXT) |
VOID |
Drops a text analyzer by name. |
tokenizer_catalog.apply_text_analyzer(text TEXT, text_analyzer_name TEXT) |
TEXT[] |
Splits and filters text using the named text analyzer for inspection/debugging. |
tokenizer_catalog.create_stopwords(name TEXT, config TEXT) |
VOID |
Creates a custom stopword dictionary (one word per line). |
tokenizer_catalog.drop_stopwords(name TEXT) |
VOID |
Drops a custom stopword dictionary. |
tokenizer_catalog.create_synonym(name TEXT, config TEXT) |
VOID |
Creates a custom synonym dictionary (space-separated synonyms per line). |
tokenizer_catalog.drop_synonym(name TEXT) |
VOID |
Drops a custom synonym dictionary. |
Tokenization Models & Preloading
| Function Signature | Return Type | Description |
|---|---|---|
tokenizer_catalog.create_custom_model(name TEXT, config TEXT) |
VOID |
Builds a custom vocabulary model on an existing table column. |
tokenizer_catalog.create_custom_model_tokenizer_and_trigger(tokenizer_name TEXT, model_name TEXT, text_analyzer_name TEXT, table_name TEXT, source_column TEXT, target_column TEXT [, filter TEXT]) |
VOID |
Creates a custom model and tokenizer, backfills target_column, and installs triggers. Version 0.1.2 adds an optional SQL predicate; omit it or pass NULL to include all rows. |
tokenizer_catalog.drop_custom_model(name TEXT) |
VOID |
Drops a custom vocabulary model. |
tokenizer_catalog.create_huggingface_model(name TEXT, config TEXT) |
VOID |
Imports a HuggingFace tokenizer.json model specification. |
tokenizer_catalog.drop_huggingface_model(name TEXT) |
VOID |
Drops an imported HuggingFace model. |
tokenizer_catalog.create_lindera_model(name TEXT, config TEXT) |
VOID |
Creates a Lindera morphological analyzer model from TOML config. |
tokenizer_catalog.drop_lindera_model(name TEXT) |
VOID |
Drops a Lindera model. |
tokenizer_catalog.add_preload_model(name TEXT) |
VOID |
Adds a model to the shared memory preload list (takes effect on PostgreSQL restart). |
tokenizer_catalog.remove_preload_model(name TEXT) |
VOID |
Removes a model from the preload list. |
tokenizer_catalog.list_preload_models() |
TEXT[] |
Lists all models currently registered for preloading. |
Tokenizer Execution
| Function Signature | Return Type | Description |
|---|---|---|
tokenizer_catalog.create_tokenizer(name TEXT, config TEXT) |
VOID |
Creates a tokenizer combining an optional text_analyzer and a model. |
tokenizer_catalog.drop_tokenizer(name TEXT) |
VOID |
Drops a tokenizer by name. |
tokenizer_catalog.tokenize(text TEXT, tokenizer_name TEXT) |
INT[] |
Tokenizes text into an array of integer token IDs (implicitly castable to bm25vector). |
Native full-text search (0.1.2, unreleased)
| Function Signature | Return Type | Description |
|---|---|---|
tokenizer_catalog.analyze_to_tsvector(text TEXT, text_analyzer_name TEXT) |
TSVECTOR |
Analyzer string tokens as native lexemes, with output positions. |
tokenizer_catalog.tokenize_to_tsvector(text TEXT, tokenizer_name TEXT) |
TSVECTOR |
Model IDs as decimal lexemes, with output positions. |
These functions are STABLE. Store the result in a column for GIN/GiST indexing; use the same lexeme representation for documents and queries. See positions and native limits.
TOML Configuration Options
text_analyzer Options
| Key | Type | Description |
|---|---|---|
character_filters |
Array of Table / String | Character-level transformations (to_lowercase, unicode_normalization = "nfc" | "nfd" | "nfkc" | "nfkd"). |
pre_tokenizer |
Table / String | Initial token splitter (unicode_segmentation, regex = "...", or jieba). |
token_filters |
Array of Table / String | Token-level filters (skip_non_alphanumeric, stemmer, stopwords, synonym, pg_dict, ngram). |
tokenizer Options
| Key | Type | Description |
|---|---|---|
text_analyzer |
String | Name of a pre-created text_analyzer (or inline [text_analyzer] table). Omit for standalone subword models. |
model |
String | Built-in model (llmlingua2, bert_base_uncased, wiki_tocken, gemma2b) or custom/HuggingFace/Lindera model name. |
custom_model Options
| Key | Type | Description |
|---|---|---|
table |
String | Source table name containing training documents; schema qualification is supported in 0.1.2. |
column |
String | Source TEXT column name. |
text_analyzer |
String | Name of the text_analyzer used to extract vocabulary tokens. |
filter |
String | Optional trusted SQL Boolean expression over source columns, without WHERE (0.1.2). FALSE/NULL rows are skipped for training and embedding updates. |