indickit 0.6.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,13 @@
10
10
  *
11
11
  * @module
12
12
  */
13
+ /** @internal For ./phonetic-search: the engine compiler, the normalizer and the
14
+ * search key's engine (keys of a normalized word). Not part of the API. */
15
+ export declare const _internal: {
16
+ compile: (r: unknown) => (word: string) => string[];
17
+ normalize: (w: string) => string;
18
+ engine: (word: string) => string[];
19
+ };
13
20
  /** The rules every key from this module was made with. */
14
21
  export declare const RULES_VERSION: string;
15
22
  /** NameKeys stops here: a long Tamil name can have many key combinations. */
@@ -23,6 +30,13 @@ export declare function words(name: string): string[];
23
30
  * separated by a space. Two names match when these share an element, so
24
31
  * these are what to index. At most MAX_NAME_KEYS. */
25
32
  export declare function nameKeys(name: string): string[];
33
+ /** Joined keys shorter than this (in classes) are not returned: they find too many names. */
34
+ export declare const JOINED_MIN_CLASSES: number;
35
+ /** The keys of a name written as one word, its words joined: "Ram Nath" and
36
+ * இராம்நாத் share no nameKeys, but can share a joined key. Only keys of at
37
+ * least JOINED_MIN_CLASSES classes. A search looks them up only when
38
+ * nameKeys find nobody; match does not use them. */
39
+ export declare function joinedKeys(name: string): string[];
26
40
  /** Whether two names have the same number of words and every pair of words,
27
41
  * in order, shares a key. */
28
42
  export declare function match(a: string, b: string): boolean;
@@ -6,6 +6,7 @@
6
6
  * least two code points; in languages with the vowel step it then drops one
7
7
  * final vowel sign (the Dravidian enunciative u). A word with no listed
8
8
  * ending is its own stem, and so is every word of a language with no table.
9
+ * Kannada, whose endings stack, runs all of this twice.
9
10
  *
10
11
  * A stem is a key, not text. Apply `stem` once to the words you index and
