lipilekhika 0.0.0-alpha.21 → 0.0.0-alpha.3
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.
- package/dist/cjs/Assamese-Dv2Uz5Ga.cjs +1 -0
- package/dist/cjs/Bengali-CP-jqwb3.cjs +1 -0
- package/dist/cjs/Brahmi-BOnETq6u.cjs +1 -0
- package/dist/cjs/Devanagari-DogoRXY8.cjs +1 -0
- package/dist/cjs/Granth-9Z5eCctH.cjs +1 -0
- package/dist/cjs/Gujarati-CUm-ZsKN.cjs +1 -0
- package/dist/cjs/Gurumukhi-CsObr-GI.cjs +1 -0
- package/dist/cjs/Kannada-SXQdSng_.cjs +1 -0
- package/dist/cjs/Malayalam-IcKWWsaB.cjs +1 -0
- package/dist/cjs/Modi-C3Chvoab.cjs +1 -0
- package/dist/cjs/Normal-BZe6xAux.cjs +1 -0
- package/dist/cjs/Odia-C_-bjsx6.cjs +1 -0
- package/dist/cjs/Purna-Devanagari-BkPRDmig.cjs +1 -0
- package/dist/cjs/Romanized-B_o6BaP0.cjs +1 -0
- package/dist/cjs/Sharada-DfQQFnhQ.cjs +1 -0
- package/dist/cjs/Siddham-D4xax5q5.cjs +1 -0
- package/dist/cjs/Sinhala-oz5fU6-H.cjs +1 -0
- package/dist/cjs/Tamil-Extended-Bg0_zDSf.cjs +1 -0
- package/dist/cjs/Tamil-pc27DGFa.cjs +1 -0
- package/dist/cjs/Telugu-C9jvVXuj.cjs +1 -0
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/typing-BLcGlYhq.cjs +2 -0
- package/dist/cjs/typing.cjs +1 -0
- package/dist/esm/Assamese-C2ZNJvdv.js +25 -0
- package/dist/esm/Bengali-B4lwiGw-.js +25 -0
- package/dist/esm/Brahmi-P_BhbEU1.js +23 -0
- package/dist/esm/Devanagari-CU6oiaDU.js +25 -0
- package/dist/esm/Granth-v69SsV6n.js +25 -0
- package/dist/esm/Gujarati-GMDcD3zf.js +25 -0
- package/dist/esm/Gurumukhi-cSQGlqXa.js +25 -0
- package/dist/esm/Kannada-BC0s2WZG.js +25 -0
- package/dist/esm/Malayalam-R6qN3iwf.js +23 -0
- package/dist/esm/Modi-B8YiZBXf.js +23 -0
- package/dist/esm/Normal-DH6dfVGR.js +21 -0
- package/dist/esm/Odia-DphK-sRO.js +25 -0
- package/dist/esm/Purna-Devanagari-iW765mfa.js +25 -0
- package/dist/esm/Romanized-BQU9AmMX.js +21 -0
- package/dist/esm/Sharada-DOmuoJ5u.js +25 -0
- package/dist/esm/Siddham-CZ7F2rJg.js +25 -0
- package/dist/esm/Sinhala-BKPrzGBh.js +23 -0
- package/dist/esm/Tamil-B_Q1LP6g.js +23 -0
- package/dist/esm/Tamil-Extended-8h88s1_g.js +23 -0
- package/dist/esm/Telugu-w-eiYYTU.js +23 -0
- package/dist/esm/index.mjs +42 -0
- package/dist/esm/typing-BglIxYDV.js +748 -0
- package/dist/esm/typing.mjs +6 -0
- package/dist/index.d.ts +660 -0
- package/dist/lipilekhika.umd.js +2 -2
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/typing.d.ts +96 -0
- package/package.json +6 -1
- package/dist/types/src/custom_options.json.d.ts +0 -220
- package/dist/types/src/index.d.ts +0 -100
- package/dist/types/src/make_script_data/custom_options_input.d.ts +0 -62
- package/dist/types/src/make_script_data/input_data/Assamese.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Bengali.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Brahmi.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Devanagari.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Granth.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Gujarati.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Gurumukhi.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Kannada.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Malayalam.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Modi.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Normal.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Odia.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Purna-Devanagari.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Romanized.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Sharada.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Siddham.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Sinhala.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Tamil-Extended.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Tamil.d.ts +0 -3
- package/dist/types/src/make_script_data/input_data/Telugu.d.ts +0 -3
- package/dist/types/src/make_script_data/input_script_data_schema.d.ts +0 -91
- package/dist/types/src/make_script_data/krama_array_keys.d.ts +0 -145
- package/dist/types/src/make_script_data/make_output_script_data.d.ts +0 -1
- package/dist/types/src/make_script_data/output_script_data_schema.d.ts +0 -46
- package/dist/types/src/tools/kry.d.ts +0 -18
- package/dist/types/src/transliteration/a.d.ts +0 -1
- package/dist/types/src/transliteration/active_option_resolver.test.d.ts +0 -1
- package/dist/types/src/transliteration/context_clear.test.d.ts +0 -1
- package/dist/types/src/transliteration/emulate_typing.test.d.ts +0 -1
- package/dist/types/src/transliteration/helpers.d.ts +0 -90
- package/dist/types/src/transliteration/test_commons.d.ts +0 -13
- package/dist/types/src/transliteration/transliterate.d.ts +0 -47
- package/dist/types/src/transliteration/transliterate.test.d.ts +0 -2
- package/dist/types/src/utils/binary_search/binary_search.d.ts +0 -25
- package/dist/types/src/utils/binary_search/binary_search.test.d.ts +0 -1
- package/dist/types/src/utils/get_script_data.d.ts +0 -8
- package/dist/types/src/utils/lang_list/index.d.ts +0 -50
- package/dist/types/src/utils/lang_list/langs.json.d.ts +0 -44
- package/dist/types/src/utils/lang_list/script_normalization.d.ts +0 -6
- package/dist/types/src/utils/lang_list/script_normalization.test.d.ts +0 -1
- package/dist/types/src/utils/non_bmp.d.ts +0 -3
- package/dist/types/src/utils/runtime_macros.d.ts +0 -5
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { KramaKeysExtendedType } from './krama_array_keys';
|
|
2
|
-
import { script_list_type } from '../utils/lang_list';
|
|
3
|
-
export type CommonListTypeAttributes = {
|
|
4
|
-
text: string;
|
|
5
|
-
/** In the post processing step the keys for which it is not mapped shall be left empty.
|
|
6
|
-
* It can map to multiple krama keys
|
|
7
|
-
* Each key should have at least one key krama. Scan for this too in the compilation step.
|
|
8
|
-
*/
|
|
9
|
-
text_krama: KramaKeysExtendedType[];
|
|
10
|
-
/** This contains duplicates of the key, for eg:- some nuqta symbols and mAtrAs.
|
|
11
|
-
* In the processing/compiling step it should be verified as a key of this list, display and throw the error
|
|
12
|
-
*/
|
|
13
|
-
duplicates?: string[];
|
|
14
|
-
/** In case if no entry is found for the key in krama even after de-duplication resolution
|
|
15
|
-
* then fallback array will be used. Like for malayalam .100 it can be .1+.0+.0
|
|
16
|
-
* If the fallback array is not provided, then the key_krama should be empty and will also be ignored
|
|
17
|
-
*/
|
|
18
|
-
fallback?: KramaKeysExtendedType[];
|
|
19
|
-
/** Prevent Auto Matching
|
|
20
|
-
* Useful for Cases where we dont want to use the text referenced in the key to be used for transliteration from that script to another script
|
|
21
|
-
* Like when changing from Tamil to Devanagari , kirupA it should be kirupA and not kRpA.
|
|
22
|
-
* So we can prevent the list item "text": iru, krama R) from being used to reduce itself from that form during transliteration
|
|
23
|
-
*/
|
|
24
|
-
prevent_auto_matching?: boolean;
|
|
25
|
-
};
|
|
26
|
-
export type InputBrahmicScriptType = {
|
|
27
|
-
script_name: script_list_type;
|
|
28
|
-
script_id: number;
|
|
29
|
-
script_type: 'brahmic';
|
|
30
|
-
/**
|
|
31
|
-
* An attribute for some ancient scripts which use 4 byte utf-8 representation.
|
|
32
|
-
* Instead of the usual 3 byte for most modern indian scripts.
|
|
33
|
-
* Examples(non-bmp scripts): Brahmi, Grantha, Siddham, Sharada, Modi, etc.
|
|
34
|
-
*
|
|
35
|
-
* BMP (Basic Multilingual Plane)
|
|
36
|
-
*/
|
|
37
|
-
non_bmp_script?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* A sorted range array. Used to check if the incomming character has to be processed or can be ignored.
|
|
40
|
-
* Main Ranges will be specified manually (Like for a Brahmic Script). And Ranges for Additional charcters used shall be added manually
|
|
41
|
-
*
|
|
42
|
-
* This will help us more strictly specify what to process and what not to.
|
|
43
|
-
* In future this will be a mandatory field and ?
|
|
44
|
-
*/
|
|
45
|
-
ranges?: [[number, number][]];
|
|
46
|
-
halant: string;
|
|
47
|
-
nuqta?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Schwa deletion indicator for the script(or rather language in most cases).
|
|
50
|
-
* This will be used for live typing and not for conversion.
|
|
51
|
-
* It can be overriden later on provided as a argument in the typing tool
|
|
52
|
-
*/
|
|
53
|
-
schwa_property: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* This has a lower precedence than the auto generated/compiled krama key map from the `list` items. So it will be overwritten by them.
|
|
56
|
-
* Moreover the keys here will not be checked to exist in `list`. This allows direct keymaps and can be useful for scripts like Normal, Romanized
|
|
57
|
-
* Intermediate steps will be auto generated. Eg. for Normal ख : kh will add both k (next h) and kh in the
|
|
58
|
-
*/
|
|
59
|
-
manual_krama_text_map?: {
|
|
60
|
-
[key in KramaKeysExtendedType]?: string;
|
|
61
|
-
};
|
|
62
|
-
/** One important need of this list is to just contain information about the keys.
|
|
63
|
-
* The keys for which it does not contain information can be considered as type `anya`.
|
|
64
|
-
* So not all keys need to be present in this list.
|
|
65
|
-
*/
|
|
66
|
-
list: (CommonListTypeAttributes & ({
|
|
67
|
-
type: 'svara';
|
|
68
|
-
mAtrA: string;
|
|
69
|
-
mAtrA_text_krama: KramaKeysExtendedType[];
|
|
70
|
-
mAtrA_duplicates?: string[];
|
|
71
|
-
mAtrA_fallback?: KramaKeysExtendedType[];
|
|
72
|
-
} | {
|
|
73
|
-
type: 'vyanjana' | 'anya';
|
|
74
|
-
}))[];
|
|
75
|
-
};
|
|
76
|
-
export type InputOtherScriptType = {
|
|
77
|
-
script_name: script_list_type;
|
|
78
|
-
script_id: number;
|
|
79
|
-
script_type: 'other';
|
|
80
|
-
/** Schwa deletion character, usually `a` */
|
|
81
|
-
schwa_character: string;
|
|
82
|
-
manual_krama_text_map: {
|
|
83
|
-
[key in KramaKeysExtendedType]?: string;
|
|
84
|
-
};
|
|
85
|
-
/** This might not be needed here usually as most of the work would be done using the `manual_krama_text_map` */
|
|
86
|
-
list?: (CommonListTypeAttributes & {
|
|
87
|
-
/** `type` is kind of redundant here as other scripts don't have a concept of svara and vyanjana */
|
|
88
|
-
type?: 'anya';
|
|
89
|
-
})[];
|
|
90
|
-
};
|
|
91
|
-
export type InputScriptInfoType = InputBrahmicScriptType | InputOtherScriptType;
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* These Krama keys are written in an order where the keys which comes first shall take precedence if in the krama_text_map two have the same key
|
|
3
|
-
* then the one that comes first shall be chosen
|
|
4
|
-
* For eg. kau (from Bengali)
|
|
5
|
-
* the "au" can land both on au and auU because of tne nature of the binary search algorithm
|
|
6
|
-
* so to componsate that we chose the first one in case of multiple possible mappings
|
|
7
|
-
*
|
|
8
|
-
* So Be careful with similar mAtrAs, different forms of the same vyanajana (like with nuqta and other forms)
|
|
9
|
-
*/
|
|
10
|
-
declare const KramaKeysMap: {
|
|
11
|
-
readonly ॐ: "AUM";
|
|
12
|
-
readonly अ: "a-svara";
|
|
13
|
-
readonly '': "a-mAtrA";
|
|
14
|
-
readonly ॳ: "a1-svara";
|
|
15
|
-
readonly '\u093A': "a1-mAtrA";
|
|
16
|
-
readonly आ: "A-svara";
|
|
17
|
-
readonly '\u093E': "A-mAtrA";
|
|
18
|
-
readonly ॴ: "A1-svara";
|
|
19
|
-
readonly '\u093B': "A1-mAtrA";
|
|
20
|
-
readonly इ: "i-svara";
|
|
21
|
-
readonly '\u093F': "i-mAtrA";
|
|
22
|
-
readonly ई: "I-svara";
|
|
23
|
-
readonly '\u0940': "I-mAtrA";
|
|
24
|
-
readonly उ: "u-svara";
|
|
25
|
-
readonly '\u0941': "u-mAtrA";
|
|
26
|
-
readonly ॶ: "u1-svara";
|
|
27
|
-
readonly '\u0956': "u1-mAtrA";
|
|
28
|
-
readonly ऊ: "U-svara";
|
|
29
|
-
readonly '\u0942': "U-mAtrA";
|
|
30
|
-
readonly ॷ: "U1-svara";
|
|
31
|
-
readonly '\u0957': "U1-mAtrA";
|
|
32
|
-
readonly ए: "E-svara";
|
|
33
|
-
readonly '\u0947': "E-mAtrA";
|
|
34
|
-
readonly ऎ: "e-svara";
|
|
35
|
-
readonly '\u0946': "e-mAtrA";
|
|
36
|
-
readonly ऐ: "ai-svara";
|
|
37
|
-
readonly '\u0948': "ai-mAtrA";
|
|
38
|
-
readonly ऍ: "aiI-svara";
|
|
39
|
-
readonly '\u0945': "aiI-mAtrA";
|
|
40
|
-
readonly ओ: "O-svara";
|
|
41
|
-
readonly '\u094B': "O-mAtrA";
|
|
42
|
-
readonly ऒ: "o-svara";
|
|
43
|
-
readonly '\u094A': "o-mAtrA";
|
|
44
|
-
readonly औ: "au-svara";
|
|
45
|
-
readonly '\u094C': "au-mAtrA";
|
|
46
|
-
readonly ऑ: "auU-svara";
|
|
47
|
-
readonly '\u0949': "auU-mAtrA";
|
|
48
|
-
readonly ऋ: "R-svara";
|
|
49
|
-
readonly '\u0943': "R-mAtrA";
|
|
50
|
-
readonly ॠ: "RR-svara";
|
|
51
|
-
readonly '\u0944': "RR-mAtrA";
|
|
52
|
-
readonly ऌ: "LR-svara";
|
|
53
|
-
readonly '\u0962': "LR-mAtrA";
|
|
54
|
-
readonly ॡ: "LRR-svara";
|
|
55
|
-
readonly '\u0963': "LRR-mAtrA";
|
|
56
|
-
readonly '\u0902': "anusvAra";
|
|
57
|
-
readonly '\u0901': "anunAnAsika";
|
|
58
|
-
readonly '\u0903': "visarga";
|
|
59
|
-
readonly ऽ: "avagraha";
|
|
60
|
-
readonly '\u094D': "halant";
|
|
61
|
-
readonly '\u093C': "nuqta";
|
|
62
|
-
readonly '\u0970': "saMkShepachihna";
|
|
63
|
-
readonly क: "k";
|
|
64
|
-
readonly क़: "kz";
|
|
65
|
-
readonly ख: "kh";
|
|
66
|
-
readonly ख़: "khz";
|
|
67
|
-
readonly ग: "g";
|
|
68
|
-
readonly ग़: "gz";
|
|
69
|
-
readonly ॻ: "g1";
|
|
70
|
-
readonly घ: "gh";
|
|
71
|
-
readonly ङ: "G";
|
|
72
|
-
readonly च: "C";
|
|
73
|
-
readonly छ: "Ch";
|
|
74
|
-
readonly ज: "j";
|
|
75
|
-
readonly ज़: "jz";
|
|
76
|
-
readonly ॼ: "j1";
|
|
77
|
-
readonly झ: "jh";
|
|
78
|
-
readonly ञ: "J";
|
|
79
|
-
readonly त: "t";
|
|
80
|
-
readonly थ: "th";
|
|
81
|
-
readonly द: "d";
|
|
82
|
-
readonly ध: "dh";
|
|
83
|
-
readonly न: "n";
|
|
84
|
-
readonly ऩ: "nz";
|
|
85
|
-
readonly ट: "T";
|
|
86
|
-
readonly ठ: "Th";
|
|
87
|
-
readonly ड: "D";
|
|
88
|
-
readonly ड़: "Dz";
|
|
89
|
-
readonly ॾ: "D1";
|
|
90
|
-
readonly ढ: "Dh";
|
|
91
|
-
readonly ढ़: "Dhz";
|
|
92
|
-
readonly ण: "N";
|
|
93
|
-
readonly प: "p";
|
|
94
|
-
readonly फ: "ph";
|
|
95
|
-
readonly फ़: "phz";
|
|
96
|
-
readonly ब: "b";
|
|
97
|
-
readonly ॿ: "b1";
|
|
98
|
-
readonly भ: "bh";
|
|
99
|
-
readonly म: "m";
|
|
100
|
-
readonly य: "y";
|
|
101
|
-
readonly य़: "yz";
|
|
102
|
-
readonly व: "v";
|
|
103
|
-
readonly र: "r";
|
|
104
|
-
readonly ऱ: "rz";
|
|
105
|
-
readonly ल: "l";
|
|
106
|
-
readonly ळ: "L";
|
|
107
|
-
readonly ऴ: "Lz";
|
|
108
|
-
readonly ह: "h";
|
|
109
|
-
readonly स: "s";
|
|
110
|
-
readonly श: "sh";
|
|
111
|
-
readonly ष: "Sh";
|
|
112
|
-
readonly '\u0952': "anudAttA";
|
|
113
|
-
readonly '\u0951': "udAtta-1";
|
|
114
|
-
readonly '\u1CDA': "udAtta-2";
|
|
115
|
-
readonly '\u1CDB': "udAtta-3";
|
|
116
|
-
readonly '\u0966': "0";
|
|
117
|
-
readonly '\u0967': "1";
|
|
118
|
-
readonly '\u0968': "2";
|
|
119
|
-
readonly '\u0969': "3";
|
|
120
|
-
readonly '\u096A': "4";
|
|
121
|
-
readonly '\u096B': "5";
|
|
122
|
-
readonly '\u096C': "6";
|
|
123
|
-
readonly '\u096D': "7";
|
|
124
|
-
readonly '\u096E': "8";
|
|
125
|
-
readonly '\u096F': "9";
|
|
126
|
-
readonly '\u0964': "virama";
|
|
127
|
-
readonly '\u0965': "double_virama";
|
|
128
|
-
};
|
|
129
|
-
export declare const KramaKeysArray: (keyof typeof KramaKeysMap)[];
|
|
130
|
-
/**
|
|
131
|
-
* Krama(क्रम) is the array in which most of the keys used in scripts are present
|
|
132
|
-
* It is an array which contains and describes common elements of different scripts allowing fast and efficient lookup
|
|
133
|
-
* and transliteration of different scripts
|
|
134
|
-
*/
|
|
135
|
-
export type KramaKeysType = (typeof KramaKeysArray)[number];
|
|
136
|
-
export type KramaKeysLabelType = (typeof KramaKeysMap)[KramaKeysType];
|
|
137
|
-
export declare const KramaLabelsArray: KramaKeysLabelType[];
|
|
138
|
-
export declare const KramaKeysIndexB: number[];
|
|
139
|
-
export declare const KramaLabelsIndexB: number[];
|
|
140
|
-
/** This type will be used as a convinient method to dscribe the krama key which we want to map to
|
|
141
|
-
* This shall be ultimately converted to KramaKeysType
|
|
142
|
-
*/
|
|
143
|
-
export type KramaKeysExtendedType = KramaKeysType | KramaKeysLabelType;
|
|
144
|
-
export declare const resolveKramaKeysExtendedType: (krama_key_ext: KramaKeysExtendedType) => KramaKeysType;
|
|
145
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { InputBrahmicScriptType, InputOtherScriptType } from './input_script_data_schema';
|
|
2
|
-
type CommonScriptData = {
|
|
3
|
-
/** Stores the key of the current script along with the reference to the index in `list` for info about the key
|
|
4
|
-
* `string` is the actual key, number(nullable) is the index of the key in the compiled `list`
|
|
5
|
-
*/
|
|
6
|
-
krama_text_arr: [krama_key: string, list_arr_ref: number | null][];
|
|
7
|
-
/** To be used for binary search on the `krama_key_map` */
|
|
8
|
-
krama_text_arr_index: number[];
|
|
9
|
-
/** `string` used for search. Usable for Duplication Remova, Fallback Behaviour
|
|
10
|
-
* and for `other` scripts type. Like Normal
|
|
11
|
-
* This will be a sorted array, so binary search can be directly used in it */
|
|
12
|
-
text_to_krama_map: [
|
|
13
|
-
text: string,
|
|
14
|
-
{
|
|
15
|
-
next?: string[] | null;
|
|
16
|
-
/** Multiple krama index references are useful to some intermediate states. For eg:- Normal A -> A, AU -> A, U and AUM -> AUM
|
|
17
|
-
* This will be useful only when there are more than two transition states. As double transition state outputs dont need multiple krama references.
|
|
18
|
-
* For eg -> The Bengali kz (actually k + nukta) will be a two step mapping, k -> k (next :nukta,... ) and k+nukta->kz krama reference in the main transliteration array
|
|
19
|
-
* There is also an option to prevent this auto behaviour. Like for tamil we dont iru in tamil to map to R in krama key so we manually disable it
|
|
20
|
-
* This can also be used to define the fallback combination. The array allows a multiple krama keys to be combined together to form a fallback
|
|
21
|
-
* Like .100 = .1+.0+.0
|
|
22
|
-
*/
|
|
23
|
-
krama?: number[] | null;
|
|
24
|
-
/** This will be useful to get info related to the fallback if they happen to be a svara or a vyanjana
|
|
25
|
-
* eg. The Malayalam .n,.N, etc
|
|
26
|
-
*/
|
|
27
|
-
fallback_list_ref?: number | null;
|
|
28
|
-
}
|
|
29
|
-
][];
|
|
30
|
-
list: {
|
|
31
|
-
/** Indexes of the the corresponding entries in `krama_key_map` corresponding to the `key_krama` */
|
|
32
|
-
krama_ref: number[];
|
|
33
|
-
type: NonNullable<NonNullable<InputOtherScriptType['list']>[number]['type']>;
|
|
34
|
-
}[];
|
|
35
|
-
};
|
|
36
|
-
export type OutputBrahmicScriptData = Pick<InputBrahmicScriptType, 'script_name' | 'script_id' | 'halant' | 'nuqta' | 'schwa_property' | 'script_type'> & Omit<CommonScriptData, 'list'> & {
|
|
37
|
-
list: (Pick<CommonScriptData['list'][number], 'krama_ref'> & ({
|
|
38
|
-
type: Exclude<InputBrahmicScriptType['list'][number]['type'] | 'mAtrA', 'svara'>;
|
|
39
|
-
} | {
|
|
40
|
-
type: 'svara';
|
|
41
|
-
mAtrA_krama_ref?: number[] | null;
|
|
42
|
-
}))[];
|
|
43
|
-
};
|
|
44
|
-
export type OutputOtherScriptData = Pick<InputOtherScriptType, 'script_name' | 'script_id' | 'script_type' | 'schwa_character'> & CommonScriptData;
|
|
45
|
-
export type OutputScriptData = OutputBrahmicScriptData | OutputOtherScriptData;
|
|
46
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare function copy_plain_object<T>(obj: T): T;
|
|
2
|
-
export declare function get_permutations(range: [number, number], count?: number): number[][];
|
|
3
|
-
/**
|
|
4
|
-
* This replaces `{key}` with the corresponding value in `options`
|
|
5
|
-
*/
|
|
6
|
-
export declare function format_string_text(text: string, options: Record<string, any>): string;
|
|
7
|
-
export declare function cleanUpWhitespace(input: string, replace_multiple_white_spaces?: boolean): string;
|
|
8
|
-
export declare function get_random_number(start: number, end: number): number;
|
|
9
|
-
/**
|
|
10
|
-
* Deeply clones a value of type T.
|
|
11
|
-
* - Primitives are returned as-is.
|
|
12
|
-
* - Arrays and plain objects (including null prototypes) are recursively cloned.
|
|
13
|
-
* - Date, Map, Set are specially handled.
|
|
14
|
-
* - Cyclic structures are supported via a WeakMap cache.
|
|
15
|
-
* - Other objects (e.g. functions, class instances) are returned by reference.
|
|
16
|
-
*/
|
|
17
|
-
export declare function deepCopy<T>(value: T, visited?: WeakMap<object, unknown>): T;
|
|
18
|
-
export declare function toUnicodeEscapes(input: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { OutputBrahmicScriptData, OutputScriptData } from '../make_script_data/output_script_data_schema';
|
|
2
|
-
import { script_list_type } from '../utils/lang_list';
|
|
3
|
-
export type prev_context_array_type = [
|
|
4
|
-
string | undefined,
|
|
5
|
-
OutputBrahmicScriptData['list'][number] | null | undefined
|
|
6
|
-
][];
|
|
7
|
-
export declare const kramaTextOrNull: (script: OutputScriptData, idx: number) => string | null;
|
|
8
|
-
export declare const kramaTextOrEmpty: (script: OutputScriptData, idx: number) => string;
|
|
9
|
-
export declare const kramaIndexOfText: (script_data: OutputScriptData, text: string) => number;
|
|
10
|
-
export declare const string_builder: () => {
|
|
11
|
-
emit: (text: string) => void;
|
|
12
|
-
emitPieces: (pieces: string[]) => void;
|
|
13
|
-
lastPiece: () => string | undefined;
|
|
14
|
-
lastChar: () => string | undefined;
|
|
15
|
-
popLastChar: () => string | undefined;
|
|
16
|
-
rewriteTailPieces: (count: number, newPieces: string[]) => void;
|
|
17
|
-
withLastCharMovedAfter: (beforePieces: string[], afterPieces: string[]) => void;
|
|
18
|
-
toString: () => string;
|
|
19
|
-
rewriteAt: (index: number, newPiece: string) => void;
|
|
20
|
-
peekAt: (index: number) => CursorCp | null;
|
|
21
|
-
};
|
|
22
|
-
export declare const prev_context_builder: (maxLen: number) => {
|
|
23
|
-
clear: () => void;
|
|
24
|
-
length: () => number;
|
|
25
|
-
at: (i: number) => [string | undefined, (Pick<{
|
|
26
|
-
krama_ref: number[];
|
|
27
|
-
type: NonNullable<NonNullable<import('../make_script_data/input_script_data_schema').InputOtherScriptType["list"]>[number]["type"]>;
|
|
28
|
-
}, "krama_ref"> & ({
|
|
29
|
-
type: Exclude<import('../make_script_data/input_script_data_schema').InputBrahmicScriptType["list"][number]["type"] | "mAtrA", "svara">;
|
|
30
|
-
} | {
|
|
31
|
-
type: "svara";
|
|
32
|
-
mAtrA_krama_ref?: number[] | null;
|
|
33
|
-
})) | null | undefined] | undefined;
|
|
34
|
-
last: () => [string | undefined, (Pick<{
|
|
35
|
-
krama_ref: number[];
|
|
36
|
-
type: NonNullable<NonNullable<import('../make_script_data/input_script_data_schema').InputOtherScriptType["list"]>[number]["type"]>;
|
|
37
|
-
}, "krama_ref"> & ({
|
|
38
|
-
type: Exclude<import('../make_script_data/input_script_data_schema').InputBrahmicScriptType["list"][number]["type"] | "mAtrA", "svara">;
|
|
39
|
-
} | {
|
|
40
|
-
type: "svara";
|
|
41
|
-
mAtrA_krama_ref?: number[] | null;
|
|
42
|
-
})) | null | undefined] | undefined;
|
|
43
|
-
lastText: () => string | undefined;
|
|
44
|
-
lastType: () => ("svara" | "vyanjana" | "anya" | "mAtrA") | undefined;
|
|
45
|
-
typeAt: (i: number) => ("svara" | "vyanjana" | "anya" | "mAtrA") | undefined;
|
|
46
|
-
textAt: (i: number) => string | undefined;
|
|
47
|
-
isLastType: (t: "svara" | "vyanjana" | "anya" | "mAtrA") => boolean;
|
|
48
|
-
push: (item: [string | undefined, (Pick<{
|
|
49
|
-
krama_ref: number[];
|
|
50
|
-
type: NonNullable<NonNullable<import('../make_script_data/input_script_data_schema').InputOtherScriptType["list"]>[number]["type"]>;
|
|
51
|
-
}, "krama_ref"> & ({
|
|
52
|
-
type: Exclude<import('../make_script_data/input_script_data_schema').InputBrahmicScriptType["list"][number]["type"] | "mAtrA", "svara">;
|
|
53
|
-
} | {
|
|
54
|
-
type: "svara";
|
|
55
|
-
mAtrA_krama_ref?: number[] | null;
|
|
56
|
-
})) | null | undefined]) => void;
|
|
57
|
-
};
|
|
58
|
-
type CursorCp = {
|
|
59
|
-
cp: number;
|
|
60
|
-
ch: string;
|
|
61
|
-
width: number;
|
|
62
|
-
};
|
|
63
|
-
export declare const make_input_cursor: (text: string) => {
|
|
64
|
-
readonly pos: number;
|
|
65
|
-
peek: () => CursorCp | null;
|
|
66
|
-
peekAt: (index: number) => CursorCp | null;
|
|
67
|
-
peekAtOffsetUnits: (offsetUnits: number) => CursorCp | null;
|
|
68
|
-
advance: (units: number) => void;
|
|
69
|
-
slice: (from: number, to: number) => string;
|
|
70
|
-
};
|
|
71
|
-
type PeekAtLike = (index: number) => {
|
|
72
|
-
ch: string;
|
|
73
|
-
} | null;
|
|
74
|
-
export declare const matchPrevKramaSequence: (peekAt: PeekAtLike, anchorIndex: number, prev: number[], script_data: OutputScriptData) => {
|
|
75
|
-
matched: boolean;
|
|
76
|
-
matchedLen: number;
|
|
77
|
-
};
|
|
78
|
-
export declare const replaceWithPieces: (replace_with: number[], script_data: OutputScriptData) => string[];
|
|
79
|
-
export declare const TAMIL_EXTENDED_SUPERSCRIPT_NUMBERS: readonly ["²", "³", "⁴"];
|
|
80
|
-
export declare const isTaExtSuperscriptTail: (ch: string | undefined) => boolean;
|
|
81
|
-
export declare const isScriptTamilExt: (script_name: script_list_type) => boolean;
|
|
82
|
-
/** Emit pieces, optionally reordering relative to a trailing Tamil-Extended superscript number.
|
|
83
|
-
*
|
|
84
|
-
* When `should_reorder` is true, this will move the last output *character* (typically the superscript)
|
|
85
|
-
* after the emitted pieces (with special handling when the first piece begins with `halant`).
|
|
86
|
-
*
|
|
87
|
-
* Caller is responsible for deciding when reordering is semantically correct.
|
|
88
|
-
*/
|
|
89
|
-
export declare const emitPiecesWithTaExtSuperscriptReorder: (result: ReturnType<typeof string_builder>, pieces: string[], halant: string, should_reorder: boolean) => void;
|
|
90
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { script_and_lang_list_type } from '../utils/lang_list';
|
|
3
|
-
export declare const TestDataTypeSchema: z.ZodObject<{
|
|
4
|
-
index: z.ZodNumber;
|
|
5
|
-
from: z.ZodString;
|
|
6
|
-
to: z.ZodString;
|
|
7
|
-
input: z.ZodString;
|
|
8
|
-
output: z.ZodString;
|
|
9
|
-
reversible: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
-
todo: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
export declare function emulateTyping(text: string, typing_lang: script_and_lang_list_type): Promise<string>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { OutputScriptData } from '../make_script_data/output_script_data_schema';
|
|
2
|
-
import { script_list_type } from '../utils/lang_list';
|
|
3
|
-
import { default as custom_options_json } from '../custom_options.json';
|
|
4
|
-
import { OptionsType } from '../make_script_data/custom_options_input';
|
|
5
|
-
export type CustomOptionList = keyof typeof custom_options_json;
|
|
6
|
-
export type CustomOptionType = {
|
|
7
|
-
[key in CustomOptionList]?: boolean;
|
|
8
|
-
};
|
|
9
|
-
type CustomRulesType = OptionsType[keyof OptionsType]['rules'];
|
|
10
|
-
/**
|
|
11
|
-
* Returns the active custom options to applied based on the `from` and `to` script information
|
|
12
|
-
*/
|
|
13
|
-
export declare const get_active_custom_options: (from_script_data: OutputScriptData, to_script_data: OutputScriptData, input_options?: Record<string, boolean>) => CustomOptionType;
|
|
14
|
-
/** Resolve active options + flattened rule list once, so hot paths can reuse it. */
|
|
15
|
-
export declare const resolve_transliteration_rules: (from_script_data: OutputScriptData, to_script_data: OutputScriptData, transliteration_input_options?: CustomOptionType) => {
|
|
16
|
-
trans_options: CustomOptionType;
|
|
17
|
-
custom_rules: CustomRulesType;
|
|
18
|
-
};
|
|
19
|
-
/** Apply replacement rules using direct replaceAll method if exist */
|
|
20
|
-
export declare const apply_custom_replace_rules: (text: string, script_data: OutputScriptData, rules: OptionsType[keyof OptionsType]["rules"], allowed_input_rule_type: OptionsType[keyof OptionsType]["rules"][number]["check_in"]) => string;
|
|
21
|
-
/**
|
|
22
|
-
* Synchronous version for low latency use cases
|
|
23
|
-
*
|
|
24
|
-
* Like typing
|
|
25
|
-
*/
|
|
26
|
-
export declare const transliterate_text_core: (text: string, from_script_name: script_list_type, to_script_name: script_list_type, from_script_data: OutputScriptData, to_script_data: OutputScriptData, trans_options: CustomOptionType, custom_rules: CustomRulesType, options?: {
|
|
27
|
-
/** This enables typing mode, returns a context length which will be used to clear the external context */
|
|
28
|
-
typing_mode?: boolean;
|
|
29
|
-
}) => {
|
|
30
|
-
output: string;
|
|
31
|
-
/** Can be used to manage context while using the typing feature.
|
|
32
|
-
* If this is 0, the external context can be cleared
|
|
33
|
-
*/
|
|
34
|
-
context_length: number;
|
|
35
|
-
};
|
|
36
|
-
/** Async version for general use */
|
|
37
|
-
export declare const transliterate_text: (text: string, from_script_name: script_list_type, to_script_name: script_list_type, transliteration_input_options?: CustomOptionType, options?: {
|
|
38
|
-
/** This enables typing mode, returns a context length which will be used to clear the external context */
|
|
39
|
-
typing_mode?: boolean;
|
|
40
|
-
}) => Promise<{
|
|
41
|
-
output: string;
|
|
42
|
-
/** Can be used to manage context while using the typing feature.
|
|
43
|
-
* If this is 0, the external context can be cleared
|
|
44
|
-
*/
|
|
45
|
-
context_length: number;
|
|
46
|
-
}>;
|
|
47
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
type Accessor<T, K> = (arr: readonly T[], i: number) => K;
|
|
2
|
-
type CompareFn<K> = (a: K, b: K) => number;
|
|
3
|
-
interface SearchIndexOptions<T, K> {
|
|
4
|
-
accessor?: Accessor<T, K>;
|
|
5
|
-
compareFn?: CompareFn<K>;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Creates a sorted index for binary search on an unsorted array.
|
|
9
|
-
*/
|
|
10
|
-
export declare function createSearchIndex<T, K = T>(arr: readonly T[], options?: SearchIndexOptions<T, K>): number[];
|
|
11
|
-
/**
|
|
12
|
-
* Performs binary search(lower bound) using a pre-built index.
|
|
13
|
-
*/
|
|
14
|
-
export declare function binarySearchLowerWithIndex<T, K = T>(arr: readonly T[], index: readonly number[], target: K, options?: SearchIndexOptions<T, K>): number;
|
|
15
|
-
/**
|
|
16
|
-
* Sorts an array using the provided accessor and compare functions.
|
|
17
|
-
* Returns a new sorted array.
|
|
18
|
-
*/
|
|
19
|
-
export declare function sortArray<T, K = T>(arr: readonly T[], options?: SearchIndexOptions<T, K>): T[];
|
|
20
|
-
/**
|
|
21
|
-
* Performs binary search(lower bound) on a sorted array.
|
|
22
|
-
* Returns the index of the target element, or -1 if not found.
|
|
23
|
-
*/
|
|
24
|
-
export declare function binarySearchLower<T, K = T>(arr: readonly T[], target: K, options?: SearchIndexOptions<T, K>): number;
|
|
25
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { script_list_type } from './lang_list';
|
|
2
|
-
import { OutputScriptData } from '../make_script_data/output_script_data_schema';
|
|
3
|
-
/**
|
|
4
|
-
* Gets the script data for a given script name
|
|
5
|
-
* @param script_name - The name of the script to get the data for
|
|
6
|
-
* @returns The script data
|
|
7
|
-
*/
|
|
8
|
-
export declare const getScriptData: (script_name: script_list_type) => Promise<OutputScriptData>;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
declare const script_list: {
|
|
2
|
-
Devanagari: number;
|
|
3
|
-
Telugu: number;
|
|
4
|
-
Tamil: number;
|
|
5
|
-
"Tamil-Extended": number;
|
|
6
|
-
Bengali: number;
|
|
7
|
-
Kannada: number;
|
|
8
|
-
Gujarati: number;
|
|
9
|
-
Malayalam: number;
|
|
10
|
-
Odia: number;
|
|
11
|
-
Sinhala: number;
|
|
12
|
-
Normal: number;
|
|
13
|
-
Romanized: number;
|
|
14
|
-
Gurumukhi: number;
|
|
15
|
-
Assamese: number;
|
|
16
|
-
"Purna-Devanagari": number;
|
|
17
|
-
Brahmi: number;
|
|
18
|
-
Granth: number;
|
|
19
|
-
Modi: number;
|
|
20
|
-
Sharada: number;
|
|
21
|
-
Siddham: number;
|
|
22
|
-
}, lang_list: {
|
|
23
|
-
English: number;
|
|
24
|
-
Sanskrit: number;
|
|
25
|
-
Hindi: number;
|
|
26
|
-
Telugu: number;
|
|
27
|
-
Tamil: number;
|
|
28
|
-
Bengali: number;
|
|
29
|
-
Kannada: number;
|
|
30
|
-
Gujarati: number;
|
|
31
|
-
Malayalam: number;
|
|
32
|
-
Odia: number;
|
|
33
|
-
Sinhala: number;
|
|
34
|
-
Marathi: number;
|
|
35
|
-
Nepali: number;
|
|
36
|
-
Punjabi: number;
|
|
37
|
-
Assamese: number;
|
|
38
|
-
};
|
|
39
|
-
export type script_list_type = keyof typeof script_list;
|
|
40
|
-
export declare const SCRIPT_LIST: script_list_type[];
|
|
41
|
-
export declare const SCRIPT_LIST_IDS: number[];
|
|
42
|
-
export declare const get_script_from_id: (id: number) => script_list_type;
|
|
43
|
-
export type lang_list_type = keyof typeof lang_list;
|
|
44
|
-
export declare const LANG_LIST: lang_list_type[];
|
|
45
|
-
export declare const LANG_LIST_IDS: number[];
|
|
46
|
-
export declare const get_lang_from_id: (id: number) => lang_list_type;
|
|
47
|
-
export type script_and_lang_list_type = script_list_type | lang_list_type;
|
|
48
|
-
export declare const ALL_LANG_SCRIPT_LIST: script_and_lang_list_type[];
|
|
49
|
-
export { lang_list as lang_list_obj, script_list as script_list_obj };
|
|
50
|
-
export declare const LANG_SCRIPT_MAP: Record<lang_list_type, script_list_type>;
|