@vm75/inditrans 0.3.6 → 0.4.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.4.1
2
+
3
+ - Split symbols, Zero Width chars and Vedic symbols
4
+
5
+ ## 0.4.0
6
+
7
+ - Lot of refactoring.
8
+
1
9
  ## 0.3.6
2
10
 
3
11
  - Refactored nodejs interface. Updated readme.
@@ -32,7 +40,7 @@
32
40
 
33
41
  ## 0.1.8
34
42
 
35
- - Made InferAnuswara automatic. Fixed Diactric for Vowels.
43
+ - Made InferAnuswara automatic. Fixed Diacritic for Vowels.
36
44
 
37
45
  ## 0.1.7
38
46
 
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # inditrans
2
2
 
3
- An experimental transliterator library for some [Indic/Brahmi](https://en.wikipedia.org/wiki/Brahmic_scripts) scripts.
3
+ An experimental transliterator library for some [Indic/Brahmic](https://en.wikipedia.org/wiki/Brahmic_scripts) scripts.
4
4
 
5
5
  - Self-contained and performant. Uses wasm.
6
6
  - Supports [vedic accents](https://en.wikipedia.org/wiki/Vedic_accent). Useful for vedic scriptures.
7
7
  - Smart transliteration to and from Tamil. Supports tamil superscript.
8
+ - Very small footprint (< 80kb uncompressed).
8
9
 
9
10
  References:
10
11
 
@@ -14,7 +15,7 @@ References:
14
15
 
15
16
  ## Supported scripts
16
17
 
17
- - Brahmi scripts:
18
+ - Indic/Brahmic scripts:
18
19
  - assamese
19
20
  - bengali
20
21
  - devanagari
@@ -26,12 +27,12 @@ References:
26
27
  - sinhala
27
28
  - tamil
28
29
  - telugu
29
- - Roman scripts
30
+ - Latin/Roman scripts
30
31
  - iast (https://en.wikipedia.org/wiki/International_Alphabet_of_Sanskrit_Transliteration)
31
32
  - ipa (https://en.wikipedia.org/wiki/International_Phonetic_Alphabet)
32
33
  - iso 15919 (https://en.wikipedia.org/wiki/ISO_15919)
33
34
  - itrans (https://en.wikipedia.org/wiki/ITRANS)
34
- - readablelatin (easy to read latin script)
35
+ - readablelatin (easy to read in Latin alphabets with some customizations)
35
36
 
36
37
  ## Installation
37
38
 
@@ -9,4 +9,5 @@ export declare class Inditrans {
9
9
  private utf82ToString;
10
10
  private stringToUtf8;
11
11
  transliterate(text: string, from: Script, to: Script, options: Option): string;
12
+ isScriptSupported(script: string): boolean;
12
13
  }
@@ -54,6 +54,12 @@ class Inditrans {
54
54
  pointers.map((ptr) => this.module.stackRestore(ptr));
55
55
  return result;
56
56
  }
57
+ isScriptSupported(script) {
58
+ const ptr = this.stringToUtf8(script);
59
+ const result = this.module.isScriptSupported(ptr);
60
+ this.module.stackRestore(ptr);
61
+ return result == 1;
62
+ }
57
63
  }
58
64
  exports.Inditrans = Inditrans;
59
65
  //# sourceMappingURL=Inditrans.js.map
@@ -1,5 +1,6 @@
1
1
  export interface InditransModule {
2
2
  transliterate(text: number, from: number, to: number, options: number): number;
3
+ isScriptSupported(script: number): number;
3
4
  releaseBuffer(ptr: number): void;
4
5
  stackAlloc(size: number): number;
5
6
  stackRestore(ptr: number): void;
@@ -1,9 +1,8 @@
1
1
  export declare enum Option {
2
2
  None = 0,
3
- IgnoreVedicAccents = 1,
4
- IgnoreQuotedMarkers = 2,
5
- TamilTraditional = 4,
6
- TamilSuperscripted = 8,
7
- RetainZeroWidthChars = 16,
8
- ASCIINumerals = 32
3
+ TamilTraditional = 1,
4
+ TamilSuperscripted = 2,
5
+ ASCIINumerals = 4,
6
+ IgnoreVedicAccents = 8,
7
+ ShowQuotedMarkers = 16
9
8
  }
@@ -4,11 +4,10 @@ exports.Option = void 0;
4
4
  var Option;
5
5
  (function (Option) {
6
6
  Option[Option["None"] = 0] = "None";
7
- Option[Option["IgnoreVedicAccents"] = 1] = "IgnoreVedicAccents";
8
- Option[Option["IgnoreQuotedMarkers"] = 2] = "IgnoreQuotedMarkers";
9
- Option[Option["TamilTraditional"] = 4] = "TamilTraditional";
10
- Option[Option["TamilSuperscripted"] = 8] = "TamilSuperscripted";
11
- Option[Option["RetainZeroWidthChars"] = 16] = "RetainZeroWidthChars";
12
- Option[Option["ASCIINumerals"] = 32] = "ASCIINumerals";
7
+ Option[Option["TamilTraditional"] = 1] = "TamilTraditional";
8
+ Option[Option["TamilSuperscripted"] = 2] = "TamilSuperscripted";
9
+ Option[Option["ASCIINumerals"] = 4] = "ASCIINumerals";
10
+ Option[Option["IgnoreVedicAccents"] = 8] = "IgnoreVedicAccents";
11
+ Option[Option["ShowQuotedMarkers"] = 16] = "ShowQuotedMarkers";
13
12
  })(Option = exports.Option || (exports.Option = {}));
14
13
  //# sourceMappingURL=Option.js.map
@@ -3,5 +3,6 @@ import { Script } from './Script';
3
3
  export { Option, Script };
4
4
  export declare function init(): Promise<void>;
5
5
  export declare function transliterate(text: string, from: Script, to: Script, options: Option): string;
6
- declare const _default: (typeof Option | typeof Script | typeof init | typeof transliterate)[];
6
+ export declare function isScriptSupported(script: string): boolean;
7
+ declare const _default: (typeof Option | typeof Script | typeof init | typeof transliterate | typeof isScriptSupported)[];
7
8
  export default _default;
package/dist/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transliterate = exports.init = exports.Script = exports.Option = void 0;
3
+ exports.isScriptSupported = exports.transliterate = exports.init = exports.Script = exports.Option = void 0;
4
4
  const Inditrans_1 = require("./Inditrans");
5
5
  const Option_1 = require("./Option");
6
6
  Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return Option_1.Option; } });
@@ -18,5 +18,12 @@ function transliterate(text, from, to, options) {
18
18
  return inditrans.transliterate(text, from, to, options);
19
19
  }
20
20
  exports.transliterate = transliterate;
21
- exports.default = [Option_1.Option, Script_1.Script, init, transliterate];
21
+ function isScriptSupported(script) {
22
+ if (!inditrans) {
23
+ throw new Error('Inditrans not initialized');
24
+ }
25
+ return inditrans.isScriptSupported(script);
26
+ }
27
+ exports.isScriptSupported = isScriptSupported;
28
+ exports.default = [Option_1.Option, Script_1.Script, init, transliterate, isScriptSupported];
22
29
  //# sourceMappingURL=index.js.map
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vm75/inditrans",
3
- "version": "0.3.6",
4
- "description": "An experimental transliterator library for some Indic scripts.",
3
+ "version": "0.4.1",
4
+ "description": "An experimental transliterator library for some Indic/Brahmic scripts.",
5
5
  "main": "./dist/src/index.js",
6
6
  "author": "VM75",
7
7
  "license": "MIT",
@@ -22,8 +22,8 @@
22
22
  "watch": "tsc --watch",
23
23
  "test": "yarn build && yarn jest --config jestconfig.json",
24
24
  "copy-files": "shx mkdir -p dist/src && shx cp -f src/inditrans.wasm dist/src/",
25
- "prepack": "yarn clean && yarn build",
26
- "pub": "yarn test && npm publish --access=public"
25
+ "prepack": "yarn clean && yarn test",
26
+ "pub": "npm publish --access=public"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/jest": "^27.0.2",
@@ -39,5 +39,29 @@
39
39
  "ts-jest": "^27.0.5",
40
40
  "ts-node": "^10.9.1",
41
41
  "typescript": "^4.5.4"
42
- }
42
+ },
43
+ "keywords": [
44
+ "transliterator",
45
+ "transliteration",
46
+ "indian",
47
+ "indian language",
48
+ "indian script",
49
+ "devanagari",
50
+ "tamil",
51
+ "sanskrit",
52
+ "telugu",
53
+ "kannada",
54
+ "malayalam",
55
+ "bengali",
56
+ "gurmukhi",
57
+ "gujarati",
58
+ "oriya",
59
+ "brahmic",
60
+ "vedic accents",
61
+ "wasm",
62
+ "ISO 15919",
63
+ "IAST",
64
+ "ITRANS",
65
+ "IPA"
66
+ ]
43
67
  }