Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions dist/analysis.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export type WhiteSpaceMode = 'normal' | 'pre-wrap';
export type WordBreakMode = 'normal' | 'keep-all';
export type SegmentBreakKind = 'text' | 'space' | 'preserved-space' | 'tab' | 'glue' | 'zero-width-break' | 'soft-hyphen' | 'hard-break';
export type MergedSegmentation = {
len: number;
texts: string[];
isWordLike: boolean[];
kinds: SegmentBreakKind[];
starts: number[];
};
export type AnalysisChunk = {
startSegmentIndex: number;
endSegmentIndex: number;
consumedEndSegmentIndex: number;
};
export type TextAnalysis = {
normalized: string;
chunks: AnalysisChunk[];
} & MergedSegmentation;
export type AnalysisProfile = {
carryCJKAfterClosingQuote: boolean;
};
export declare function normalizeWhitespaceNormal(text: string): string;
export declare function clearAnalysisCaches(): void;
export declare function setAnalysisLocale(locale?: string): void;
export declare function isCJK(s: string): boolean;
export declare function canContinueKeepAllTextRun(previousText: string): boolean;
export declare const kinsokuStart: Set<string>;
export declare const kinsokuEnd: Set<string>;
export declare const leftStickyPunctuation: Set<string>;
export declare function endsWithClosingQuote(text: string): boolean;
export declare function isNumericRunSegment(text: string): boolean;
export declare function analyzeText(text: string, profile: AnalysisProfile, whiteSpace?: WhiteSpaceMode, wordBreak?: WordBreakMode): TextAnalysis;
Loading