|
| 1 | +export type WhiteSpaceMode = 'normal' | 'pre-wrap'; |
| 2 | +export type WordBreakMode = 'normal' | 'keep-all'; |
| 3 | +export type SegmentBreakKind = 'text' | 'space' | 'preserved-space' | 'tab' | 'glue' | 'zero-width-break' | 'soft-hyphen' | 'hard-break'; |
| 4 | +export type MergedSegmentation = { |
| 5 | + len: number; |
| 6 | + texts: string[]; |
| 7 | + isWordLike: boolean[]; |
| 8 | + kinds: SegmentBreakKind[]; |
| 9 | + starts: number[]; |
| 10 | +}; |
| 11 | +export type AnalysisChunk = { |
| 12 | + startSegmentIndex: number; |
| 13 | + endSegmentIndex: number; |
| 14 | + consumedEndSegmentIndex: number; |
| 15 | +}; |
| 16 | +export type TextAnalysis = { |
| 17 | + normalized: string; |
| 18 | + chunks: AnalysisChunk[]; |
| 19 | +} & MergedSegmentation; |
| 20 | +export type AnalysisProfile = { |
| 21 | + carryCJKAfterClosingQuote: boolean; |
| 22 | + breakKeepAllAfterPunctuation: boolean; |
| 23 | +}; |
| 24 | +export declare function normalizeWhitespaceNormal(text: string): string; |
| 25 | +export declare function clearAnalysisCaches(): void; |
| 26 | +export declare function setAnalysisLocale(locale?: string): void; |
| 27 | +export declare function isCJK(s: string): boolean; |
| 28 | +export declare function canContinueKeepAllTextRun(previousText: string, breakAfterPunctuation: boolean): boolean; |
| 29 | +export declare const kinsokuStart: Set<string>; |
| 30 | +export declare const kinsokuEnd: Set<string>; |
| 31 | +export declare const leftStickyPunctuation: Set<string>; |
| 32 | +export declare function endsWithClosingQuote(text: string): boolean; |
| 33 | +export declare function isNumericRunSegment(text: string): boolean; |
| 34 | +export declare function analyzeText(text: string, profile: AnalysisProfile, whiteSpace?: WhiteSpaceMode, wordBreak?: WordBreakMode): TextAnalysis; |
0 commit comments