11
12
  * once to the query, and compare. stem(stem(w)) may cut again, as Snowball
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The Unicode data indickit reads inside the blocks it has rules for (Arabic,
3
+ * Devanagari to Malayalam, Ol Chiki, Vedic, Devanagari Extended, Meetei
4
+ * Mayek): one pinned table, internal/unidata/unicode15.json, which the Go
5
+ * package internal/unidata also reads. So Go and TypeScript give one answer
6
+ * whatever Unicode version the engine ships, and a move to a new Unicode
7
+ * version is a change to the table: a rules change, with a conformance run
8
+ * (MAINTAINING.md, "Upkeep").
9
+ *
10
+ * Outside the blocks the engine answers (`\p{..}`, `String.prototype.normalize`).
11
+ * The Latin blocks indickit also reads are closed (every code point is
12
+ * assigned), and Unicode's stability policy freezes the decomposition and
13
+ * combining class of an assigned code point, so the engine cannot drift there.
14
+ *
15
+ * @module
16
+ */
17
+ /** The Unicode version of the table. */
18
+ export declare const UNICODE_VERSION: string;
19
+ /** Whether the table answers for this code point. */
20
+ export declare const inBlocks: (cp: number) => boolean;
21
+ /** General_Category Mn. */
22
+ export declare function isMn(cp: number): boolean;
23
+ /** General_Category Mn, Mc or Me. */
24
+ export declare function isMark(cp: number): boolean;
25
+ /** General_Category L. */
26
+ export declare function isLetter(cp: number): boolean;
27
+ /** The full canonical decomposition of one code point. */
28
+ export declare function nfd(cp: number): number[];
29
+ /**
30
+ * Unicode NFC. The string is cut before each stable code point of the
31
+ * blocks. A piece made only of code points of the blocks is composed from
32
+ * the table; a piece holding any other code point goes to the engine, whose
33
+ * data for the blocks' assigned code points equals the table's (stability
34
+ * policy), and which alone knows the combining classes outside the blocks.
35
+ */
36
+ export declare function nfc(s: string): string;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * wellformed: can a font draw this text whole? A text renderer (HarfBuzz)
3
+ * draws a dotted circle (◌) where a character cannot join the syllable
4
+ * before it: a vowel sign with no letter before it (ि at the start of a
5
+ * word, as PDF text layers give it), a vowel sign after a virama, a third
6
+ * anusvara. isWellFormed("िहन्दी") is false; brokenAt gives the index
7
+ * of the first such character. Use it to reject or flag text before you
8
+ * store or index it.
9
+ *
10
+ * The rules are HarfBuzz's own verdicts, swept over every character after
11
+ * every character of each script, and kept in rules.json; this code only
12
+ * walks them. A text is cut into runs of one script (with the invisible
13
+ * characters and the placeholders NBSP and ◌ between them); a space, a
14
+ * digit or a letter of another script ends a run. In a run, a character is
15
+ * broken when it starts the run and its class is in the start set, or the
16
+ * widest window that holds its class and up to three classes before it
17
+ * says so (quads, then triples, then pairs), or it ends the run and its
18
+ * class is pending (Malayalam dot reph ൎ, which waits for a consonant).
19
+ *
20
+ * Arabic and Ol Chiki runs are always whole: HarfBuzz draws no dotted
21
+ * circle inside them. Only HarfBuzz was tested; DirectWrite and CoreText
22
+ * have their own grammars.
23
+ *
24
+ * @module
25
+ */
26
+ /** True when a font draws text with no dotted circle. */
27
+ export declare function isWellFormed(text: string): boolean;
28
+ /** The UTF-16 index of the first character a font draws with a dotted circle, or -1. */
29
+ export declare function brokenAt(text: string): number;
30
+ /** The rules version; a stored verdict goes stale when it changes. */
31
+ export declare const RULES_VERSION: string;
@@ -0,0 +1 @@
1
+ var o={version:"2026-10-07",invisible:"‌‍​⁠\uFEFF­",placeholder:" ◌",scripts:{Devanagari:{names:["Avagraha","Bindu","Bindu.1","Cantillation_Mark","Cantillation_Mark.1","Consonant","Consonant.1","Consonant.2","Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Nukta","Number","Other","Other.1","Other.2","Placeholder","Virama","Visarga","Vowel_Dependent","Vowel_Dependent.1","Vowel_Dependent.2","Vowel_Dependent.3","Vowel_Dependent.4","Vowel_Dependent.5","Vowel_Dependent.6","Vowel_Independent","Vowel_Independent.1","Vowel_Independent.2","Vowel_Independent.3","Vowel_Independent.4","Vowel_Independent.5"],blocks:{"0900":"111ltuvwtxtttttyttttt5555555555555555555555555556555555555mne0noopoooqqrsnnnnkong34hhonn77777777ttooggffffffffffggtttttt55555555",A8E0:"33333333333333333322iiiiggggggto"},shared:"bacd89jj",start:"134ehklmnopqrs",pending:"",pairs:{"0":"kmnopqrs","1":"ekmnopqrs","2":"kmnopqrs","3":"1hlmnopqrs","4":"1hlmnopqrs","8":"134ehklmnopqrs","9":"134ehklmnopqrs",a:"134ehklmnopqrs",b:"134ehklmnopqrs",c:"134ehklmnopqrs",d:"134ehklmnopqrs",g:"134ehklmnopqrs",h:"4mnopqrs",i:"kmnopqrs",k:"kmnopqrs",l:"ekmnopqrs",u:"mnq",v:"mqrs",x:"p",y:"qr"},triples_broken:{"03":"k","04":"k","0e":"ekmnopqrs","0h":"k","11":"1hl","13":"ek","14":"ek","1h":"1ehkl","1l":"1hl","23":"k","24":"k","2e":"ekmnopqrs","2h":"k","3e":"1hlmnopqrs","3k":"1hl","4e":"1hlmnopqrs","4k":"1hl","6k":"w","7e":"e",ee:"e",h1:"1hl",h3:"4",he:"4mnopqrs",hh:"1hl",hk:"4",hl:"1hl",i3:"k",i4:"k",ie:"ekmnopqrs",ih:"k",k3:"k",k4:"k",ke:"kmnopqrs",kh:"k",l1:"1hl",l3:"ek",l4:"ek",lh:"1ehkl",ll:"1hl",me:"e",ne:"e",oe:"e",pe:"e",qe:"e",re:"e",se:"e"},triples_whole:{"0a":"1hl","0b":"1hl","1b":"34","2a":"1hl","2b":"1hl","5a":"134ehklmnopqrs","5b":"1hklmnopqrs","6a":"134ehklmnopqrs","6b":"1hklmnopqrs","7a":"1hklmnopqrs","7b":"1hklmnopqrs",ea:"1hklmnopqrs",eb:"1hklmnopqrs",fa:"1hklmnopqrs",fb:"1hklmnopqrs",hb:"34",ia:"1hl",ib:"1hl",ja:"1hklmnopqrs",jb:"1hklmnopqrs",ka:"134ehl",kb:"134hl",lb:"34",ma:"1hlmnopqrs",mb:"1hlmnopqrs",mk:"mnopqrs",na:"1hlmnopqrs",nb:"1hlmnopqrs",nk:"mnopqrs",oa:"1hlmnopqrs",ob:"1hlmnopqrs",ok:"mnopqrs",pa:"1hlmnopqrs",pb:"1hlmnopqrs",pk:"mnopqrs",qa:"1hlmnopqrs",qb:"1hlmnopqrs",qk:"mnopqrs",ra:"1hlmnopqrs",rb:"1hlmnopqrs",rk:"mnopqrs",sa:"1hlmnopqrs",sb:"1hlmnopqrs",sk:"mnopqrs",ta:"1hklmnopqrs",tb:"1hklmnopqrs",ua:"1hklmnopqrs",ub:"1hklmnopqrs",va:"1hklmnopqrs",vb:"1hklmnopqrs",wa:"1hklmnopqrs",wb:"1hklmnopqrs",xa:"1hklmnopqrs",xb:"1hklmnopqrs",ya:"1hklmnopqrs",yb:"1hklmnopqrs"},quads_broken:{},quads_whole:{"5aa":"1hklmnopqrs","5ab":"1hklmnopqrs","5ba":"mnopqrs","5bb":"mnopqrs","6aa":"1hklmnopqrs","6ab":"1hklmnopqrs","6ba":"mnopqrs","6bb":"mnopqrs","7aa":"mnopqrs","7ab":"mnopqrs","7ba":"mnopqrs","7bb":"mnopqrs",eaa:"mnopqrs",eab:"mnopqrs",eba:"mnopqrs",ebb:"mnopqrs",faa:"mnopqrs",fab:"mnopqrs",fba:"mnopqrs",fbb:"mnopqrs",jaa:"mnopqrs",jab:"mnopqrs",jba:"mnopqrs",jbb:"mnopqrs",kaa:"1hl",kab:"1hl",kba:"1hl",kbb:"1hl",maa:"mnopqrs",mab:"mnopqrs",mba:"mnopqrs",mbb:"mnopqrs",naa:"mnopqrs",nab:"mnopqrs",nba:"mnopqrs",nbb:"mnopqrs",oaa:"mnopqrs",oab:"mnopqrs",oba:"mnopqrs",obb:"mnopqrs",paa:"mnopqrs",pab:"mnopqrs",pba:"mnopqrs",pbb:"mnopqrs",qaa:"mnopqrs",qab:"mnopqrs",qba:"mnopqrs",qbb:"mnopqrs",raa:"mnopqrs",rab:"mnopqrs",rba:"mnopqrs",rbb:"mnopqrs",saa:"mnopqrs",sab:"mnopqrs",sba:"mnopqrs",sbb:"mnopqrs",taa:"mnopqrs",tab:"mnopqrs",tba:"mnopqrs",tbb:"mnopqrs",uaa:"mnopqrs",uab:"mnopqrs",uba:"mnopqrs",ubb:"mnopqrs",vaa:"mnopqrs",vab:"mnopqrs",vba:"mnopqrs",vbb:"mnopqrs",waa:"mnopqrs",wab:"mnopqrs",wba:"mnopqrs",wbb:"mnopqrs",xaa:"mnopqrs",xab:"mnopqrs",xba:"mnopqrs",xbb:"mnopqrs",yaa:"mnopqrs",yab:"mnopqrs",yba:"mnopqrs",ybb:"mnopqrs"}},Bengali:{names:["Avagraha","Bindu","Bindu.1","Consonant","Consonant_Dead","Consonant_Placeholder","Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Nukta","Number","Other","Placeholder","Syllable_Modifier","Virama","Visarga","Vowel_Dependent","Vowel_Dependent.1","Vowel_Dependent.2","Vowel_Dependent.3","Vowel_Independent","Vowel_Independent.1","Vowel_Independent.2","Vowel_Independent.3"],blocks:{"0980":"511i.nooooopq..oo..oo33333333333333333333.3333333.3...3333..c0jkkkklk..kk..kkh4........k....33.3oomk..dddddddddd33eeeeeeeeee2eg"},shared:"98ab67ff",start:"1cghijklm",pending:"",pairs:{"0":"hjklm","1":"chjklm","6":"1cghijklm","7":"1cghijklm","8":"1cghijklm","9":"1cghijklm",a:"1cghijklm",b:"1cghijklm",e:"1cghijklm",g:"jklm",h:"hjklm",i:"chjklm",n:"j",p:"l",q:"m"},triples_broken:{"0c":"chjklm","0g":"h","11":"1gi","1g":"1cghi","1i":"1gi",cc:"c",g1:"1gi",gc:"jklm",gg:"1gi",gi:"1gi",hc:"hjklm",hg:"h",i1:"1gi",ig:"1cghi",ii:"1gi",jc:"c",kc:"c",lc:"c",mc:"c"},triples_whole:{"08":"1gi","09":"1gi","28":"1ghijklm","29":"1ghijklm","38":"1cghijklm","39":"1ghijklm","48":"1cghijklm","49":"1ghijklm","58":"1ghijklm","59":"1ghijklm",c8:"1ghijklm",c9:"1ghijklm",d8:"1ghijklm",d9:"1ghijklm",f8:"1ghijklm",f9:"1ghijklm",h8:"1cgi",h9:"1gi",j8:"1gijklm",j9:"1gijklm",jh:"jklm",k8:"1gijklm",k9:"1gijklm",kh:"jklm",l8:"1gijklm",l9:"1gijklm",lh:"jklm",m8:"1gijklm",m9:"1gijklm",mh:"jklm",n8:"1ghijklm",n9:"1ghijklm",o8:"1ghijklm",o9:"1ghijklm",p8:"1ghijklm",p9:"1ghijklm",q8:"1ghijklm",q9:"1ghijklm"},quads_broken:{},quads_whole:{"288":"jklm","289":"jklm","298":"jklm","299":"jklm","388":"1ghijklm","389":"1ghijklm","398":"jklm","399":"jklm","488":"1ghijklm","489":"1ghijklm","498":"jklm","499":"jklm","588":"jklm","589":"jklm","598":"jklm","599":"jklm",c88:"jklm",c89:"jklm",c98:"jklm",c99:"jklm",d88:"jklm",d89:"jklm",d98:"jklm",d99:"jklm",f88:"jklm",f89:"jklm",f98:"jklm",f99:"jklm",h88:"1gi",h89:"1gi",h98:"1gi",h99:"1gi",j88:"jklm",j89:"jklm",j98:"jklm",j99:"jklm",k88:"jklm",k89:"jklm",k98:"jklm",k99:"jklm",l88:"jklm",l89:"jklm",l98:"jklm",l99:"jklm",m88:"jklm",m89:"jklm",m98:"jklm",m99:"jklm",n88:"jklm",n89:"jklm",n98:"jklm",n99:"jklm",o88:"jklm",o89:"jklm",o98:"jklm",o99:"jklm",p88:"jklm",p89:"jklm",p98:"jklm",p99:"jklm",q88:"jklm",q89:"jklm",q98:"jklm",q99:"jklm"}},Gurmukhi:{names:["Bindu","Cantillation_Mark","Consonant","Consonant.1","Consonant_Medial","Consonant_Placeholder","Consonant_Placeholder.1","Gemination_Mark","Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Nukta","Number","Other","Placeholder","Virama","Visarga","Vowel_Dependent","Vowel_Dependent.1","Vowel_Dependent.2","Vowel_Dependent.3","Vowel_Independent","Vowel_Independent.1"],blocks:{"0A00":".00j.oppppp....pp..pp22222222222222222222.2222222.23.23.22..e.klmnn....lk..nki...1.......3332.3.......ffffffffff0756g4g"},shared:"bacd89hh",start:"0147eijklmn",pending:"",pairs:{"0":"14eikln","1":"4","4":"4e","5":"lm","6":"n","7":"14eikln","8":"0147eijklmn","9":"0147eijklmn",a:"0147eijklmn",b:"0147eijklmn",c:"0147eijklmn",d:"0147eijklmn",g:"0147eijklmn",i:"14iklmn",j:"14eikln",k:"4",l:"4",m:"4",n:"4",o:"k"},triples_broken:{"00":"07jm","07":"07jm","0j":"07jm","1e":"4e","3e":"e","4i":"e","70":"07jm","77":"07jm","7j":"07jm",ee:"e",i0:"m",i7:"m",ie:"14iklmn",ij:"m",j0:"07jm",j7:"07jm",jj:"07jm",ke:"4e",le:"4e",me:"4e",ne:"4e"},triples_whole:{"1a":"017jklmn","1b":"017jklmn","1i":"1klmn","2a":"0147eijklmn","2b":"017ijklmn","3a":"017ijklmn","3b":"017ijklmn","4a":"017ijklmn","4b":"017ijklmn","5a":"0147eijklmn","5b":"017ijklmn","6a":"0147eijklmn","6b":"017ijklmn",ea:"017ijklmn",eb:"017ijklmn",fa:"017ijklmn",fb:"017ijklmn",ha:"017ijklmn",hb:"017ijklmn",ia:"07ej",ib:"07j",ka:"017jklmn",kb:"017jklmn",ki:"1klmn",la:"017jklmn",lb:"017jklmn",li:"1klmn",ma:"017jklmn",mb:"017jklmn",mi:"1klmn",na:"017jklmn",nb:"017jklmn",ni:"1klmn",oa:"017ijklmn",ob:"017ijklmn",pa:"017ijklmn",pb:"017ijklmn"},quads_broken:{},quads_whole:{"1aa":"1klmn","1ab":"1klmn","1ba":"1klmn","1bb":"1klmn","2aa":"017ijklmn","2ab":"017ijklmn","2ba":"1klmn","2bb":"1klmn","3aa":"1klmn","3ab":"1klmn","3ba":"1klmn","3bb":"1klmn","4aa":"1klmn","4ab":"1klmn","4ba":"1klmn","4bb":"1klmn","5aa":"017ijklmn","5ab":"017ijklmn","5ba":"1klmn","5bb":"1klmn","6aa":"017ijklmn","6ab":"017ijklmn","6ba":"1klmn","6bb":"1klmn",eaa:"1klmn",eab:"1klmn",eba:"1klmn",ebb:"1klmn",faa:"1klmn",fab:"1klmn",fba:"1klmn",fbb:"1klmn",haa:"1klmn",hab:"1klmn",hba:"1klmn",hbb:"1klmn",iaa:"07j",iab:"07j",iba:"07j",ibb:"07j",kaa:"1klmn",kab:"1klmn",kba:"1klmn",kbb:"1klmn",laa:"1klmn",lab:"1klmn",lba:"1klmn",lbb:"1klmn",maa:"1klmn",mab:"1klmn",mba:"1klmn",mbb:"1klmn",naa:"1klmn",nab:"1klmn",nba:"1klmn",nbb:"1klmn",oaa:"1klmn",oab:"1klmn",oba:"1klmn",obb:"1klmn",paa:"1klmn",pab:"1klmn",pba:"1klmn",pbb:"1klmn"}},Gujarati:{names:["Avagraha","Bindu","Cantillation_Mark","Consonant","Gemination_Mark","Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Nukta","Nukta.1","Number","Other","Placeholder","Virama","Visarga","Vowel_Dependent","Vowel_Dependent.1","Vowel_Dependent.2","Vowel_Dependent.3","Vowel_Independent","Vowel_Independent.1"],blocks:{"0A80":".11h.mnnnnnnnn.nnn.nn33333333333333333333.3333333.33.33333..b0ijjjjjjk.lll.llg..e...............nnjj..ddddddddddee.......3242ccc"},shared:"879a56ff",start:"124bcghijkl",pending:"",pairs:{"0":"gijkl","1":"4bcgijkl","2":"14bcghijkl","5":"124bcghijkl","6":"124bcghijkl","7":"124bcghijkl","8":"124bcghijkl","9":"124bcghijkl",a:"124bcghijkl",e:"124bcghijkl",g:"4cgijkl",h:"4bcgijkl",k:"i",m:"ikl"},triples_broken:{"04":"4bcgijkl","0b":"4bcgijkl","0c":"4bcgijkl","11":"1h","1h":"1h","44":"4bc","4b":"4bc","4c":"4bc",b4:"4bc",bb:"4bc",bc:"4bc",c4:"4bc",cb:"4bc",cc:"4bc",gb:"4cgijkl",h1:"1h",hh:"1h",i4:"4bc",ib:"4bc",ic:"4bc",j4:"4bc",jb:"4bc",jc:"4bc",k4:"4bc",kb:"4bc",kc:"4bc",l4:"4bc",lb:"4bc",lc:"4bc"},triples_whole:{"07":"1h","08":"1h","18":"2","37":"124bcghijkl","38":"1ghijkl","47":"1ghijkl","48":"1ghijkl",b7:"1ghijkl",b8:"1ghijkl",c7:"1ghijkl",c8:"1ghijkl",d7:"1ghijkl",d8:"1ghijkl",f7:"1ghijkl",f8:"1ghijkl",g7:"124bch",g8:"12h",h8:"2",i7:"1hijkl",i8:"1hijkl",ig:"ijkl",j7:"1hijkl",j8:"1hijkl",jg:"ijkl",k7:"1hijkl",k8:"1hijkl",kg:"ijkl",l7:"1hijkl",l8:"1hijkl",lg:"ijkl",m7:"1ghijkl",m8:"1ghijkl",n7:"1ghijkl",n8:"1ghijkl"},quads_broken:{},quads_whole:{"377":"1ghijkl","378":"1ghijkl","387":"ijkl","388":"ijkl","477":"ijkl","478":"ijkl","487":"ijkl","488":"ijkl",b77:"ijkl",b78:"ijkl",b87:"ijkl",b88:"ijkl",c77:"ijkl",c78:"ijkl",c87:"ijkl",c88:"ijkl",d77:"ijkl",d78:"ijkl",d87:"ijkl",d88:"ijkl",f77:"ijkl",f78:"ijkl",f87:"ijkl",f88:"ijkl",g77:"1h",g78:"1h",g87:"1h",g88:"1h",i77:"ijkl",i78:"ijkl",i87:"ijkl",i88:"ijkl",j77:"ijkl",j78:"ijkl",j87:"ijkl",j88:"ijkl",k77:"ijkl",k78:"ijkl",k87:"ijkl",k88:"ijkl",l77:"ijkl",l78:"ijkl",l87:"ijkl",l88:"ijkl",m77:"ijkl",m78:"ijkl",m87:"ijkl",m88:"ijkl",n77:"ijkl",n78:"ijkl",n87:"ijkl",n88:"ijkl"}},Oriya:{names:["Avagraha","Bindu","Consonant","Consonant.1","Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Nukta","Number","Other","Placeholder","Virama","Visarga","Vowel_Dependent","Vowel_Dependent.1","Vowel_Dependent.2","Vowel_Dependent.3","Vowel_Independent","Vowel_Independent.1","Vowel_Independent.2"],blocks:{"0B00":".11f.klllllll..ml..ml22222222222222222222.2222222.22.22222..a0ghhhhhh..hh..hhe.......ihj....33.2llhh..bbbbbbbbbbc2cccccc"},shared:"768945dd",start:"1aefghij",pending:"",pairs:{"0":"eghj","1":"aeghij","4":"1aefghij","5":"1aefghij","6":"1aefghij","7":"1aefghij","8":"1aefghij","9":"1aefghij",c:"1aefghij",e:"eghij",f:"aeghij",k:"g",m:"j"},triples_broken:{"0a":"aeghij","0i":"aeghij","11":"1f","1f":"1f","3a":"ai","3i":"ai",aa:"ai",ai:"ai",ea:"eghij",f1:"1f",ff:"1f",ga:"ai",gi:"ai",ha:"ai",hi:"ai",ia:"ai",ii:"ai",ja:"ai",ji:"ai"},triples_whole:{"06":"1f","07":"1f","26":"1aefghij","27":"1efghj","36":"1efghj","37":"1efghj",a6:"1efghj",a7:"1efghj",b6:"1efghj",b7:"1efghj",d6:"1efghj",d7:"1efghj",e6:"1afi",e7:"1f",g6:"1fghj",g7:"1fghj",ge:"ghj",h6:"1fghj",h7:"1fghj",he:"ghj",i6:"1efghj",i7:"1efghj",j6:"1fghj",j7:"1fghj",je:"ghj",k6:"1efghj",k7:"1efghj",l6:"1efghj",l7:"1efghj",m6:"1efghj",m7:"1efghj"},quads_broken:{},quads_whole:{"266":"1efghj","267":"1efghj","276":"ghj","277":"ghj","366":"ghj","367":"ghj","376":"ghj","377":"ghj",a66:"ghj",a67:"ghj",a76:"ghj",a77:"ghj",b66:"ghj",b67:"ghj",b76:"ghj",b77:"ghj",d66:"ghj",d67:"ghj",d76:"ghj",d77:"ghj",e66:"1f",e67:"1f",e76:"1f",e77:"1f",g66:"ghj",g67:"ghj",g76:"ghj",g77:"ghj",h66:"ghj",h67:"ghj",h76:"ghj",h77:"ghj",i66:"ghj",i67:"ghj",i76:"ghj",i77:"ghj",j66:"ghj",j67:"ghj",j76:"ghj",j77:"ghj",k66:"ghj",k67:"ghj",k76:"ghj",k77:"ghj",l66:"ghj",l67:"ghj",l76:"ghj",l77:"ghj",m66:"ghj",m67:"ghj",m76:"ghj",m77:"ghj"}},Tamil:{names:["Bindu","Consonant","Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Modifying_Letter","Number","Other","Placeholder","Virama","Vowel_Dependent","Vowel_Dependent.1","Vowel_Independent","Vowel_Independent.1"],blocks:{"0B80":"..08.fggggg...ggg.ggg1...11.1.11...11...111...111111111111....dddde...ddd.dddc..a......d..............9999999999aaaaaaaaaaa"},shared:"546723bb",start:"0cde",pending:"",pairs:{"0":"cde","2":"0cde","3":"0cde","4":"0cde","5":"0cde","6":"0cde","7":"0cde","8":"0cde",a:"0cde",c:"cde",f:"e"},triples_broken:{"00":"0"},triples_whole:{"14":"0cde","15":"0cde","94":"0cde","95":"0cde",b4:"0cde",b5:"0cde",c4:"0",c5:"0",d4:"0de",d5:"0de",dc:"de",e4:"0de",e5:"0de",ec:"de",f4:"0cde",f5:"0cde",g4:"0cde",g5:"0cde"},quads_broken:{},quads_whole:{"144":"0cde","145":"0cde","154":"de","155":"de","944":"de","945":"de","954":"de","955":"de",b44:"de",b45:"de",b54:"de",b55:"de",c44:"0",c45:"0",c54:"0",c55:"0",d44:"de",d45:"de",d54:"de",d55:"de",e44:"de",e45:"de",e54:"de",e55:"de",f44:"de",f45:"de",f54:"de",f55:"de",g44:"de",g45:"de",g54:"de",g55:"de"}},Telugu:{names:["Avagraha","Bindu","Consonant","Consonant_Dead","Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Nukta","Number","Other","Placeholder","Virama","Visarga","Vowel_Dependent","Vowel_Dependent.1","Vowel_Dependent.2","Vowel_Dependent.3","Vowel_Dependent.4","Vowel_Independent","Vowel_Independent.1"],blocks:{"0C00":"111f1llllllll.lll.mll22222222222222222222.2222222222222222..a0ghggggg.hgg.hgie.......jk.222..3..llgg..bbbbbbbbbb.......ccccccccc"},shared:"768945dd",start:"1aefghijk",pending:"",pairs:{"0":"eghijk","1":"aeghijk","4":"1aefghijk","5":"1aefghijk","6":"1aefghijk","7":"1aefghijk","8":"1aefghijk","9":"1aefghijk",c:"1aefghijk",e:"eghi",f:"aeghijk",h:"j",m:"ij"},triples_broken:{"0a":"aeghijk","11":"1f","1f":"1f",aa:"ajk",aj:"a",ak:"a",ea:"eghi",ej:"e",ek:"e",f1:"1f",ff:"1f",ga:"a",ha:"a",ia:"a",ja:"a",ka:"a"},triples_whole:{"06":"1f","07":"1f","26":"1aefghijk","27":"1efghijk","36":"1aefghijk","37":"1efghijk",a6:"1efghijk",a7:"1efghijk",b6:"1efghijk",b7:"1efghijk",d6:"1efghijk",d7:"1efghijk",e6:"1af",e7:"1f",g6:"1fghijk",g7:"1fghijk",ge:"ghi",h6:"1fghijk",h7:"1fghijk",he:"ghi",i6:"1fghijk",i7:"1fghijk",ie:"ghi",j6:"1fghijk",j7:"1fghijk",je:"ghi",k6:"1fghijk",k7:"1fghijk",ke:"ghi",l6:"1efghijk",l7:"1efghijk",m6:"1efghijk",m7:"1efghijk"},quads_broken:{},quads_whole:{"266":"1efghijk","267":"1efghijk","276":"ghijk","277":"ghijk","366":"1efghijk","367":"1efghijk","376":"ghijk","377":"ghijk",a66:"ghijk",a67:"ghijk",a76:"ghijk",a77:"ghijk",b66:"ghijk",b67:"ghijk",b76:"ghijk",b77:"ghijk",d66:"ghijk",d67:"ghijk",d76:"ghijk",d77:"ghijk",e66:"1f",e67:"1f",e76:"1f",e77:"1f",g66:"ghijk",g67:"ghijk",g76:"ghijk",g77:"ghijk",h66:"ghijk",h67:"ghijk",h76:"ghijk",h77:"ghijk",i66:"ghijk",i67:"ghijk",i76:"ghijk",i77:"ghijk",j66:"ghijk",j67:"ghijk",j76:"ghijk",j77:"ghijk",k66:"ghijk",k67:"ghijk",k76:"ghijk",k77:"ghijk",l66:"ghijk",l67:"ghijk",l76:"ghijk",l77:"ghijk",m66:"ghijk",m67:"ghijk",m76:"ghijk",m77:"ghijk"}},Kannada:{names:["Avagraha","Bindu","Bindu.1","Consonant","Consonant_Dead","Consonant_With_Stacker","Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Nukta","Number","Other","Placeholder","Virama","Visarga","Vowel_Dependent","Vowel_Dependent.1","Vowel_Dependent.2","Vowel_Independent","Vowel_Independent.1","Vowel_Independent.2"],blocks:{"0C80":"122hellllmlml.lll.nll33333333333333333333.3333333333.33333..c0ijjjjjj.jjj.jjkg.......jj......43.lljj..dddddddddd.552"},shared:"98ab67ff",start:"2cghijk",pending:"",pairs:{"0":"gijk","2":"cgijk","5":"2cghijk","6":"2cghijk","7":"2cghijk","8":"2cghijk","9":"2cghijk",a:"2cghijk",b:"2cghijk",e:"2cghijk",g:"gijk",h:"cgijk",m:"i",n:"k"},triples_broken:{"0c":"cgijk","22":"2h","2h":"2h",cc:"c",gc:"gijk",h2:"2h",hh:"2h",ic:"c",jc:"c",kc:"c"},triples_whole:{"08":"2h","09":"2h","18":"2ghijk","19":"2ghijk","38":"2cghijk","39":"2ghijk","48":"2cghijk","49":"2ghijk",c8:"2ghijk",c9:"2ghijk",d8:"2ghijk",d9:"2ghijk",f8:"2ghijk",f9:"2ghijk",g8:"2ch",g9:"2h",i8:"2hijk",i9:"2hijk",ig:"ijk",j8:"2hijk",j9:"2hijk",jg:"ijk",k8:"2hijk",k9:"2hijk",kg:"ijk",l8:"2ghijk",l9:"2ghijk",m8:"2ghijk",m9:"2ghijk",n8:"2ghijk",n9:"2ghijk"},quads_broken:{},quads_whole:{"188":"ijk","189":"ijk","198":"ijk","199":"ijk","388":"2ghijk","389":"2ghijk","398":"ijk","399":"ijk","488":"2ghijk","489":"2ghijk","498":"ijk","499":"ijk",c88:"ijk",c89:"ijk",c98:"ijk",c99:"ijk",d88:"ijk",d89:"ijk",d98:"ijk",d99:"ijk",f88:"ijk",f89:"ijk",f98:"ijk",f99:"ijk",g88:"2h",g89:"2h",g98:"2h",g99:"2h",i88:"ijk",i89:"ijk",i98:"ijk",i99:"ijk",j88:"ijk",j89:"ijk",j98:"ijk",j99:"ijk",k88:"ijk",k89:"ijk",k98:"ijk",k99:"ijk",l88:"ijk",l89:"ijk",l98:"ijk",l99:"ijk",m88:"ijk",m89:"ijk",m98:"ijk",m99:"ijk",n88:"ijk",n89:"ijk",n98:"ijk",n99:"ijk"}},Malayalam:{names:["Avagraha","Bindu","Bindu.1","Consonant","Consonant_Dead","Consonant_Preceding_Repha","Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Number","Other","Placeholder","Pure_Killer","Virama","Visarga","Vowel_Dependent","Vowel_Dependent.1","Vowel_Dependent.2","Vowel_Dependent.3","Vowel_Independent","Vowel_Independent.1","Vowel_Independent.2","Vowel_Independent.3"],blocks:{"0D00":"111h2mmnmnmmm.omm.pmm33333333333333333333333333333333333333ff0ijjjjjj.kjj.jjjg5d....444ldddddddmmmjj..ccccccccccdddddddddd444444"},shared:"98ab67ee",start:"1fghijkl",pending:"5",pairs:{"0":"fgijkl","1":"fgijkl","5":"016789abdfghijkl","6":"1fghijkl","7":"1fghijkl","8":"1fghijkl","9":"1fghijkl",a:"1fghijkl",b:"1fghijkl",d:"1fghijkl",g:"fgijkl",h:"fgijkl",n:"l",o:"k",p:"il"},triples_broken:{"11":"1h","1h":"1h",h1:"1h",hh:"1h"},triples_whole:{"08":"1h","09":"1h","28":"1fghijkl","29":"1fghijkl","38":"1fghijkl","39":"1fghijkl","48":"1fghijkl","49":"1fghijkl",c8:"1fghijkl",c9:"1fghijkl",e8:"1fghijkl",e9:"1fghijkl",f8:"1fhijkl",f9:"1fhijkl",fg:"fijkl",g8:"1h",g9:"1h",i8:"1fhijkl",i9:"1fhijkl",ig:"fijkl",j8:"1fhijkl",j9:"1fhijkl",jg:"fijkl",k8:"1fhijkl",k9:"1fhijkl",kg:"fijkl",l8:"1fhijkl",l9:"1fhijkl",lg:"fijkl",m8:"1fghijkl",m9:"1fghijkl",n8:"1fghijkl",n9:"1fghijkl",o8:"1fghijkl",o9:"1fghijkl",p8:"1fghijkl",p9:"1fghijkl"},quads_broken:{},quads_whole:{"288":"fijkl","289":"fijkl","298":"fijkl","299":"fijkl","388":"1fghijkl","389":"1fghijkl","398":"fijkl","399":"fijkl","488":"1fghijkl","489":"1fghijkl","498":"fijkl","499":"fijkl",c88:"fijkl",c89:"fijkl",c98:"fijkl",c99:"fijkl",e88:"fijkl",e89:"fijkl",e98:"fijkl",e99:"fijkl",f88:"fijkl",f89:"fijkl",f98:"fijkl",f99:"fijkl",g88:"1h",g89:"1h",g98:"1h",g99:"1h",i88:"fijkl",i89:"fijkl",i98:"fijkl",i99:"fijkl",j88:"fijkl",j89:"fijkl",j98:"fijkl",j99:"fijkl",k88:"fijkl",k89:"fijkl",k98:"fijkl",k99:"fijkl",l88:"fijkl",l89:"fijkl",l98:"fijkl",l99:"fijkl",m88:"fijkl",m89:"fijkl",m98:"fijkl",m99:"fijkl",n88:"fijkl",n89:"fijkl",n98:"fijkl",n99:"fijkl",o88:"fijkl",o89:"fijkl",o98:"fijkl",o99:"fijkl",p88:"fijkl",p89:"fijkl",p98:"fijkl",p99:"fijkl"}},Arabic:{names:["Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Other","Placeholder"],blocks:{"0600":"6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666","0750":"666666666666666666666666666666666666666666666666"},shared:"32450177",start:"",pending:"",pairs:{},triples_broken:{},triples_whole:{},quads_broken:{},quads_whole:{}},OlChiki:{names:["Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Other","Placeholder"],blocks:{"1C50":"666666666666666666666666666666666666666666666666"},shared:"32450177",start:"",pending:"",pairs:{},triples_broken:{},triples_whole:{},quads_broken:{},quads_whole:{}},MeeteiMayek:{names:["Consonant","Consonant_Final","Inv-f","Inv-h","Inv-j","Inv-n","Inv-s","Inv-w","Invisible_Stacker","Number","Other","Placeholder","Pure_Killer","Tone_Mark","Visarga","Vowel_Dependent","Vowel_Dependent.1","Vowel_Dependent.2","Vowel_Dependent.3","Vowel_Independent"],blocks:{AAE0:"jj000000000fghfiaaaaae8",ABC0:"00000000000000jj0j00000000011111111iihiigiiadc..9999999999"},shared:"546723bb",start:"58cdefghi",pending:"",pairs:{"2":"58cdefghi","3":"58cdefghi","4":"58cdefghi","5":"5","6":"58cdefghi","7":"58cdefghi","8":"8cdefghi",c:"8fh",d:"8cfghi",e:"8cfghi",f:"8",g:"8fh",h:"8f",i:"8cfgh"},triples_broken:{"85":"8cdefghi",c5:"8fh",d5:"8cfghi",e5:"8cfghi",f5:"8",g5:"8fh",h5:"8f",i5:"8cfgh"},triples_whole:{"04":"58cdefghi","14":"58cdefghi","54":"8cdefghi","84":"5","94":"58cdefghi",a4:"58cdefghi",b4:"58cdefghi",c4:"5cdegi",d4:"5de",e4:"5de",f4:"5cdefghi",g4:"5cdegi",h4:"5cdeghi",i4:"5dei",j4:"58cdefghi"},quads_broken:{"845":"8cdefghi","854":"8cdefghi",c45:"8fh",c54:"8fh",d45:"8cfghi",d54:"8cfghi",e45:"8cfghi",e54:"8cfghi",f45:"8",f54:"8",g45:"8fh",g54:"8fh",h45:"8f",h54:"8f",i45:"8cfgh",i54:"8cfgh"},quads_whole:{"044":"58cdefghi","144":"58cdefghi","544":"8cdefghi","844":"5","944":"58cdefghi",a44:"58cdefghi",b44:"58cdefghi",c44:"5cdegi",d44:"5de",e44:"5de",f44:"5cdefghi",g44:"5cdegi",h44:"5cdeghi",i44:"5dei",j44:"58cdefghi"}}}};function w(g){let f=new Map,b=Array.from(g.invisible+g.placeholder,(l)=>l.codePointAt(0)),q=new Set(b),m=(l)=>new Set(Object.entries(l).flatMap(([n,k])=>[...k].map((j)=>n+j)));for(let l of Object.values(g.scripts)){let n={cls:new Map,start:new Set(l.start),pending:new Set(l.pending),pairs:m(l.pairs),tb:m(l.triples_broken),tw:m(l.triples_whole),qb:m(l.quads_broken),qw:m(l.quads_whole)};for(let[k,j]of Object.entries(l.blocks)){let i=parseInt(k,16);for(let e=0;e<j.length;e++)if(j[e]!==".")n.cls.set(i+e,j[e]),f.set(i+e,n)}b.forEach((k,j)=>n.cls.set(k,l.shared[j]))}function t(l,n){let k="",j=0;for(let i=0;i<n.length;i++){let e=l.cls.get(n[i]),h;if(j===0)h=l.start.has(e);else if(j>=3&&l.qb.has(k.slice(-3)+e))h=!0;else if(j>=3&&l.qw.has(k.slice(-3)+e))h=!1;else if(j>=2&&l.tb.has(k.slice(-2)+e))h=!0;else if(j>=2&&l.tw.has(k.slice(-2)+e))h=!1;else h=l.pairs.has(k.slice(-1)+e);if(h)return i;if(k+=e,j+=e.length,k.length>3)k=k.slice(-3)}if(j>0&&l.pending.has(k[k.length-1]))return n.length-1;return-1}return function(n){let k,j=[],i=0,e=0,h=()=>k&&j.length?t(k,j):-1;for(let r of n){let d=r.codePointAt(0),a=f.get(d);if(a===void 0&&q.has(d)||a!==void 0&&(k===void 0||a===k)){if(j.length===0)i=e;if(j.push(d),a!==void 0)k=a}else{let c=h();if(c>=0)return i+c;j=a?[d]:[],k=a,i=e}e+=r.length}let p=h();return p>=0?i+p:-1}}var s=w(o);function V(g){return s(g)<0}function D(g){return s(g)}var u=o.version;export{V as isWellFormed,D as brokenAt,u as RULES_VERSION};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indickit",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "Small, exact utilities for text in Indian languages: a phonetic key that matches a name across 21 Indian scripts and English, a normalizer that gives text that looks the same one encoding, a segmenter for the letters a reader sees, and a stemmer for search.",
5
5
  "license": "MIT",
