echogarden
Version:
An easy-to-use speech toolset. Includes tools for synthesis, recognition, alignment, speech translation, language detection, source separation and more.
52 lines (51 loc) • 2.49 kB
TypeScript
import { ParagraphBreakType, WhitespaceProcessing } from '../api/Common.js';
import * as TextSegmentation from '@echogarden/text-segmentation';
export declare const wordCharacterRegExp: RegExp;
export declare const emojiSequenceRegExp: RegExp;
export declare const punctuationRegExp: RegExp;
export declare const phraseSeparators: string[];
export declare const symbolWords: string[];
export declare function isWordOrSymbolWord(str: string): boolean;
export declare function isSymbolWord(str: string): boolean;
export declare function isWord(str: string): boolean;
export declare function includesPunctuation(str: string): boolean;
export declare function includesEmoji(str: string): boolean;
export declare function isWhitespace(str: string): boolean;
export declare function splitToParagraphs(text: string, paragraphBreakType: ParagraphBreakType, whitespaceProcessingMethod: WhitespaceProcessing): string[];
export declare function splitToLines(text: string): string[];
export declare function parseText(text: string, langCode: string): Promise<TextSegmentation.SegmentationResult>;
export declare function splitToWords(text: string, langCode: string): Promise<TextSegmentation.WordSequence>;
export declare function applyWhitespaceProcessing(text: string, whitespaceProcessingMethod: WhitespaceProcessing): string;
export declare function splitToFragments(text: string, maxFragmentLength: number, langCode: string, preserveSentences?: boolean, preservePhrases?: boolean): Promise<Fragment[]>;
export declare function parseTextAndConvertToFragmentObjects(text: string, langCode: string): Promise<Sentence[]>;
export declare class Sentence {
phrases: Phrase[];
readonly isSentenceFinalizer = true;
get length(): number;
get text(): string;
}
export declare class Phrase {
words: Word[];
get length(): number;
get text(): string;
get lastWord(): Word | undefined;
get isSentenceFinalizer(): boolean;
}
export declare class Word {
readonly text: string;
isSentenceFinalizer: boolean;
constructor(text: string, isSentenceFinalizer: boolean);
get containsOnlyPunctuation(): boolean;
get isSymbolWord(): boolean;
get isPhraseSeperator(): boolean;
get length(): number;
}
export type Segment = Sentence | Phrase | Word;
export declare class Fragment {
segments: Segment[];
get length(): number;
get text(): string;
get isEmpty(): boolean;
get isNonempty(): boolean;
get lastSegment(): Segment | undefined;
}