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

31 lines (30 loc) • 1.69 kB
/** * LocalAgreement for rolling re-transcription. * * Each interim pass re-transcribes the whole utterance so far. Words two * consecutive passes agree on are committed; the rest is the tail, which the * next pass may still change. The committed prefix never shrinks: once a * caption has been shown as stable it must not flicker back, even when a * later pass hears the start differently (the next final pass is the place * where the whole utterance is settled). * * @module voice/streaming/localAgreement */ import type { STTLocalAgreementState, STTLocalAgreementUpdate } from "../../types/index.js"; /** Splits a transcript into words on any whitespace. */ export declare function splitWords(text: string): string[]; /** Length of the shared prefix of two word lists. */ export declare function commonPrefixLength(a: string[], b: string[]): number; export declare function createLocalAgreement(): STTLocalAgreementState; /** * Folds one pass into the state and returns the split for display. Words * this pass agrees on with the previous one, beyond what is already * committed, are appended to the committed list; the words already committed * are kept as they were shown — they are never re-read from the new pass, so * a later pass that hears the start differently (or comes back shorter) * cannot shrink or rewrite them. The tail is whatever this pass has past the * committed count. */ export declare function updateLocalAgreement(state: STTLocalAgreementState, text: string): STTLocalAgreementUpdate; /** Forgets everything, e.g. when another engine takes the utterance over. */ export declare function resetLocalAgreement(state: STTLocalAgreementState): void;