@exellix/narrix-adapter-text
v2.0.0
Published
CNI v1.1 adapter: raw text to normalized content, chunks, and entity references
Readme
@exellix/narrix-adapter-text
Builds CNI v1.1 from a raw text string: normalize, hash, chunk, entity extraction, and diagnostics. No scoper/detector; no timestamps unless the caller supplies them.
Install
npm install @exellix/narrix-adapter-textWith GitHub Package Registry (private org), ensure .npmrc includes:
@exellix:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKENUsage
import { adapter, toCni, type TextAdapterInput } from "@exellix/narrix-adapter-text";
const input: TextAdapterInput = {
text: "Your raw text here.",
sourceId: "file:///doc/123", // optional, for stable subject ID
title: "Optional title",
language: "en",
};
const { cni, diagnostics } = adapter.toCni(input);
// or: toCni(input, options)API
adapter–NarrixAdapter<TextAdapterInput>(implementstoCni(input, options?)).toCni(input, options?)– Returns{ cni, diagnostics }.TextAdapterInput–{ text, sourceId?, title?, language?, sourceMeta?, meta? }.
Dependencies
@exellix/narrix-cni(^1.1.0)@exellix/narrix-adapters-core(^1.0.0)
Scripts
npm run build– Compile TypeScript todist/.npm test– Run golden tests (fixtures intest/fixtures/).
To regenerate expected fixtures after changing adapter behavior: run npm run build then node test/generate-expected.mjs.
Spec
See docs/spec.md for T1–T7 behavior, invariants, and fixture conventions.
Repository and publish
- Git remote:
[email protected]:exellix/narrix-adapters-text.git - Publish to GitHub Packages: With a local
.npmrccontaining//npm.pkg.github.com/:_authToken=..., run:npm publish