6
6
  "packageManager": "bun@1.3.14",
@@ -29,6 +29,18 @@
29
29
  "./romanize": {
30
30
  "types": "./dist/types/js/romanize.d.ts",
31
31
  "default": "./dist/romanize.js"
32
+ },
33
+ "./phonetic-search": {
34
+ "types": "./dist/types/js/phonetic-search.d.ts",
35
+ "default": "./dist/phonetic-search.js"
36
+ },
37
+ "./deromanize": {
38
+ "types": "./dist/types/js/deromanize.d.ts",
39
+ "default": "./dist/deromanize.js"
40
+ },
41
+ "./wellformed": {
42
+ "types": "./dist/types/js/wellformed.d.ts",
43
+ "default": "./dist/wellformed.js"
32
44
  }
33
45
  },
34
46
  "files": [
@@ -36,7 +48,7 @@
36
48
  ],
37
49
  "sideEffects": false,
38
50
  "scripts": {
39
- "build": "bun build js/phonetic.ts --outfile dist/phonetic.js --target browser --format esm && bun build js/normalize.ts --outfile dist/normalize.js --target browser --format esm && bun build js/segment.ts --outfile dist/segment.js --target browser --format esm && bun build js/stem.ts --outfile dist/stem.js --target browser --format esm && bun build js/romanize.ts --outfile dist/romanize.js --target browser --format esm && tsc -p tsconfig.json",
51
+ "build": "bun build js/phonetic.ts --outfile dist/phonetic.js --target browser --format esm --minify && bun build js/normalize.ts --outfile dist/normalize.js --target browser --format esm --minify && bun build js/segment.ts --outfile dist/segment.js --target browser --format esm --minify && bun build js/stem.ts --outfile dist/stem.js --target browser --format esm --minify && bun build js/romanize.ts --outfile dist/romanize.js --target browser --format esm --minify && bun build js/phonetic-search.ts --outfile dist/phonetic-search.js --target browser --format esm --minify && bun build js/deromanize.ts --outfile dist/deromanize.js --target browser --format esm --minify && bun build js/wellformed.ts --outfile dist/wellformed.js --target browser --format esm --minify && tsc -p tsconfig.json",
40
52
  "test": "bun test",
41
53
  "check-dist": "node js/check-dist.mjs"
42
54
  },