geneea-nlp-client
Version:
The TypeScript Client for Geneea Interpretor G3 API.
38 lines (37 loc) • 1.35 kB
TypeScript
/**
* A tool for [converting][convert] a sorted series of code-point offsets in a [text]
* to JavaScript string character offsets.
*/
declare class Cp2JSOffsetConverter {
private lastCharOffset;
private lastCodepointOffset;
private textArray;
constructor(text: string);
/**
* Converts a codepoint offset in [text] to a JS-char-based-offset.
*
* @param codepointOffset The offset in code points.
* @throws RangeError if the [codepointOffset] is out of bounds of [text],
* or when its value in this call is smaller than in the previous call.
*/
convert(codepointOffset: number): number;
}
/**
* A tool for [converting][convert] a sorted series of JavaScript string character offsets
* in a [text] to code-point offsets.
*/
declare class JS2CpOffsetConverter {
text: string;
private lastCodepointOffset;
private lastCharOffset;
constructor(text: string);
/**
* Converts a JavaScript string char-based offset in [text] to a codepoint offset.
*
* @param charOffset The offset in JavaScript string characters.
* @throws RangeError if the [charOffset] is out of bounds of [text],
* or when its value in this call is smaller than in the previous call.
*/
convert(charOffset: number): number;
}
export { Cp2JSOffsetConverter, JS2CpOffsetConverter };