@dornick/parsers-ml
v0.1.0
Published
Lazy transformers.js wrappers for Dornick — local embeddings, NER, summarisation. WebGPU preferred, WASM fallback.
Readme
@dornick/parsers-ml
Lazy transformers.js wrappers for Dornick — local embeddings, NER, summarisation.
Three text-only parsers. WebGPU preferred (auto-detected); falls back to WASM. Model downloads are cached by the browser.
Install
npm i @dornick/parsers-mlDepends on @huggingface/transformers. The library is ~1-2 MB and the per-task models 80-300 MB on first use, cached by the browser thereafter.
Use
import { Dornick } from "@dornick/core";
import { embeddingsParser, nerParser, summaryParser } from "@dornick/parsers-ml";
const dornick = new Dornick({ config, transport });
dornick.parsers.add(embeddingsParser);
dornick.parsers.add(nerParser);
dornick.parsers.add(summaryParser);Paths produced
For any text-like upload (text/*, .md, .json):
| Path | Content |
|---|---|
| embeddings.jsonl | One JSON object per ~1.2KB chunk: { chunk, vector } (MiniLM, 384-dim, mean-pooled + L2-normalised) |
| ner.jsonl | Detected entity spans: { entity_group, word, score, start, end } |
| summary.txt | Short summary (~80 tokens) via DistilBART CNN |
Models
| Parser | Default model |
|---|---|
| embeddingsParser | Xenova/all-MiniLM-L6-v2 |
| nerParser | Xenova/bert-base-NER |
| summaryParser | Xenova/distilbart-cnn-6-6 |
These models are first-class compatible with @huggingface/transformers. The model files load from the Hugging Face CDN on first parse and cache via the browser's HTTP cache. For offline / strict-CSP deployments, vendor the model files yourself and configure transformers.js's env accordingly.
Capability gate
requires: ["wasm"] — all three parsers run anywhere WebAssembly is supported. WebGPU is preferred and used automatically when available (navigator.gpu); otherwise the parser falls back to WASM (slower but identical results).
Pairs nicely with
@dornick/parsers-pdf— pipe PDF-extracted text through embeddings for local semantic search.@dornick/parsers-archive— index entries inside a Takeout / Slack export.
See also
License
MIT — © Dipankar Sarkar
