/** * Group heads and sort keys of a back-of-book index in Chinese and in * Arabic. * * Chinese (#182): the Latin initial of * the pinyin reading (A–Z) or the stroke count (一畫, 二畫 …) of an entry's * first character. * * No reading or stroke data ships with the engine. The collator the index * already sorts with knows both: CLDR's Chinese collations (`zh-u-co-pinyin`, * `zh-u-co-stroke`) order the characters by reading or by stroke count, and * place an index marker right before each group — U+FDD0 followed by the * letter, or by U+2800 + the stroke count (what ICU's AlphabeticIndex * reads). An entry's group is the last marker that sorts before its first * character, found by binary search. A collator without the markers (an * older ICU) is searched with the first character of each group instead, * generated from ICU 78's markers and checked by `indexChinese.test.ts`. * A collator that does not sort by reading or by strokes at all gives no * groups: the index then has no heads. * * Arabic (#372): entries sort and group by a key that drops what an Arabic * index ignores (see {@link arabicSortKey}), in the `ar` collation, whose * order is the hijāʾī one (ا ب ت ث … ن ه و ي); the head of a group is the * key's first letter. * * Japanese (#425): see `indexJapanese.ts`. */ /** How the entries of an index are grouped under heads (`index.groupBy`). */ export type IndexGrouping = 'letter' | 'pinyin' | 'stroke' | 'gojuon' | 'kana' | 'none'; /** The pinyin initials that open a group: no syllable starts with I, U or * V. */ export declare const PINYIN_INITIALS: readonly string[]; /** The first character of each pinyin group of {@link PINYIN_INITIALS} in * the `zh` pinyin collation (CLDR, ICU 78). */ export declare const PINYIN_BOUNDARIES: readonly string[]; /** The stroke counts that open a group in the `zh` stroke collation (CLDR, * ICU 78): no character has 34, 37, 38 or 40–47 strokes. */ export declare const STROKE_COUNTS: readonly number[]; /** The first character of each stroke group of {@link STROKE_COUNTS}. */ export declare const STROKE_BOUNDARIES: readonly string[]; /** The collator's index marker before the pinyin group of `letter`. */ export declare const pinyinMarker: (letter: string) => string; /** The collator's index marker before the group of `strokes` strokes. */ export declare const strokeMarker: (strokes: number) => string; /** Whether `collator` can group by `grouping`. */ export declare function canGroupBy(collator: Intl.Collator, grouping: 'pinyin' | 'stroke'): boolean; /** The pinyin initial (`'J'` for 贾) of the Han character `ch`, or * undefined when `collator` has no pinyin groups. */ export declare function pinyinInitial(collator: Intl.Collator, ch: string): string | undefined; /** The stroke count group (`13` for 賈) of the Han character `ch`, or * undefined when `collator` has no stroke groups. */ export declare function strokeGroup(collator: Intl.Collator, ch: string): number | undefined; /** The head of a stroke group: 一畫, 十三畫 (Traditional), 十三画 * (Simplified). */ export declare function strokeLabel(strokes: number, traditional: boolean): string; /** The grouping `index.groupBy` asks for in `locale`: `auto` groups a * Simplified Chinese index by pinyin, a Traditional one by strokes, a * Japanese one by gojūon row (#425), any other by first letter. */ export declare function indexGrouping(groupBy: string | undefined, locale: string): IndexGrouping; /** The locale an index grouped by `grouping` sorts in, so that its heads * and its order agree: a Chinese locale with the collation named * (`zh-Hant-u-co-pinyin`), Chinese otherwise (`zh-u-co-pinyin`, * `zh-Hant-u-co-stroke`). */ export declare function sortLocaleFor(locale: string, grouping: IndexGrouping): string; /** * The key an Arabic index entry sorts and groups by, from its text as * written: * 1. the vowel signs and tatweel go (ٱلْكِتَابُ reads as الكتاب); * 2. with `ignoreArticle`, a leading article goes (البصرة → بصرة, between * بدر and بغداد); الله keeps it; * 3. presentation forms and ligatures are decomposed (ﻻ → لا), and the * signs left on Arabic letters dropped, which takes the hamza off its * seat (أحمد, إبراهيم, آدم → ا; مؤمن → مومن); * 4. ٱ, ء → ا; ى → ي; ة → ه. * Only Arabic letters change: a Latin word keeps its accents (the collator * weighs them as it always does). */ export declare function arabicSortKey(text: string, ignoreArticle: boolean): string; //# sourceMappingURL=indexGroups.d.ts.map