indickit 0.5.0 → 0.8.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.
@@ -0,0 +1,1329 @@
1
+ // phonetic/scorer/search.json
2
+ var search_default = {
3
+ version: "2026-10-08",
4
+ profiles: { names: { key: 2, cost: 1, vowel: 1, div: 4, stop_permille: 20, stop_min_names: 100, round: true }, text: { key: 1, cost: 2, vowel: 2, div: 5, stop_permille: null, stop_min_names: 0, round: false } },
5
+ posterior_temperature: 2,
6
+ deletion_min_classes: 3,
7
+ loose_joined_min_classes: 4,
8
+ fine_folds: ["nasal-all", "v-b", "retroflex", "s-c", "ng-k", "ur-w-u"],
9
+ thresholds: { names: 74, villages: 72, text_10: 80, text_20: 70 },
10
+ pow: [1e6, 993092, 986233, 979420, 972655, 965936, 959264, 952638, 946058, 939523, 933033, 926588, 920188, 913831, 907519, 901250, 895025, 888843, 882703, 876606, 870551, 864537, 858565, 852635, 846745, 840896, 835088, 829320, 823591, 817902, 812252, 806642, 801070, 795536, 790041, 784584, 779165, 773782, 768438, 763130, 757858, 752623, 747425, 742262, 737135, 732043, 726986, 721965, 716978, 712025, 707107, 702222, 697372, 692555, 687771, 683020, 678302, 673617, 668964, 664343, 659754, 655197, 650671, 646176, 641713, 637280, 632878, 628507, 624165, 619854, 615572, 611320, 607097, 602904, 598739, 594604, 590496, 586417, 582367, 578344, 574349, 570382, 566442, 562529, 558644, 554785, 550953, 547147, 543367, 539614, 535887, 532185, 528509, 524858, 521233, 517632, 514057, 510506, 506980, 503478, 500000, 496546, 493116, 489710, 486327, 482968, 479632, 476319, 473029, 469761, 466516, 463294, 460094, 456916, 453760, 450625, 447513, 444421, 441351, 438303, 435275, 432269, 429283, 426317, 423373, 420448, 417544, 414660, 411796, 408951, 406126, 403321, 400535, 397768, 395021, 392292, 389582, 386891, 384219, 381565, 378929, 376312, 373712, 371131, 368567, 366021, 363493, 360982, 358489, 356013, 353553, 351111, 348686, 346277, 343885, 341510, 339151, 336808, 334482, 332171, 329877, 327598, 325335, 323088, 320856, 318640, 316439, 314253, 312083, 309927, 307786, 305660, 303549, 301452, 299370, 297302, 295248, 293209, 291183, 289172, 287175, 285191, 283221, 281265, 279322, 277392, 275476, 273573, 271684, 269807, 267943, 266093, 264255, 262429, 260616, 258816, 257028, 255253, 253490, 251739, 250000, 248273, 246558, 244855, 243164, 241484, 239816, 238159, 236514, 234881, 233258, 231647, 230047, 228458, 226880, 225313, 223756, 222211, 220676, 219151, 217638, 216134, 214641, 213159, 211686, 210224, 208772, 207330, 205898, 204476, 203063, 201660, 200267, 198884, 197510, 196146, 194791, 193446, 192109, 190782, 189465, 188156, 186856, 185565, 184284, 183011, 181747, 180491, 179244, 178006, 176777, 175556, 174343, 173139, 171943, 170755, 169576, 168404, 167241, 166086, 164938, 163799, 162668, 161544, 160428, 159320, 158220, 157127, 156041, 154963, 153893, 152830, 151774, 150726, 149685, 148651, 147624, 146604, 145592, 144586, 143587, 142595, 141610, 140632, 139661, 138696, 137738, 136787, 135842, 134904, 133972, 133046, 132127, 131215, 130308, 129408, 128514, 127627, 126745, 125869, 125000, 124137, 123279, 122428, 121582, 120742, 119908, 119080, 118257, 117440, 116629, 115824, 115023, 114229, 113440, 112656, 111878, 111105, 110338, 109576, 108819, 108067, 107321, 106579, 105843, 105112, 104386, 103665, 102949, 102238, 101532, 100830, 100134, 99442, 98755, 98073, 97396, 96723, 96055, 95391, 94732, 94078, 93428, 92783, 92142, 91505, 90873, 90246, 89622, 89003, 88388, 87778, 87171, 86569, 85971, 85378, 84788, 84202, 83620, 83043, 82469, 81900, 81334, 80772, 80214, 79660, 79110, 78563, 78021, 77482, 76947, 76415, 75887, 75363, 74842, 74325, 73812, 73302, 72796, 72293, 71794, 71298, 70805, 70316, 69830, 69348, 68869, 68393, 67921, 67452, 66986, 66523, 66064, 65607, 65154, 64704, 64257, 63813, 63372, 62935, 62500, 62068, 61640, 61214, 60791, 60371, 59954, 59540, 59129, 58720, 58315, 57912, 57512, 57114, 56720, 56328, 55939, 55553, 55169, 54788, 54409, 54034, 53660, 53290, 52922, 52556, 52193, 51832, 51474, 51119, 50766, 50415, 50067, 49721, 49378, 49037, 48698, 48361, 48027, 47696, 47366, 47039, 46714, 46391, 46071, 45753, 45437, 45123, 44811, 44502, 44194, 43889, 43586, 43285, 42986, 42689, 42394, 42101, 41810, 41521, 41235, 40950, 40667, 40386, 40107, 39830, 39555, 39282, 39010, 38741, 38473, 38208, 37944, 37681, 37421, 37163, 36906, 36651, 36398, 36147, 35897, 35649, 35403, 35158, 34915, 34674, 34435, 34197, 33960, 33726, 33493, 33262, 33032, 32804, 32577, 32352, 32129, 31907, 31686, 31467, 31250, 31034, 30820, 30607, 30395, 30186, 29977, 29770, 29564, 29360, 29157, 28956, 28756, 28557, 28360, 28164, 27970, 27776, 27584, 27394, 27205, 27017, 26830, 26645, 26461, 26278, 26096, 25916, 25737, 25559, 25383, 25208, 25033, 24861, 24689, 24518, 24349, 24181, 24014, 23848, 23683, 23519, 23357, 23196, 23035, 22876, 22718, 22561, 22406, 22251, 22097, 21944, 21793, 21642, 21493, 21344, 21197, 21051, 20905, 20761, 20617, 20475, 20333, 20193, 20054, 19915, 19777, 19641, 19505, 19370, 19237, 19104, 18972, 18841, 18711, 18581, 18453, 18326, 18199, 18073, 17948, 17824, 17701, 17579, 17458, 17337, 17217, 17098, 16980, 16863, 16746, 16631, 16516, 16402, 16289, 16176, 16064, 15953, 15843, 15734, 15625, 15517, 15410, 15303, 15198, 15093, 14989, 14885, 14782, 14680, 14579, 14478, 14378, 14279, 14180, 14082, 13985, 13888, 13792, 13697, 13602, 13508, 13415, 13322, 13230, 13139, 13048, 12958, 12869, 12780, 12691, 12604, 12517, 12430, 12344, 12259, 12174, 12090, 12007, 11924, 11842, 11760, 11679, 11598, 11518, 11438, 11359, 11281, 11203, 11125, 11049, 10972, 10896, 10821, 10746, 10672, 10598, 10525, 10453, 10380, 10309, 10237, 10167, 10097, 10027, 9958, 9889, 9820, 9753, 9685, 9618, 9552, 9486, 9420, 9355, 9291, 9227, 9163, 9099, 9037, 8974, 8912, 8851, 8790, 8729, 8669, 8609, 8549, 8490, 8431, 8373, 8315, 8258, 8201, 8144, 8088, 8032, 7977, 7922, 7867, 7812, 7759, 7705, 7652, 7599, 7546, 7494, 7442, 7391, 7340, 7289, 7239, 7189, 7139, 7090, 7041, 6992, 6944, 6896, 6848, 6801, 6754, 6708, 6661, 6615, 6570, 6524, 6479, 6434, 6390, 6346, 6302, 6258, 6215, 6172, 6130, 6087, 6045, 6003, 5962, 5921, 5880, 5839, 5799, 5759, 5719, 5680, 5640, 5601, 5563, 5524, 5486, 5448, 5411, 5373, 5336, 5299, 5263, 5226, 5190, 5154, 5119, 5083, 5048, 5013, 4979, 4944, 4910, 4876, 4843, 4809, 4776, 4743, 4710, 4678, 4645, 4613, 4581, 4550, 4518, 4487, 4456, 4425, 4395, 4364, 4334, 4304, 4275, 4245, 4216, 4187, 4158, 4129, 4100, 4072, 4044, 4016, 3988, 3961, 3933, 3906, 3879, 3852, 3826, 3799, 3773, 3747, 3721, 3696, 3670, 3645, 3619, 3594, 3570, 3545, 3521, 3496, 3472, 3448, 3424, 3401, 3377, 3354, 3331, 3308, 3285, 3262, 3240, 3217, 3195, 3173, 3151, 3129, 3108, 3086, 3065, 3044, 3023, 3002, 2981, 2960, 2940, 2920, 2899, 2879, 2860, 2840, 2820, 2801, 2781, 2762, 2743, 2724, 2705, 2687, 2668, 2650, 2631, 2613, 2595, 2577, 2559, 2542, 2524, 2507, 2489, 2472, 2455, 2438, 2421, 2405, 2388, 2371, 2355, 2339, 2323, 2307, 2291, 2275, 2259, 2244, 2228, 2213, 2197, 2182, 2167, 2152, 2137, 2123, 2108, 2093, 2079, 2064, 2050, 2036, 2022, 2008, 1994, 1980, 1967, 1953, 1940, 1926, 1913, 1900, 1887, 1874, 1861, 1848, 1835, 1822, 1810, 1797, 1785, 1772, 1760, 1748, 1736, 1724, 1712, 1700, 1689, 1677, 1665, 1654, 1642, 1631, 1620, 1609, 1597, 1586, 1575, 1565, 1554, 1543, 1532, 1522, 1511, 1501, 1490, 1480, 1470, 1460, 1450, 1440, 1430, 1420, 1410, 1400, 1391, 1381, 1372, 1362, 1353, 1343, 1334, 1325, 1316, 1307, 1298, 1289, 1280, 1271, 1262, 1253, 1245, 1236, 1228, 1219, 1211, 1202, 1194, 1186, 1178, 1169, 1161, 1153, 1145, 1137, 1130, 1122, 1114, 1106, 1099, 1091, 1084, 1076, 1069, 1061, 1054, 1047, 1039, 1032, 1025, 1018, 1011, 1004, 997, 990, 983, 977, 970, 963, 956, 950, 943, 937, 930, 924, 918, 911, 905, 899, 892, 886, 880, 874, 868, 862, 856, 850, 844, 838, 833, 827, 821, 816, 810, 804, 799, 793, 788, 782, 777, 772, 766, 761, 756, 750, 745, 740, 735, 730, 725, 720, 715, 710, 705, 700, 695, 691, 686, 681, 676, 672, 667, 662, 658, 653, 649, 644, 640, 635, 631, 627, 622, 618, 614, 610, 605, 601, 597, 593, 589, 585, 581, 577, 573, 569, 565, 561, 557, 553, 549, 546, 542, 538, 534, 531, 527, 523, 520, 516, 513, 509, 506, 502, 499, 495, 492, 488, 485, 482, 478, 475, 472, 468, 465, 462, 459, 456, 452, 449, 446, 443, 440, 437, 434, 431, 428, 425, 422, 419, 416, 413, 411, 408, 405, 402, 399, 397, 394, 391, 388, 386, 383, 380, 378, 375, 373, 370, 367, 365, 362, 360, 357, 355, 353, 350, 348, 345, 343, 341, 338, 336, 334, 331, 329, 327, 324, 322, 320, 318, 316, 313, 311, 309, 307, 305, 303, 301, 298, 296, 294, 292, 290, 288, 286, 284, 282, 280, 279, 277, 275, 273, 271, 269, 267, 265, 263, 262, 260, 258, 256, 255, 253, 251, 249, 248, 246, 244, 242, 241, 239, 237, 236, 234, 233, 231, 229, 228, 226, 225, 223, 222, 220, 219, 217, 216, 214, 213, 211, 210, 208, 207, 205, 204, 202, 201, 200, 198, 197, 196, 194, 193, 192, 190, 189, 188, 186, 185, 184, 182, 181, 180, 179, 177, 176, 175, 174, 173, 171, 170, 169, 168, 167, 166, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 126, 125, 124, 123, 122, 121, 120, 120, 119, 118, 117, 116, 115, 115, 114, 113, 112, 112, 111, 110, 109, 109, 108, 107, 106, 106, 105, 104, 103, 103, 102, 101, 101, 100, 99, 98, 98, 97, 96, 96, 95, 94, 94, 93, 93, 92, 91, 91, 90, 89, 89, 88, 88, 87, 86, 86, 85, 85, 84, 83, 83, 82, 82, 81, 81, 80, 79, 79, 78, 78, 77, 77, 76, 76, 75, 75, 74, 74, 73, 73, 72, 72, 71, 71, 70, 70, 69, 69, 68, 68, 67, 67, 66, 66, 65, 65, 65, 64, 64, 63, 63, 62, 62, 61, 61, 61, 60, 60, 59, 59, 59, 58, 58, 57, 57, 57, 56, 56, 55, 55, 55, 54, 54, 54, 53, 53, 52, 52, 52, 51, 51, 51, 50, 50, 50, 49, 49, 49, 48, 48, 48, 47, 47, 47, 46, 46, 46, 45, 45, 45, 44, 44, 44, 43, 43, 43, 43, 42, 42, 42, 41, 41, 41, 41, 40, 40, 40, 39, 39, 39, 39, 38, 38, 38, 38, 37, 37, 37, 37, 36, 36, 36, 36, 35, 35, 35, 35, 34, 34, 34, 34, 33, 33, 33, 33, 32, 32, 32, 32, 32, 31, 31, 31, 31, 31, 30, 30, 30, 30, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 23, 23, 23, 23, 23, 23, 22, 22, 22, 22, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18, 17, 17, 17, 17, 17, 17, 17, 17, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
11
+ exp2: [65536, 70240, 75281, 80684, 86475, 92682, 99334, 106464, 114105, 122295, 131072, 140479, 150562, 161369, 172951, 185364, 198668, 212927, 228210, 244589, 262144, 280959, 301124, 322737, 345901, 370728, 397336, 425854, 456419, 489178, 524288, 561918, 602249, 645474, 691802, 741455, 794672, 851708, 912838, 978356, 1048576, 1123836, 1204498, 1290948, 1383604, 1482910, 1589344, 1703417, 1825677, 1956712, 2097152, 2247672, 2408995, 2581897, 2767209, 2965821, 3178688, 3406833, 3651354, 3913424, 4194304, 4495344, 4817990, 5163794, 5534417, 5931642, 6357376, 6813667, 7302707, 7826848, 8388608, 8990687, 9635980, 10327588, 11068835, 11863283, 12714752, 13627334, 14605415, 15653696, 16777216, 17981375, 19271960, 20655176, 22137669, 23726566, 25429504, 27254668, 29210830, 31307392, 33554432, 35962750, 38543921, 41310351, 44275338, 47453133, 50859008, 54509336, 58421659, 62614784, 67108864, 71925500, 77087842, 82620703, 88550677, 94906266, 101718017, 109018671, 116843319, 125229568, 134217728, 143850999, 154175683, 165241406, 177101354, 189812531, 203436034, 218037342, 233686637, 250459137, 268435456, 287701998, 308351367, 330482812, 354202708, 379625062, 406872068, 436074685, 467373275, 500918273, 536870912, 575403996, 616702733, 660965624, 708405415, 759250125, 813744135, 872149370, 934746550, 1001836546, 1073741824, 1150807993, 1233405467, 1321931248, 1416810831, 1518500250, 1627488271, 1744298739, 1869493099, 2003673092, 2147483648, 2301615985, 2466810934, 2643862496, 2833621662, 3037000500, 3254976542, 3488597478, 3738986199, 4007346185, 4294967296, 4603231970, 4933621868, 5287724992, 5667243324, 6074001000, 6509953083, 6977194957, 7477972398, 8014692369, 8589934592, 9206463941, 9867243735, 10575449984, 11334486647, 12148002000, 13019906166, 13954389914, 14955944795, 16029384739, 17179869184, 18412927881, 19734487471, 21150899968, 22668973294, 24296004000, 26039812333, 27908779828, 29911889591, 32058769478, 34359738368, 36825855763, 39468974941, 42301799936, 45337946589, 48592008000, 52079624665, 55817559655, 59823779182, 64117538956, 68719476736, 73651711525, 78937949883, 84603599872, 90675893177, 97184015999, 104159249331, 111635119310, 119647558364, 128235077912, 137438953472, 147303423050, 157875899766, 169207199743, 181351786355, 194368031998, 208318498661, 223270238621, 239295116728, 256470155823, 274877906944, 294606846100, 315751799532, 338414399486, 362703572709, 388736063997, 416636997323, 446540477241, 478590233456, 512940311647, 549755813888, 589213692200, 631503599063, 676828798972, 725407145419, 777472127994, 833273994645, 893080954483, 957180466911, 1025880623293, 1099511627776, 1178427384400, 1263007198126, 1353657597944, 1450814290837, 1554944255988, 1666547989291, 1786161908965, 1914360933822, 2051761246587, 2199023255552, 2356854768801, 2526014396253, 2707315195888, 2901628581674, 3109888511975, 3333095978582, 3572323817930, 3828721867644, 4103522493173, 4398046511104, 4713709537602, 5052028792506, 5414630391777, 5803257163349, 6219777023951, 6666191957164, 7144647635861, 7657443735288, 8207044986347, 8796093022208, 9427419075203, 10104057585011, 10829260783554, 11606514326698, 12439554047902, 13332383914327, 14289295271722, 15314887470577, 16414089972694, 17592186044416, 18854838150406, 20208115170022, 21658521567107, 23213028653395, 24879108095804, 26664767828654, 28578590543443, 30629774941153, 32828179945387, 35184372088832, 37709676300813, 40416230340045, 43317043134214, 46426057306791, 49758216191608, 53329535657309, 57157181086886, 61259549882306, 65656359890774, 70368744177664, 75419352601626, 80832460680090, 86634086268429, 92852114613582, 99516432383215, 106659071314618, 114314362173773, 122519099764613, 131312719781548, 140737488355328, 150838705203251, 161664921360180, 173268172536857, 185704229227163, 199032864766430, 213318142629235, 228628724347546, 245038199529225, 262625439563096, 281474976710656, 301677410406503, 323329842720360, 346536345073714, 371408458454326, 398065729532861, 426636285258470, 457257448695093, 490076399058449, 525250879126193, 562949953421312, 603354820813005, 646659685440720, 693072690147428, 742816916908653, 796131459065722, 853272570516940, 914514897390186, 980152798116898, 1050501758252385, 1125899906842624]
12
+ };
13
+ // phonetic/scorer/fine.json
14
+ var fine_default = {
15
+ version: "2026-10-07",
16
+ folds: ["nasal-all", "ng-k", "retroflex", "s-c", "v-b"],
17
+ brahmic: { from: 2304, to: 3455, class_by_offset: { "2": "ṁ", "5": "a", "6": "a", "7": "i", "8": "i", "9": "u", "10": "u", "11": "r", "12": "l", "13": "e", "14": "e", "15": "e", "16": "e", "17": "o", "18": "o", "19": "o", "20": "o", "21": "k", "22": "k", "23": "k", "24": "k", "25": "ṅ", "26": "c", "27": "c", "28": "c", "29": "c", "30": "ñ", "31": "ṭ", "32": "ṭ", "33": "ṭ", "34": "ṭ", "35": "ṇ", "36": "t", "37": "t", "38": "t", "39": "t", "40": "n", "41": "n", "42": "p", "43": "p", "44": "p", "45": "p", "46": "m", "47": "y", "48": "r", "49": "r", "50": "l", "51": "l", "52": "l", "53": "v", "54": "s", "55": "s", "56": "s", "57": "h", "62": "a", "63": "i", "64": "i", "65": "u", "66": "u", "67": "r", "68": "r", "69": "e", "70": "e", "71": "e", "72": "e", "73": "o", "74": "o", "75": "o", "76": "o", "87": "o", "96": "r", "97": "l", "98": "l", "99": "l" }, virama_offset: 77, candrabindu_offset: 1, candrabindu_class: "ṁ", nukta_offset: 60, flap_offsets: [33, 34], flap_class: "ṛ" },
18
+ extra: { ৎ: "t", ৰ: "r", ৱ: "v", ୱ: "v", "ੰ": "ṁ", "ਂ": "ṁ", ൺ: "ṇ", ൻ: "n", ർ: "r", ൽ: "l", ൾ: "l", ൿ: "k", ൔ: "m", ൕ: "y", ൖ: "l", ड़: "ṛ", ढ़: "ṛ", ড়: "ṛ", ঢ়: "ṛ", ଡ଼: "ṛ", ଢ଼: "ṛ", ੜ: "ṛ" },
19
+ urdu: { from: 1536, to: 1791, letters: { ا: "a", آ: "a", أ: "a", ب: "p", پ: "p", ت: "t", ٹ: "ṭ", ث: "s", ج: "c", چ: "c", ح: "h", خ: "k", د: "t", ڈ: "ṭ", ذ: "c", ر: "r", ڑ: "ṛ", ز: "c", ژ: "c", س: "s", ش: "s", ص: "s", ض: "c", ط: "t", ظ: "c", غ: "k", ف: "p", ق: "k", ک: "k", ك: "k", گ: "k", ل: "l", م: "m", ن: "n", ں: "ṁ", و: "v", ؤ: "u", ہ: "h", ه: "h", ۃ: "a", ی: "y", ي: "y", ى: "y", ئ: "y", ے: "e", ۓ: "e", ٻ: "p", ڀ: "p", ٺ: "ṭ", ٽ: "ṭ", ٿ: "t", ڄ: "c", ڃ: "ñ", ڇ: "c", ڊ: "ṭ", ڌ: "t", ڍ: "ṭ", ڏ: "t", ڙ: "ṛ", ڦ: "p", ڪ: "k", ڱ: "ṅ", ڳ: "k", ڻ: "ṇ", ٲ: "a", ٳ: "a", ۆ: "o", ۄ: "o", ێ: "e", ؠ: "y" }, ain: "ع", waw: "و", waw_v_before: "اآ", final_he: "ہه", final_he_h_after: "اآو" },
20
+ meetei: { ranges: [[43744, 43775], [43968, 44031]], letters: { ꯀ: "k", ꯁ: "s", ꯂ: "l", ꯃ: "m", ꯄ: "p", ꯅ: "n", ꯆ: "c", ꯇ: "t", ꯈ: "k", ꯉ: "ṅ", ꯊ: "t", ꯋ: "v", ꯌ: "y", ꯍ: "h", ꯎ: "u", ꯏ: "i", ꯐ: "p", ꯑ: "a", ꯒ: "k", ꯓ: "c", ꯔ: "r", ꯕ: "p", ꯖ: "c", ꯗ: "t", ꯘ: "k", ꯙ: "t", ꯚ: "p", ꯛ: "k", ꯜ: "l", ꯝ: "m", ꯞ: "p", ꯟ: "n", ꯠ: "t", ꯡ: "ṅ", ꯢ: "i", "ꯣ": "o", "ꯤ": "i", "ꯥ": "a", "ꯦ": "e", "ꯧ": "o", "ꯨ": "u", "ꯩ": "e", "ꯪ": "ṁ", ꫠ: "e", ꫡ: "o", ꫢ: "c", ꫣ: "ñ", ꫤ: "ṭ", ꫥ: "ṭ", ꫦ: "ṭ", ꫧ: "ṭ", ꫨ: "ṇ", ꫩ: "s", ꫪ: "s", "ꫫ": "i", "ꫬ": "u", "ꫭ": "e", "ꫮ": "o", "ꫯ": "o" } },
21
+ ol_chiki: { from: 7248, to: 7295, letters: { ᱚ: "o", ᱛ: "t", ᱜ: "k", ᱝ: "ṅ", ᱞ: "l", ᱟ: "a", ᱠ: "k", ᱡ: "c", ᱢ: "m", ᱣ: "v", ᱤ: "i", ᱥ: "s", ᱦ: "h", ᱧ: "ñ", ᱨ: "r", ᱩ: "u", ᱪ: "c", ᱫ: "t", ᱬ: "ṇ", ᱭ: "y", ᱮ: "e", ᱯ: "p", ᱰ: "ṭ", ᱱ: "n", ᱲ: "ṛ", ᱳ: "o", ᱴ: "ṭ", ᱵ: "p", ᱶ: "v", ᱷ: "h", ᱸ: "ṁ" }, aspiration: "ᱷ" },
22
+ latin: { groups: [["ngh", "nĝ"], ["chh", "c"], ["ch", "c"], ["jh", "c"], ["kh", "k"], ["gh", "k"], ["th", "t"], ["dh", "t"], ["ph", "p"], ["bh", "p"], ["sh", "s"], ["ck", "k"], ["aa", "a"], ["ai", "e"], ["ei", "e"], ["au", "o"], ["ee", "i"], ["oo", "u"], ["x", "ks"]], letters: { a: "a", e: "e", i: "i", o: "o", u: "u", k: "k", g: "k", q: "k", j: "c", z: "c", t: "t", d: "t", n: "n", m: "m", p: "p", b: "p", f: "p", v: "v", w: "v", y: "y", r: "r", l: "l", s: "s", h: "h" }, w_ambiguous_unless_before: "aeiou" },
23
+ class_map: { m: "n", s: "c", v: "p", w: "p", ñ: "n", ĝ: "k", ṁ: "n", ṅ: "n", ṇ: "n", ṛ: "t", ṭ: "t" },
24
+ vowels: "aeiou",
25
+ steps: { "ng-k": true, "initial-vowels-alike": false, "drop-h": false, "drop-y": false, "drop-y-after-i": false, "drop-vowels": false, "drop-final-vowel": false },
26
+ branches: [],
27
+ joined: { min_classes: 8, when: "the strict keys find nobody" },
28
+ digit_zeros: [48, 1632, 1776, 2406, 2534, 2662, 2790, 2918, 3046, 3174, 3302, 3430, 7248, 44016],
29
+ max_keys: 16,
30
+ suffixes: []
31
+ };
32
+ // phonetic/scorer/fine2.json
33
+ var fine2_default = {
34
+ version: "2026-10-07",
35
+ folds: ["nasal-all", "ng-k", "retroflex", "s-c", "ur-w-u", "v-b"],
36
+ brahmic: { from: 2304, to: 3455, class_by_offset: { "2": "ṁ", "5": "a", "6": "a", "7": "i", "8": "i", "9": "u", "10": "u", "11": "r", "12": "l", "13": "e", "14": "e", "15": "e", "16": "e", "17": "o", "18": "o", "19": "o", "20": "o", "21": "k", "22": "k", "23": "k", "24": "k", "25": "ṅ", "26": "c", "27": "c", "28": "c", "29": "c", "30": "ñ", "31": "ṭ", "32": "ṭ", "33": "ṭ", "34": "ṭ", "35": "ṇ", "36": "t", "37": "t", "38": "t", "39": "t", "40": "n", "41": "n", "42": "p", "43": "p", "44": "p", "45": "p", "46": "m", "47": "y", "48": "r", "49": "r", "50": "l", "51": "l", "52": "l", "53": "v", "54": "s", "55": "s", "56": "s", "57": "h", "62": "a", "63": "i", "64": "i", "65": "u", "66": "u", "67": "r", "68": "r", "69": "e", "70": "e", "71": "e", "72": "e", "73": "o", "74": "o", "75": "o", "76": "o", "87": "o", "96": "r", "97": "l", "98": "l", "99": "l" }, virama_offset: 77, candrabindu_offset: 1, candrabindu_class: "ṁ", nukta_offset: 60, flap_offsets: [33, 34], flap_class: "ṛ" },
37
+ extra: { ৎ: "t", ৰ: "r", ৱ: "v", ୱ: "v", "ੰ": "ṁ", "ਂ": "ṁ", ൺ: "ṇ", ൻ: "n", ർ: "r", ൽ: "l", ൾ: "l", ൿ: "k", ൔ: "m", ൕ: "y", ൖ: "l", ड़: "ṛ", ढ़: "ṛ", ড়: "ṛ", ঢ়: "ṛ", ଡ଼: "ṛ", ଢ଼: "ṛ", ੜ: "ṛ" },
38
+ urdu: { from: 1536, to: 1791, letters: { ا: "a", آ: "a", أ: "a", ب: "p", پ: "p", ت: "t", ٹ: "ṭ", ث: "s", ج: "c", چ: "c", ح: "h", خ: "k", د: "t", ڈ: "ṭ", ذ: "c", ر: "r", ڑ: "ṛ", ز: "c", ژ: "c", س: "s", ش: "s", ص: "s", ض: "c", ط: "t", ظ: "c", غ: "k", ف: "p", ق: "k", ک: "k", ك: "k", گ: "k", ل: "l", م: "m", ن: "n", ں: "ṁ", و: "v", ؤ: "u", ہ: "h", ه: "h", ۃ: "a", ی: "y", ي: "y", ى: "y", ئ: "y", ے: "e", ۓ: "e", ٻ: "p", ڀ: "p", ٺ: "ṭ", ٽ: "ṭ", ٿ: "t", ڄ: "c", ڃ: "ñ", ڇ: "c", ڊ: "ṭ", ڌ: "t", ڍ: "ṭ", ڏ: "t", ڙ: "ṛ", ڦ: "p", ڪ: "k", ڱ: "ṅ", ڳ: "k", ڻ: "ṇ", ٲ: "a", ٳ: "a", ۆ: "o", ۄ: "o", ێ: "e", ؠ: "y" }, ain: "ع", waw: "و", waw_v_before: "اآ", final_he: "ہه", final_he_h_after: "اآو" },
39
+ meetei: { ranges: [[43744, 43775], [43968, 44031]], letters: { ꯀ: "k", ꯁ: "s", ꯂ: "l", ꯃ: "m", ꯄ: "p", ꯅ: "n", ꯆ: "c", ꯇ: "t", ꯈ: "k", ꯉ: "ṅ", ꯊ: "t", ꯋ: "v", ꯌ: "y", ꯍ: "h", ꯎ: "u", ꯏ: "i", ꯐ: "p", ꯑ: "a", ꯒ: "k", ꯓ: "c", ꯔ: "r", ꯕ: "p", ꯖ: "c", ꯗ: "t", ꯘ: "k", ꯙ: "t", ꯚ: "p", ꯛ: "k", ꯜ: "l", ꯝ: "m", ꯞ: "p", ꯟ: "n", ꯠ: "t", ꯡ: "ṅ", ꯢ: "i", "ꯣ": "o", "ꯤ": "i", "ꯥ": "a", "ꯦ": "e", "ꯧ": "o", "ꯨ": "u", "ꯩ": "e", "ꯪ": "ṁ", ꫠ: "e", ꫡ: "o", ꫢ: "c", ꫣ: "ñ", ꫤ: "ṭ", ꫥ: "ṭ", ꫦ: "ṭ", ꫧ: "ṭ", ꫨ: "ṇ", ꫩ: "s", ꫪ: "s", "ꫫ": "i", "ꫬ": "u", "ꫭ": "e", "ꫮ": "o", "ꫯ": "o" } },
40
+ ol_chiki: { from: 7248, to: 7295, letters: { ᱚ: "o", ᱛ: "t", ᱜ: "k", ᱝ: "ṅ", ᱞ: "l", ᱟ: "a", ᱠ: "k", ᱡ: "c", ᱢ: "m", ᱣ: "v", ᱤ: "i", ᱥ: "s", ᱦ: "h", ᱧ: "ñ", ᱨ: "r", ᱩ: "u", ᱪ: "c", ᱫ: "t", ᱬ: "ṇ", ᱭ: "y", ᱮ: "e", ᱯ: "p", ᱰ: "ṭ", ᱱ: "n", ᱲ: "ṛ", ᱳ: "o", ᱴ: "ṭ", ᱵ: "p", ᱶ: "v", ᱷ: "h", ᱸ: "ṁ" }, aspiration: "ᱷ" },
41
+ latin: { groups: [["ngh", "nĝ"], ["chh", "c"], ["ch", "c"], ["jh", "c"], ["kh", "k"], ["gh", "k"], ["th", "t"], ["dh", "t"], ["ph", "p"], ["bh", "p"], ["sh", "s"], ["ck", "k"], ["aa", "a"], ["ai", "e"], ["ei", "e"], ["au", "o"], ["ee", "i"], ["oo", "u"], ["x", "ks"]], letters: { a: "a", e: "e", i: "i", o: "o", u: "u", k: "k", g: "k", q: "k", j: "c", z: "c", t: "t", d: "t", n: "n", m: "m", p: "p", b: "p", f: "p", v: "v", w: "v", y: "y", r: "r", l: "l", s: "s", h: "h" }, w_ambiguous_unless_before: "aeiou" },
42
+ class_map: { m: "n", s: "c", v: "p", w: "p", ñ: "n", ĝ: "k", ṁ: "n", ṅ: "n", ṇ: "n", ṛ: "t", ṭ: "t" },
43
+ vowels: "aeiou",
44
+ steps: { "ng-k": true, "initial-vowels-alike": false, "drop-h": false, "drop-y": false, "drop-y-after-i": false, "drop-vowels": false, "drop-final-vowel": false },
45
+ branches: [{ from: 1536, to: 1791, class: "w", also: "u" }],
46
+ joined: { min_classes: 8, when: "the strict keys find nobody" },
47
+ digit_zeros: [48, 1632, 1776, 2406, 2534, 2662, 2790, 2918, 3046, 3174, 3302, 3430, 7248, 44016],
48
+ max_keys: 16,
49
+ suffixes: []
50
+ };
51
+ // package.json
52
+ var version = "0.8.0";
53
+ // phonetic/rules.json
54
+ var rules_default = {
55
+ version: "2026-10-07",
56
+ folds: [
57
+ "bn-case",
58
+ "brahmic-av-u",
59
+ "drop-vowels",
60
+ "drop-y",
61
+ "flap-r",
62
+ "gu-case",
63
+ "latin-ngh",
64
+ "latin-w-u",
65
+ "ml-case",
66
+ "nasal-all",
67
+ "ng-k",
68
+ "or-case",
69
+ "retroflex",
70
+ "s-c",
71
+ "ta-case",
72
+ "ta-k-h",
73
+ "te-case",
74
+ "ur-w-u",
75
+ "v-b"
76
+ ],
77
+ brahmic: {
78
+ from: 2304,
79
+ to: 3455,
80
+ class_by_offset: {
81
+ "2": "ṁ",
82
+ "5": "a",
83
+ "6": "a",
84
+ "7": "i",
85
+ "8": "i",
86
+ "9": "u",
87
+ "10": "u",
88
+ "11": "r",
89
+ "12": "l",
90
+ "13": "e",
91
+ "14": "e",
92
+ "15": "e",
93
+ "16": "e",
94
+ "17": "o",
95
+ "18": "o",
96
+ "19": "o",
97
+ "20": "o",
98
+ "21": "k",
99
+ "22": "k",
100
+ "23": "k",
101
+ "24": "k",
102
+ "25": "ṅ",
103
+ "26": "c",
104
+ "27": "c",
105
+ "28": "c",
106
+ "29": "c",
107
+ "30": "ñ",
108
+ "31": "ṭ",
109
+ "32": "ṭ",
110
+ "33": "ṭ",
111
+ "34": "ṭ",
112
+ "35": "ṇ",
113
+ "36": "t",
114
+ "37": "t",
115
+ "38": "t",
116
+ "39": "t",
117
+ "40": "n",
118
+ "41": "n",
119
+ "42": "p",
120
+ "43": "p",
121
+ "44": "p",
122
+ "45": "p",
123
+ "46": "m",
124
+ "47": "y",
125
+ "48": "r",
126
+ "49": "r",
127
+ "50": "l",
128
+ "51": "l",
129
+ "52": "l",
130
+ "53": "v",
131
+ "54": "s",
132
+ "55": "s",
133
+ "56": "s",
134
+ "57": "h",
135
+ "62": "a",
136
+ "63": "i",
137
+ "64": "i",
138
+ "65": "u",
139
+ "66": "u",
140
+ "67": "r",
141
+ "68": "r",
142
+ "69": "e",
143
+ "70": "e",
144
+ "71": "e",
145
+ "72": "e",
146
+ "73": "o",
147
+ "74": "o",
148
+ "75": "o",
149
+ "76": "o",
150
+ "87": "o",
151
+ "96": "r",
152
+ "97": "l",
153
+ "98": "l",
154
+ "99": "l"
155
+ },
156
+ virama_offset: 77,
157
+ candrabindu_offset: 1,
158
+ candrabindu_class: "ṁ",
159
+ nukta_offset: 60,
160
+ flap_offsets: [
161
+ 33,
162
+ 34
163
+ ],
164
+ flap_class: "ṛ"
165
+ },
166
+ extra: {
167
+ ৎ: "t",
168
+ ৰ: "r",
169
+ ৱ: "v",
170
+ ୱ: "v",
171
+ "ੰ": "ṁ",
172
+ "ਂ": "ṁ",
173
+ ൺ: "ṇ",
174
+ ൻ: "n",
175
+ ർ: "r",
176
+ ൽ: "l",
177
+ ൾ: "l",
178
+ ൿ: "k",
179
+ ൔ: "m",
180
+ ൕ: "y",
181
+ ൖ: "l",
182
+ ड़: "ṛ",
183
+ ढ़: "ṛ",
184
+ ড়: "ṛ",
185
+ ঢ়: "ṛ",
186
+ ଡ଼: "ṛ",
187
+ ଢ଼: "ṛ",
188
+ ੜ: "ṛ"
189
+ },
190
+ urdu: {
191
+ from: 1536,
192
+ to: 1791,
193
+ letters: {
194
+ ا: "a",
195
+ آ: "a",
196
+ أ: "a",
197
+ ب: "p",
198
+ پ: "p",
199
+ ت: "t",
200
+ ٹ: "ṭ",
201
+ ث: "s",
202
+ ج: "c",
203
+ چ: "c",
204
+ ح: "h",
205
+ خ: "k",
206
+ د: "t",
207
+ ڈ: "ṭ",
208
+ ذ: "c",
209
+ ر: "r",
210
+ ڑ: "ṛ",
211
+ ز: "c",
212
+ ژ: "c",
213
+ س: "s",
214
+ ش: "s",
215
+ ص: "s",
216
+ ض: "c",
217
+ ط: "t",
218
+ ظ: "c",
219
+ غ: "k",
220
+ ف: "p",
221
+ ق: "k",
222
+ ک: "k",
223
+ ك: "k",
224
+ گ: "k",
225
+ ل: "l",
226
+ م: "m",
227
+ ن: "n",
228
+ ں: "ṁ",
229
+ و: "v",
230
+ ؤ: "u",
231
+ ہ: "h",
232
+ ه: "h",
233
+ ۃ: "a",
234
+ ی: "y",
235
+ ي: "y",
236
+ ى: "y",
237
+ ئ: "y",
238
+ ے: "e",
239
+ ۓ: "e",
240
+ ٻ: "p",
241
+ ڀ: "p",
242
+ ٺ: "ṭ",
243
+ ٽ: "ṭ",
244
+ ٿ: "t",
245
+ ڄ: "c",
246
+ ڃ: "ñ",
247
+ ڇ: "c",
248
+ ڊ: "ṭ",
249
+ ڌ: "t",
250
+ ڍ: "ṭ",
251
+ ڏ: "t",
252
+ ڙ: "ṛ",
253
+ ڦ: "p",
254
+ ڪ: "k",
255
+ ڱ: "ṅ",
256
+ ڳ: "k",
257
+ ڻ: "ṇ",
258
+ ٲ: "a",
259
+ ٳ: "a",
260
+ ۆ: "o",
261
+ ۄ: "o",
262
+ ێ: "e",
263
+ ؠ: "y"
264
+ },
265
+ ain: "ع",
266
+ waw: "و",
267
+ waw_v_before: "اآ",
268
+ final_he: "ہه",
269
+ final_he_h_after: "اآو"
270
+ },
271
+ meetei: {
272
+ ranges: [
273
+ [
274
+ 43744,
275
+ 43775
276
+ ],
277
+ [
278
+ 43968,
279
+ 44031
280
+ ]
281
+ ],
282
+ letters: {
283
+ ꯀ: "k",
284
+ ꯁ: "s",
285
+ ꯂ: "l",
286
+ ꯃ: "m",
287
+ ꯄ: "p",
288
+ ꯅ: "n",
289
+ ꯆ: "c",
290
+ ꯇ: "t",
291
+ ꯈ: "k",
292
+ ꯉ: "ṅ",
293
+ ꯊ: "t",
294
+ ꯋ: "v",
295
+ ꯌ: "y",
296
+ ꯍ: "h",
297
+ ꯎ: "u",
298
+ ꯏ: "i",
299
+ ꯐ: "p",
300
+ ꯑ: "a",
301
+ ꯒ: "k",
302
+ ꯓ: "c",
303
+ ꯔ: "r",
304
+ ꯕ: "p",
305
+ ꯖ: "c",
306
+ ꯗ: "t",
307
+ ꯘ: "k",
308
+ ꯙ: "t",
309
+ ꯚ: "p",
310
+ ꯛ: "k",
311
+ ꯜ: "l",
312
+ ꯝ: "m",
313
+ ꯞ: "p",
314
+ ꯟ: "n",
315
+ ꯠ: "t",
316
+ ꯡ: "ṅ",
317
+ ꯢ: "i",
318
+ "ꯣ": "o",
319
+ "ꯤ": "i",
320
+ "ꯥ": "a",
321
+ "ꯦ": "e",
322
+ "ꯧ": "o",
323
+ "ꯨ": "u",
324
+ "ꯩ": "e",
325
+ "ꯪ": "ṁ",
326
+ ꫠ: "e",
327
+ ꫡ: "o",
328
+ ꫢ: "c",
329
+ ꫣ: "ñ",
330
+ ꫤ: "ṭ",
331
+ ꫥ: "ṭ",
332
+ ꫦ: "ṭ",
333
+ ꫧ: "ṭ",
334
+ ꫨ: "ṇ",
335
+ ꫩ: "s",
336
+ ꫪ: "s",
337
+ "ꫫ": "i",
338
+ "ꫬ": "u",
339
+ "ꫭ": "e",
340
+ "ꫮ": "o",
341
+ "ꫯ": "o"
342
+ }
343
+ },
344
+ ol_chiki: {
345
+ from: 7248,
346
+ to: 7295,
347
+ letters: {
348
+ ᱚ: "o",
349
+ ᱛ: "t",
350
+ ᱜ: "k",
351
+ ᱝ: "ṅ",
352
+ ᱞ: "l",
353
+ ᱟ: "a",
354
+ ᱠ: "k",
355
+ ᱡ: "c",
356
+ ᱢ: "m",
357
+ ᱣ: "v",
358
+ ᱤ: "i",
359
+ ᱥ: "s",
360
+ ᱦ: "h",
361
+ ᱧ: "ñ",
362
+ ᱨ: "r",
363
+ ᱩ: "u",
364
+ ᱪ: "c",
365
+ ᱫ: "t",
366
+ ᱬ: "ṇ",
367
+ ᱭ: "y",
368
+ ᱮ: "e",
369
+ ᱯ: "p",
370
+ ᱰ: "ṭ",
371
+ ᱱ: "n",
372
+ ᱲ: "ṛ",
373
+ ᱳ: "o",
374
+ ᱴ: "ṭ",
375
+ ᱵ: "p",
376
+ ᱶ: "v",
377
+ ᱷ: "h",
378
+ ᱸ: "ṁ"
379
+ },
380
+ aspiration: "ᱷ"
381
+ },
382
+ latin: {
383
+ groups: [
384
+ [
385
+ "ngh",
386
+ "nĝ"
387
+ ],
388
+ [
389
+ "chh",
390
+ "c"
391
+ ],
392
+ [
393
+ "ch",
394
+ "c"
395
+ ],
396
+ [
397
+ "jh",
398
+ "c"
399
+ ],
400
+ [
401
+ "kh",
402
+ "k"
403
+ ],
404
+ [
405
+ "gh",
406
+ "k"
407
+ ],
408
+ [
409
+ "th",
410
+ "t"
411
+ ],
412
+ [
413
+ "dh",
414
+ "t"
415
+ ],
416
+ [
417
+ "ph",
418
+ "p"
419
+ ],
420
+ [
421
+ "bh",
422
+ "p"
423
+ ],
424
+ [
425
+ "sh",
426
+ "s"
427
+ ],
428
+ [
429
+ "ck",
430
+ "k"
431
+ ],
432
+ [
433
+ "aa",
434
+ "a"
435
+ ],
436
+ [
437
+ "ai",
438
+ "e"
439
+ ],
440
+ [
441
+ "ei",
442
+ "e"
443
+ ],
444
+ [
445
+ "au",
446
+ "o"
447
+ ],
448
+ [
449
+ "ee",
450
+ "i"
451
+ ],
452
+ [
453
+ "oo",
454
+ "u"
455
+ ],
456
+ [
457
+ "x",
458
+ "ks"
459
+ ]
460
+ ],
461
+ letters: {
462
+ a: "a",
463
+ e: "e",
464
+ i: "i",
465
+ o: "o",
466
+ u: "u",
467
+ k: "k",
468
+ g: "k",
469
+ q: "k",
470
+ j: "c",
471
+ z: "c",
472
+ t: "t",
473
+ d: "t",
474
+ n: "n",
475
+ m: "m",
476
+ p: "p",
477
+ b: "p",
478
+ f: "p",
479
+ v: "v",
480
+ w: "v",
481
+ y: "y",
482
+ r: "r",
483
+ l: "l",
484
+ s: "s",
485
+ h: "h"
486
+ },
487
+ w_ambiguous_unless_before: "aeiou"
488
+ },
489
+ class_map: {
490
+ m: "n",
491
+ s: "c",
492
+ v: "p",
493
+ w: "p",
494
+ ñ: "n",
495
+ ĝ: "k",
496
+ ṁ: "n",
497
+ ṅ: "n",
498
+ ṇ: "n",
499
+ ṛ: "t",
500
+ ṭ: "t"
501
+ },
502
+ vowels: "aeiou",
503
+ steps: {
504
+ "ng-k": true,
505
+ "initial-vowels-alike": false,
506
+ "drop-h": false,
507
+ "drop-y": true,
508
+ "drop-y-after-i": false,
509
+ "drop-vowels": true,
510
+ "drop-final-vowel": false
511
+ },
512
+ branches: [
513
+ {
514
+ from: 2304,
515
+ to: 3455,
516
+ class: "v",
517
+ also: "u",
518
+ after: "aṁ",
519
+ not_before: "aieo"
520
+ },
521
+ {
522
+ from: 1536,
523
+ to: 7295,
524
+ class: "ṛ",
525
+ also: "r"
526
+ },
527
+ {
528
+ from: 0,
529
+ to: 127,
530
+ class: "ĝ",
531
+ also: "h"
532
+ },
533
+ {
534
+ from: 0,
535
+ to: 127,
536
+ class: "w",
537
+ also: "u"
538
+ },
539
+ {
540
+ from: 2944,
541
+ to: 3071,
542
+ class: "k",
543
+ also: "h"
544
+ },
545
+ {
546
+ from: 1536,
547
+ to: 1791,
548
+ class: "w",
549
+ also: "u"
550
+ }
551
+ ],
552
+ joined: {
553
+ min_classes: 8,
554
+ when: "the strict keys find nobody"
555
+ },
556
+ digit_zeros: [
557
+ 48,
558
+ 1632,
559
+ 1776,
560
+ 2406,
561
+ 2534,
562
+ 2662,
563
+ 2790,
564
+ 2918,
565
+ 3046,
566
+ 3174,
567
+ 3302,
568
+ 3430,
569
+ 7248,
570
+ 44016
571
+ ],
572
+ max_keys: 16,
573
+ suffixes: [
574
+ {
575
+ from: 2432,
576
+ to: 2559,
577
+ endings: [
578
+ "য়ের",
579
+ "দের",
580
+ "এর",
581
+ "ের",
582
+ "কে",
583
+ "তে"
584
+ ]
585
+ },
586
+ {
587
+ from: 2688,
588
+ to: 2815,
589
+ endings: [
590
+ "માં",
591
+ "નું",
592
+ "થી",
593
+ "ના",
594
+ "ની",
595
+ "ને"
596
+ ]
597
+ },
598
+ {
599
+ from: 3328,
600
+ to: 3455,
601
+ endings: [
602
+ "യ്ക്ക്",
603
+ "ന്റെ",
604
+ "യുടെ",
605
+ "യിലെ",
606
+ "ക്ക്",
607
+ "ുടെ",
608
+ "യിൽ",
609
+ "ിലെ",
610
+ "ോട്",
611
+ "ിന്",
612
+ "ിൽ",
613
+ "നെ",
614
+ "യെ",
615
+ "ും"
616
+ ]
617
+ },
618
+ {
619
+ from: 2816,
620
+ to: 2943,
621
+ endings: [
622
+ "ଙ୍କର",
623
+ "ଙ୍କୁ",
624
+ "ଙ୍କ",
625
+ "ରେ",
626
+ "ରୁ",
627
+ "କୁ"
628
+ ]
629
+ },
630
+ {
631
+ from: 2944,
632
+ to: 3071,
633
+ endings: [
634
+ "ுக்கு",
635
+ "யின்",
636
+ "வின்",
637
+ "க்கு",
638
+ "யில்",
639
+ "ிடம்",
640
+ "ுடன்",
641
+ "ின்",
642
+ "ில்",
643
+ "ால்",
644
+ "ும்"
645
+ ]
646
+ },
647
+ {
648
+ from: 3072,
649
+ to: 3199,
650
+ endings: [
651
+ "యొక్క",
652
+ "లోని",
653
+ "గారు",
654
+ "లో",
655
+ "కు",
656
+ "కి",
657
+ "ని",
658
+ "తో",
659
+ "ను"
660
+ ]
661
+ }
662
+ ]
663
+ };
664
+
665
+ // js/phonetic.ts
666
+ var DELETED = "\x00";
667
+ function compile(rules) {
668
+ const b = rules.brahmic;
669
+ const byOffset = new Array(128);
670
+ for (const [o, c] of Object.entries(b.class_by_offset))
671
+ byOffset[Number(o)] = c;
672
+ const extra = new Map(Object.entries(rules.extra));
673
+ const urdu = new Map(Object.entries(rules.urdu.letters));
674
+ const meetei = new Map(Object.entries(rules.meetei.letters));
675
+ const olChiki = new Map(Object.entries(rules.ol_chiki.letters));
676
+ const latin = new Array(128);
677
+ for (const [l, c] of Object.entries(rules.latin.letters))
678
+ latin[l.charCodeAt(0)] = c;
679
+ const groups = rules.latin.groups;
680
+ const wUnlessNext = rules.latin.w_ambiguous_unless_before;
681
+ const classMap = new Map(Object.entries(rules.class_map));
682
+ const vowels = new Set(rules.vowels);
683
+ const steps = rules.steps;
684
+ const u = rules.urdu;
685
+ function inMeetei(o) {
686
+ return rules.meetei.ranges.some(([lo, hi]) => o >= lo && o <= hi);
687
+ }
688
+ function readBrahmic(word) {
689
+ let out = "";
690
+ let last = -1;
691
+ for (let i = 0;i < word.length; i++) {
692
+ const ch = word[i];
693
+ const x = extra.get(ch);
694
+ if (x !== undefined) {
695
+ out += x;
696
+ last = -1;
697
+ continue;
698
+ }
699
+ const o = word.charCodeAt(i);
700
+ if (o < b.from || o > b.to)
701
+ continue;
702
+ const off = o & 127;
703
+ const c = byOffset[off];
704
+ if (off === b.nukta_offset && b.flap_offsets.includes(last) && out) {
705
+ out = out.slice(0, -1) + b.flap_class;
706
+ } else if (off === b.virama_offset) {} else if (off === b.candrabindu_offset) {
707
+ out += b.candrabindu_class;
708
+ } else if (c !== undefined) {
709
+ out += c;
710
+ }
711
+ if (c !== undefined)
712
+ last = off;
713
+ else if (off !== b.nukta_offset && off !== b.virama_offset)
714
+ last = -1;
715
+ }
716
+ return out;
717
+ }
718
+ function readLatin(word) {
719
+ let out = "";
720
+ let i = 0;
721
+ outer:
722
+ while (i < word.length) {
723
+ for (const [g, cls] of groups) {
724
+ if (word.startsWith(g, i)) {
725
+ out += cls;
726
+ i += g.length;
727
+ continue outer;
728
+ }
729
+ }
730
+ const ch = word.charCodeAt(i);
731
+ if (ch === 99) {
732
+ const next = word[i + 1];
733
+ out += next === "e" || next === "i" || next === "y" ? "s" : "k";
734
+ } else if (ch === 119 && i > 0 && !wUnlessNext.includes(word[i + 1] ?? " ")) {
735
+ out += "w";
736
+ } else {
737
+ out += latin[ch] ?? "";
738
+ }
739
+ i++;
740
+ }
741
+ return out;
742
+ }
743
+ function readUrdu(word) {
744
+ let out = word[0] === u.ain ? "a" : "";
745
+ for (let i = 0;i < word.length; i++) {
746
+ const ch = word[i];
747
+ if (ch === u.waw && i > 0 && !(i + 1 < word.length && u.waw_v_before.includes(word[i + 1])))
748
+ out += "w";
749
+ else
750
+ out += urdu.get(ch) ?? "";
751
+ }
752
+ const n = word.length;
753
+ if (n > 1 && u.final_he.includes(word[n - 1]) && !u.final_he_h_after.includes(word[n - 2])) {
754
+ out = out.slice(0, -1) + "a";
755
+ }
756
+ return out;
757
+ }
758
+ function readOlChiki(word) {
759
+ let out = "";
760
+ for (const ch of word) {
761
+ if (ch === rules.ol_chiki.aspiration && out && !vowels.has(out[out.length - 1]))
762
+ continue;
763
+ out += olChiki.get(ch) ?? "";
764
+ }
765
+ return out;
766
+ }
767
+ function readMeetei(word) {
768
+ let out = "";
769
+ for (const ch of word)
770
+ out += meetei.get(ch) ?? "";
771
+ return out;
772
+ }
773
+ function read(word) {
774
+ let ascii = true;
775
+ for (let i = 0;i < word.length; i++)
776
+ if (word.charCodeAt(i) > 127) {
777
+ ascii = false;
778
+ break;
779
+ }
780
+ if (ascii)
781
+ return readLatin(word);
782
+ let ol = false, me = false;
783
+ for (let i = 0;i < word.length; i++) {
784
+ const o = word.charCodeAt(i);
785
+ if (o >= u.from && o <= u.to)
786
+ return readUrdu(word);
787
+ if (o >= rules.ol_chiki.from && o <= rules.ol_chiki.to)
788
+ ol = true;
789
+ else if (inMeetei(o))
790
+ me = true;
791
+ }
792
+ if (ol)
793
+ return readOlChiki(word);
794
+ if (me)
795
+ return readMeetei(word);
796
+ return readBrahmic(word);
797
+ }
798
+ function fold(codes) {
799
+ if (steps["ng-k"]) {
800
+ let s = "";
801
+ for (let i = 0;i < codes.length; i++) {
802
+ s += codes[i];
803
+ if (codes[i] === "ṅ" && codes[i + 1] !== "k")
804
+ s += "k";
805
+ }
806
+ codes = s;
807
+ }
808
+ let mapped = "";
809
+ for (let i = 0;i < codes.length; i++)
810
+ mapped += classMap.get(codes[i]) ?? codes[i];
811
+ if (!mapped)
812
+ return mapped;
813
+ let head = mapped[0];
814
+ if (steps["initial-vowels-alike"] && vowels.has(head))
815
+ head = "a";
816
+ let out = head;
817
+ for (let i = 1;i < mapped.length; i++) {
818
+ const c = mapped[i];
819
+ if (steps["drop-h"] && c === "h")
820
+ continue;
821
+ if (steps["drop-y"] && c === "y")
822
+ continue;
823
+ if (steps["drop-vowels"] && vowels.has(c))
824
+ continue;
825
+ out += c;
826
+ }
827
+ if (steps["drop-final-vowel"] && out.length > 1 && vowels.has(out[out.length - 1]))
828
+ out = out.slice(0, -1);
829
+ let runs = out[0];
830
+ for (let i = 1;i < out.length; i++)
831
+ if (out[i] !== out[i - 1])
832
+ runs += out[i];
833
+ return runs;
834
+ }
835
+ function fits(classes, i, br) {
836
+ const prev = i > 0 ? classes[i - 1] : "^";
837
+ const next = i + 1 < classes.length ? classes[i + 1] : "$";
838
+ return (br.after === undefined || br.after.includes(prev)) && (br.before === undefined || br.before.includes(next)) && !(br.not_before ?? "").includes(next);
839
+ }
840
+ function variants(word) {
841
+ const classes = read(word);
842
+ let vs = [classes];
843
+ for (const br of rules.branches) {
844
+ if (!classes.includes(br.class))
845
+ continue;
846
+ let inScript = false;
847
+ for (let i = 0;i < word.length; i++) {
848
+ const o = word.charCodeAt(i);
849
+ if (o >= br.from && o <= br.to) {
850
+ inScript = true;
851
+ break;
852
+ }
853
+ }
854
+ if (!inScript)
855
+ continue;
856
+ for (let i = 0;i < classes.length; i++) {
857
+ if (classes[i] === br.class && vs.length * 2 <= rules.max_keys && fits(classes, i, br)) {
858
+ const also = br.also || DELETED;
859
+ vs = vs.concat(vs.map((v) => v.slice(0, i) + also + v.slice(i + 1)));
860
+ }
861
+ }
862
+ }
863
+ return vs.map((v) => v.replaceAll(DELETED, ""));
864
+ }
865
+ function number(word) {
866
+ let out = "";
867
+ for (let i = 0;i < word.length; i++) {
868
+ const o = word.charCodeAt(i);
869
+ const z = rules.digit_zeros.find((z2) => o >= z2 && o <= z2 + 9);
870
+ if (z === undefined)
871
+ return;
872
+ out += String.fromCharCode(48 + o - z);
873
+ }
874
+ return out || undefined;
875
+ }
876
+ return function keys(word) {
877
+ const n = number(word);
878
+ if (n !== undefined)
879
+ return [n];
880
+ const bases = [word];
881
+ const first = word.charCodeAt(0);
882
+ for (const sf of rules.suffixes) {
883
+ if (first < sf.from || first > sf.to)
884
+ continue;
885
+ for (const e of sf.endings) {
886
+ if (word.endsWith(e) && word.length - e.length >= 2) {
887
+ bases.push(word.slice(0, -e.length));
888
+ break;
889
+ }
890
+ }
891
+ }
892
+ const out = new Set;
893
+ for (const base of bases)
894
+ for (const v of variants(base))
895
+ out.add(fold(v));
896
+ out.delete("");
897
+ return [...out].sort();
898
+ };
899
+ }
900
+ var engine = compile(rules_default);
901
+ var _internal = { compile: (r) => compile(r), normalize: (w) => normalize(w), engine };
902
+ var RULES_VERSION = rules_default.version;
903
+ var MAX_NAME_KEYS = 256;
904
+ function normalize(word) {
905
+ const plain = word.normalize("NFD").replace(/\p{Mn}/gu, "");
906
+ return /^[\x00-\x7f]*$/.test(plain) ? plain.toLowerCase() : word.normalize("NFC");
907
+ }
908
+ function words(name) {
909
+ return name.replace(/\([^)]*\)/g, " ").split(/[^\S\ufeff]|[\x1c-\x1f\x85.\-,'’]/u).filter(Boolean);
910
+ }
911
+ var JOINED_MIN_CLASSES = rules_default.joined.min_classes;
912
+
913
+ // js/phonetic-search.ts
914
+ var R = search_default;
915
+ var SEARCH_VERSION = R.version;
916
+ var THRESHOLDS = R.thresholds;
917
+ var { compile: compile2, normalize: normalize2, engine: engine2 } = _internal;
918
+ var fineEngine = compile2(fine_default);
919
+ var fine2Engine = compile2(fine2_default);
920
+ var JOINED_MIN = JOINED_MIN_CLASSES;
921
+ var INF = 2 ** 30;
922
+ var floor = Math.floor;
923
+ function pow2neg(k) {
924
+ return k >= 0 && k < R.pow.length ? R.pow[k] : 0;
925
+ }
926
+ function log2x10(num, den) {
927
+ let q = 0;
928
+ while (q + 1 < R.exp2.length && den * R.exp2[q + 1] <= num * 65536)
929
+ q++;
930
+ return q;
931
+ }
932
+ function ratio(a, b) {
933
+ const n = a.length + b.length;
934
+ if (!n)
935
+ return 1e4;
936
+ let prev = new Array(b.length + 1).fill(0), cur = new Array(b.length + 1).fill(0);
937
+ for (const x of a) {
938
+ cur[0] = 0;
939
+ for (let j = 0;j < b.length; j++)
940
+ cur[j + 1] = x === b[j] ? prev[j] + 1 : Math.max(prev[j + 1], cur[j]);
941
+ [prev, cur] = [cur, prev];
942
+ }
943
+ return floor((40000 * prev[b.length] + n) / (2 * n));
944
+ }
945
+ var rounded = (num, den) => floor((2 * num + den) / (2 * den));
946
+ var isAscii = (s) => /^[\x00-\x7f]*$/.test(s);
947
+ var keysOf = (w) => engine2(w);
948
+ function searchWords(name) {
949
+ const out = [];
950
+ for (let w of words(name)) {
951
+ w = normalize2(w);
952
+ if (isAscii(w))
953
+ w = w.replace(/[^a-z0-9]/g, "");
954
+ if (w && keysOf(w).length)
955
+ out.push(w);
956
+ }
957
+ return out;
958
+ }
959
+ var latSyms = (w) => [...w.toLowerCase()].filter((c) => c >= "a" && c <= "z");
960
+ var natSyms = (w) => [...w.normalize("NFC")].filter((c) => c !== "‌" && c !== "‍" && !/^(?:[^\S]|[\x1c-\x1f\x85])$/u.test(c));
961
+ function deletions(k) {
962
+ const rs = [...k];
963
+ if (rs.length < R.deletion_min_classes)
964
+ return [];
965
+ return rs.map((_, i) => rs.slice(0, i).join("") + rs.slice(i + 1).join(""));
966
+ }
967
+ var fineKey = (w) => [...fineEngine(w)[0] ?? ""];
968
+ function fine2Keys(w) {
969
+ const arabic = [...w].some((c) => c >= "؀" && c <= "ۿ");
970
+ const seen = new Set, out = [];
971
+ for (const f of fine2Engine(w)) {
972
+ const rs = [...f];
973
+ const g = [rs[0], ...rs.slice(1).filter((c) => c !== "a").map((c) => c === "y" ? "i" : c)];
974
+ if (arabic && g.length > 1 && g[g.length - 1] === "h")
975
+ g.pop();
976
+ const key = g.join("");
977
+ if (!seen.has(key)) {
978
+ seen.add(key);
979
+ out.push(g);
980
+ }
981
+ }
982
+ return out;
983
+ }
984
+ function vowelRatio(a, b) {
985
+ let best = 0;
986
+ for (const x of fine2Keys(a))
987
+ for (const y of fine2Keys(b))
988
+ best = Math.max(best, ratio(x, y));
989
+ return best;
990
+ }
991
+ var BLOCKS = [
992
+ [1536, 1791, "arab"],
993
+ [1872, 1919, "arab"],
994
+ [2304, 2431, "deva"],
995
+ [2432, 2559, "beng"],
996
+ [2560, 2687, "guru"],
997
+ [2688, 2815, "gujr"],
998
+ [2816, 2943, "orya"],
999
+ [2944, 3071, "taml"],
1000
+ [3072, 3199, "telu"],
1001
+ [3200, 3327, "knda"],
1002
+ [3328, 3455, "mlym"],
1003
+ [7248, 7295, "olck"],
1004
+ [43968, 44031, "mtei"]
1005
+ ];
1006
+ function scriptOf(w) {
1007
+ for (const c of w) {
1008
+ if (/\p{L}/u.test(c)) {
1009
+ const o = c.codePointAt(0);
1010
+ return BLOCKS.find(([lo, hi]) => o >= lo && o <= hi)?.[2] ?? "";
1011
+ }
1012
+ }
1013
+ return "";
1014
+ }
1015
+
1016
+ class CostTable {
1017
+ idx = new Map;
1018
+ v;
1019
+ c;
1020
+ units = new Map;
1021
+ constructor(raw) {
1022
+ const src = raw.latin ?? raw.x, dst = raw.native ?? raw.y;
1023
+ const alpha = [...src, ...dst];
1024
+ alpha.forEach((s, i) => this.idx.set(s, i + 1));
1025
+ this.v = alpha.length + 1;
1026
+ this.c = new Float64Array(this.v * this.v).fill(INF);
1027
+ raw.c.forEach(([d, ex], r) => {
1028
+ this.c.fill(d, r * this.v, (r + 1) * this.v);
1029
+ for (const [j, x] of ex)
1030
+ this.c[r * this.v + j] = x;
1031
+ });
1032
+ this.c[0] = 0;
1033
+ for (const [i, j, d, ex] of raw.units ?? []) {
1034
+ const row = new Float64Array(this.v).fill(INF);
1035
+ if (d >= 0)
1036
+ row.fill(d, src.length + 1);
1037
+ for (const [k, x] of ex)
1038
+ row[k] = x < 0 ? INF : x;
1039
+ this.units.set(i * this.v + j, row);
1040
+ }
1041
+ }
1042
+ ids(rs) {
1043
+ return rs.map((r) => this.idx.get(r) ?? 0);
1044
+ }
1045
+ align(a, b, withUnits) {
1046
+ const n = a.length, m = b.length, w = m + 1, v = this.v, c = this.c;
1047
+ const D = new Float64Array((n + 1) * w);
1048
+ for (let i = 1;i <= n; i++)
1049
+ D[i * w] = D[(i - 1) * w] + c[a[i - 1] * v];
1050
+ for (let j = 1;j <= m; j++)
1051
+ D[j] = D[j - 1] + c[b[j - 1]];
1052
+ for (let i = 1;i <= n; i++) {
1053
+ for (let j = 1;j <= m; j++) {
1054
+ let best = D[(i - 1) * w + j - 1] + c[a[i - 1] * v + b[j - 1]];
1055
+ best = Math.min(best, D[(i - 1) * w + j] + c[a[i - 1] * v]);
1056
+ best = Math.min(best, D[i * w + j - 1] + c[b[j - 1]]);
1057
+ if (withUnits && i >= 2) {
1058
+ const row = this.units.get(a[i - 2] * v + a[i - 1]);
1059
+ if (row)
1060
+ best = Math.min(best, D[(i - 2) * w + j - 1] + row[b[j - 1]]);
1061
+ }
1062
+ D[i * w + j] = best;
1063
+ }
1064
+ }
1065
+ return D[n * w + m];
1066
+ }
1067
+ }
1068
+ var CDN = `https://cdn.jsdelivr.net/gh/micahchoo/indickit@v${version}/phonetic/scorer/`;
1069
+ var LOCAL = new URL("../phonetic/scorer/", import.meta.url);
1070
+ async function fetchBytes(url) {
1071
+ const res = await fetch(url);
1072
+ if (!res.ok)
1073
+ throw new Error(`phonetic-search: ${url}: ${res.status}`);
1074
+ return res.arrayBuffer();
1075
+ }
1076
+ var defaultFetcher = async (url) => {
1077
+ try {
1078
+ return await fetchBytes(url);
1079
+ } catch {
1080
+ return fetchBytes(new URL(url.href.slice(LOCAL.href.length), CDN));
1081
+ }
1082
+ };
1083
+ async function loadTable(path, fetcher) {
1084
+ try {
1085
+ const bytes = await fetcher(new URL(path + ".json", LOCAL));
1086
+ return new CostTable(JSON.parse(new TextDecoder().decode(bytes)));
1087
+ } catch {
1088
+ return;
1089
+ }
1090
+ }
1091
+
1092
+ class Scorer {
1093
+ lang;
1094
+ latin;
1095
+ pairs;
1096
+ constructor(lang, latin, pairs) {
1097
+ this.lang = lang;
1098
+ this.latin = latin;
1099
+ this.pairs = pairs;
1100
+ }
1101
+ cost(a, b) {
1102
+ const aa = isAscii(a), ba = isAscii(b);
1103
+ let t, x, y, n, units = false;
1104
+ if (aa !== ba) {
1105
+ const [lat, nat] = aa ? [a, b] : [b, a];
1106
+ if (!(t = this.latin))
1107
+ return;
1108
+ x = latSyms(lat);
1109
+ y = natSyms(nat);
1110
+ units = true;
1111
+ n = Math.max(x.length, 1);
1112
+ } else if (!aa) {
1113
+ let sa = scriptOf(a), sb = scriptOf(b);
1114
+ if (!sa || !sb || sa === sb)
1115
+ return;
1116
+ if (sa > sb) {
1117
+ [a, b] = [b, a];
1118
+ [sa, sb] = [sb, sa];
1119
+ }
1120
+ if (!(t = this.pairs.get(`${sa}-${sb}`)))
1121
+ return;
1122
+ x = natSyms(a);
1123
+ y = natSyms(b);
1124
+ n = Math.max(x.length, y.length, 1);
1125
+ } else
1126
+ return;
1127
+ const total = t.align(t.ids(x), t.ids(y), units);
1128
+ return floor((20 * total + n) / (2 * n));
1129
+ }
1130
+ calibrations(a, cands) {
1131
+ const cs = new Map;
1132
+ for (const b of cands) {
1133
+ const c = this.cost(a, b);
1134
+ if (c !== undefined)
1135
+ cs.set(b, c);
1136
+ }
1137
+ const out = new Map;
1138
+ if (!cs.size)
1139
+ return out;
1140
+ const best = Math.min(...cs.values());
1141
+ const na = Math.max(isAscii(a) ? latSyms(a).length : natSyms(a).length, 1);
1142
+ const lo = Math.min(...[...cs.values()].map((c) => c * na));
1143
+ const w = new Map;
1144
+ let z = 0;
1145
+ for (const [b, c] of cs) {
1146
+ const x = pow2neg(floor((c * na - lo) / R.posterior_temperature));
1147
+ w.set(b, x);
1148
+ z += x;
1149
+ }
1150
+ for (const [b, c] of cs) {
1151
+ const rel = floor((100 * pow2neg(c - best) + 500000) / 1e6);
1152
+ const post = floor((100 * w.get(b) + floor(z / 2)) / z);
1153
+ out.set(b, rel + post);
1154
+ }
1155
+ return out;
1156
+ }
1157
+ wordSim(a, b, cal, p) {
1158
+ const kb = new Set(keysOf(b));
1159
+ const meet = keysOf(a).some((k) => kb.has(k)) ? 1 : 0;
1160
+ let c2, v;
1161
+ if (isAscii(a) && isAscii(b)) {
1162
+ v = ratio(latSyms(a), latSyms(b));
1163
+ c2 = 2 * v;
1164
+ } else if (cal?.has(b)) {
1165
+ c2 = 100 * cal.get(b);
1166
+ v = vowelRatio(a, b);
1167
+ } else if (this.cost(a, b) !== undefined) {
1168
+ c2 = 20000;
1169
+ v = vowelRatio(a, b);
1170
+ } else {
1171
+ v = ratio(fineKey(a), fineKey(b));
1172
+ c2 = 2 * v;
1173
+ }
1174
+ const num = 2 * p.key * 1e4 * meet + p.cost * c2 + 2 * p.vowel * v;
1175
+ return p.round ? rounded(num, 200 * p.div) : floor(num / (200 * p.div));
1176
+ }
1177
+ }
1178
+ function joinedOf(ws, min) {
1179
+ const j = ws.join("");
1180
+ return j ? keysOf(j).filter((k) => [...k].length >= min) : [];
1181
+ }
1182
+ function strictKeys(ws) {
1183
+ const all = ws.map(keysOf).filter((ks) => ks.length);
1184
+ if (!all.length)
1185
+ return [];
1186
+ let out = [""];
1187
+ all.forEach((ks, i) => {
1188
+ out = out.flatMap((p) => ks.map((k) => i ? p + "\x1F" + k : k));
1189
+ });
1190
+ return out.slice(0, MAX_NAME_KEYS);
1191
+ }
1192
+
1193
+ class Index {
1194
+ scorer;
1195
+ words;
1196
+ n;
1197
+ df = new Map;
1198
+ maps = { strict: new Map, joined: new Map, loose: new Map, near: new Map };
1199
+ p;
1200
+ constructor(scorer, names, profile) {
1201
+ this.scorer = scorer;
1202
+ this.p = R.profiles[profile];
1203
+ this.n = names.length;
1204
+ this.words = names.map(searchWords);
1205
+ for (const ws of this.words)
1206
+ for (const k of new Set(ws.flatMap(keysOf)))
1207
+ this.df.set(k, (this.df.get(k) ?? 0) + 1);
1208
+ const add = (m, k, i) => {
1209
+ const l = m.get(k);
1210
+ if (!l)
1211
+ m.set(k, [i]);
1212
+ else if (l[l.length - 1] !== i)
1213
+ l.push(i);
1214
+ };
1215
+ this.words.forEach((ws, i) => {
1216
+ for (const k of strictKeys(ws))
1217
+ add(this.maps.strict, k, i);
1218
+ for (const k of joinedOf(ws, JOINED_MIN))
1219
+ add(this.maps.joined, k, i);
1220
+ for (const k of joinedOf(ws, R.loose_joined_min_classes))
1221
+ add(this.maps.loose, k, i);
1222
+ for (const w of ws)
1223
+ for (const k of keysOf(w)) {
1224
+ if (this.common(k))
1225
+ continue;
1226
+ add(this.maps.near, k, i);
1227
+ for (const d of deletions(k))
1228
+ add(this.maps.near, d, i);
1229
+ }
1230
+ });
1231
+ }
1232
+ common(k) {
1233
+ const s = this.p.stop_permille;
1234
+ return s !== null && this.n >= this.p.stop_min_names && (this.df.get(k) ?? 0) * 1000 > this.n * s;
1235
+ }
1236
+ weight(w) {
1237
+ let best = 0;
1238
+ for (const k of keysOf(w))
1239
+ best = Math.max(best, log2x10(this.n, Math.max(this.df.get(k) ?? 0, 1)));
1240
+ return best;
1241
+ }
1242
+ candidates(qws) {
1243
+ const out = new Set;
1244
+ for (const k of strictKeys(qws))
1245
+ for (const i of this.maps.strict.get(k) ?? [])
1246
+ out.add(i);
1247
+ if (!out.size)
1248
+ for (const k of joinedOf(qws, JOINED_MIN))
1249
+ for (const i of this.maps.joined.get(k) ?? [])
1250
+ out.add(i);
1251
+ for (const k of joinedOf(qws, R.loose_joined_min_classes))
1252
+ for (const i of this.maps.loose.get(k) ?? [])
1253
+ out.add(i);
1254
+ for (const w of qws)
1255
+ for (const k of keysOf(w)) {
1256
+ if (this.common(k))
1257
+ continue;
1258
+ for (const d of [k, ...deletions(k)])
1259
+ for (const i of this.maps.near.get(d) ?? [])
1260
+ out.add(i);
1261
+ }
1262
+ return out;
1263
+ }
1264
+ nameScore(qws, dws, cal) {
1265
+ let num = 0, den = 0;
1266
+ for (const [a, b, q] of [[qws, dws, true], [dws, qws, false]]) {
1267
+ for (const w of a) {
1268
+ const x = this.weight(w);
1269
+ den += x;
1270
+ let best = 0;
1271
+ for (const o of b)
1272
+ best = Math.max(best, q ? this.scorer.wordSim(w, o, cal.get(w), this.p) : this.scorer.wordSim(o, w, cal.get(o), this.p));
1273
+ num += x * best;
1274
+ }
1275
+ }
1276
+ let soft = den ? floor((num + floor(den / 2)) / den) : 0;
1277
+ if (qws.length !== dws.length && qws.length && dws.length) {
1278
+ const jq = qws.join(""), jd = dws.join("");
1279
+ const lq = new Set(joinedOf([jq], R.loose_joined_min_classes));
1280
+ const meet = joinedOf([jd], R.loose_joined_min_classes).some((k) => lq.has(k)) ? 1 : 0;
1281
+ let c, v;
1282
+ if (this.scorer.cost(jq, jd) !== undefined) {
1283
+ c = 1e4;
1284
+ v = vowelRatio(jq, jd);
1285
+ } else {
1286
+ c = v = ratio(fineKey(jq), fineKey(jd));
1287
+ }
1288
+ const p = this.p, n = p.key * 1e4 * meet + p.cost * c + p.vowel * v;
1289
+ soft = Math.max(soft, p.round ? rounded(n, 100 * p.div) : floor(n / (100 * p.div)));
1290
+ }
1291
+ return soft;
1292
+ }
1293
+ scoreAll(query, which) {
1294
+ const qws = searchWords(query);
1295
+ const cw = [...new Set(which.flatMap((i) => this.words[i]))];
1296
+ const cal = new Map(qws.map((a) => [a, this.scorer.calibrations(a, cw)]));
1297
+ return which.map((i) => ({ name: i, score: this.nameScore(qws, this.words[i], cal) }));
1298
+ }
1299
+ search(query, threshold = 0) {
1300
+ const which = [...this.candidates(searchWords(query))].sort((a, b) => a - b);
1301
+ return this.scoreAll(query, which).filter((h) => h.score >= threshold).sort((a, b) => b.score - a.score);
1302
+ }
1303
+ }
1304
+ async function loadSearch(lang, options = {}) {
1305
+ const fetcher = options.fetcher ?? defaultFetcher;
1306
+ const scripts = [...new Set(options.scripts ?? [])].sort();
1307
+ const pairs = new Map;
1308
+ const [latin] = await Promise.all([
1309
+ loadTable(`latin/${lang}`, fetcher),
1310
+ ...scripts.flatMap((a, i) => scripts.slice(i + 1).map(async (b) => {
1311
+ const t = await loadTable(`pairs/${a}-${b}`, fetcher);
1312
+ if (t)
1313
+ pairs.set(`${a}-${b}`, t);
1314
+ }))
1315
+ ]);
1316
+ const scorer = new Scorer(lang, latin, pairs);
1317
+ return {
1318
+ lang,
1319
+ index: (names, profile = "names") => new Index(scorer, names, profile),
1320
+ score: (query, candidates, profile = "names") => new Index(scorer, candidates, profile).scoreAll(query, candidates.map((_, i) => i)).map((h) => h.score)
1321
+ };
1322
+ }
1323
+ export {
1324
+ loadSearch,
1325
+ THRESHOLDS,
1326
+ SEARCH_VERSION,
1327
+ Index,
1328
+ CDN
1329
+ };