← All packages

@lacspace/screen

v1.0.0LLM Efficiency0 deps

A cheap lexical content screener and LLM admission gate — score text against your own weighted, multi-language term lexicons (with negation, proximity windows and a named-entity gazetteer) and get a clear / review / block decision, so obviously-clean and obviously-flagged text never reaches an expensive model. Deterministic, auditable, isomorphic.

npm i @lacspace/screen

Usage

screen.ts
import { createScreen } from "@lacspace/screen";

const screen = createScreen({
  dimensions: {
    death:    { terms: ["died", "killed", "\u092e\u0943\u0924\u094d\u092f\u0941"] },
    minor:    { terms: ["child", "\u092c\u093e\u0932\u092c\u093e\u0932\u093f\u0915\u093e"], forceReview: true },
    hate:     { terms: [/* your list */], weight: 3, forceBlock: true },
  },
  negations: ["no", "not", "-\u0928", "-\u0928\u0928\u094d"],
  gazetteer: ["\u0915\u093e\u0920\u092e\u093e\u0921\u094c\u0902"],
  thresholds: { clear: 0, review: 1, block: 5 },
});

const r = screen(storyText);
r.decision; // "clear" | "review" | "block"
if (r.decision === "review") await askTheModel(storyText); // only the uncertain ones reach the LLM

Exports 2

createScreenscreenText

Keywords

content-moderationlexicalscreenertriagellm-gateadmission-controlclassifiernegationgazetteersensitivity

More in LLM Efficiency