UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

35 lines (34 loc) • 1.95 kB
/** * Language codes and writing systems for the transcribe pipeline. * * Engines report languages in different shapes ("hi", "hin", "Hindi", * "en-US"); routing, correction and output rendering need one: a lower-case * ISO 639 code. Output targets are BCP-47 tags whose script subtag says how * the text is written (`hi-Latn` is Hindi in Latin letters), and the guards * on a rendering check the text against that script. * * @module voice/languages */ import type { ParsedOutputTag, ScriptCode } from "../types/index.js"; /** * The language part of whatever an engine reported, as a lower-case ISO 639 * code: "en-US" → "en", "Hindi" → "hi", "auto-ta" → "ta". `undefined` for * nothing, "auto" and "und". */ export declare function normalizeLanguageCode(value: string | undefined): string | undefined; export declare function isIndicLanguage(language: string | undefined): boolean; /** Letters of each script in `text`; scripts with none are absent. */ export declare function scriptCounts(text: string): Map<ScriptCode, number>; /** The script most letters of `text` are in, `undefined` for text without letters. */ export declare function dominantScript(text: string): ScriptCode | undefined; /** Whether `text` holds letters of an Indic script (Devanagari through Sinhala). */ export declare function hasIndicScript(text: string): boolean; /** * A BCP-47 output tag: language, optional script, optional region * (`es`, `fr-CA`, `hi-Latn`, `zh-Hant`). `undefined` for anything else. */ export declare function parseOutputTag(tag: string): ParsedOutputTag | undefined; /** Share of `text`'s letters written in `script` (Japanese accepts kanji as well as kana). */ export declare function scriptShare(text: string, script: ScriptCode): number; /** "es" → "Spanish", "hi-Latn" → "Hindi (Latin script)"; the tag itself when the runtime cannot name it. */ export declare function describeOutputTag(tag: string): string;