@sarmay/kaz-converter 0.1.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.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # @sarmay/kaz-converter
2
+
3
+ 轻量、开箱即用的哈萨克语文字转换包,负责:
4
+
5
+ - 阿拉伯文 Tote Zhazu -> 西里尔文
6
+ - 西里尔文 -> 阿拉伯文 Tote Zhazu
7
+ - 浏览器 ESM
8
+ - Node.js
9
+
10
+ 这个包默认不包含语言模型,不依赖 `onnxruntime-node`,适合 Web 和普通 Node.js 项目直接使用。
11
+
12
+ ## 安装
13
+
14
+ ```bash
15
+ npm install @sarmay/kaz-converter
16
+ ```
17
+
18
+ ## 浏览器使用
19
+
20
+ ```ts
21
+ import { arb2syr, syr2arb } from "@sarmay/kaz-converter";
22
+
23
+ console.log(arb2syr("قازاقستان"));
24
+ console.log(syr2arb("Қазақстан"));
25
+ ```
26
+
27
+ 也可以直接用 CDN:
28
+
29
+ ```html
30
+ <script type="module">
31
+ import { arb2syr, syr2arb } from "https://cdn.jsdelivr.net/npm/@sarmay/kaz-converter/dist/index.js";
32
+
33
+ console.log(arb2syr("سالەم"));
34
+ console.log(syr2arb("Сәлем"));
35
+ </script>
36
+ ```
37
+
38
+ ## Node.js 使用
39
+
40
+ ```ts
41
+ import {
42
+ ArabicToCyrillicConverter,
43
+ CyrillicToArabicConverter,
44
+ arb2syr,
45
+ syr2arb
46
+ } from "@sarmay/kaz-converter";
47
+
48
+ console.log(arb2syr("الما"));
49
+ console.log(syr2arb("Алматы"));
50
+
51
+ const arb2cyr = new ArabicToCyrillicConverter();
52
+ const cyr2arb = new CyrillicToArabicConverter();
53
+
54
+ console.log(arb2cyr.convert("اكەم كەلدى."));
55
+ console.log(cyr2arb.convert("Қазақстан"));
56
+ ```
57
+
58
+ ## API
59
+
60
+ - `arb2syr(text)`
61
+ - `arb2syrAsync(text, options)`
62
+ - `syr2arb(text)`
63
+ - `new ArabicToCyrillicConverter(options?)`
64
+ - `new CyrillicToArabicConverter(options?)`
65
+ - `new NoopDisambiguator()`
66
+
67
+ ## 想接入 LM 消歧
68
+
69
+ 请安装第二个包:
70
+
71
+ ```bash
72
+ npm install @sarmay/kaz-converter @sarmay/kaz-converter-lm
73
+ ```
74
+
75
+ 然后参考 `@sarmay/kaz-converter-lm` 的 README,或者仓库根目录 README。