js-opencc 1.0.1 → 1.3.2
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 +149 -75
- package/data/custom/CNTWPhrases.txt +4 -7
- package/data/custom/ProtectedDict.txt +60 -0
- package/data/official/HKVariants.txt +8 -1
- package/data/official/HKVariantsRevPhrases.txt +1045 -130
- package/data/official/JPShinjitaiCharacters.txt +7 -0
- package/data/official/JPShinjitaiPhrases.txt +7 -0
- package/data/official/JPVariants.txt +9 -1
- package/data/official/STCharacters.txt +42 -7
- package/data/official/STPhrases.txt +648 -603
- package/data/official/TSCharacters.txt +1808 -894
- package/data/official/TSPhrases.txt +29 -2
- package/data/official/TWPhrases.txt +711 -0
- package/data/official/TWPhrasesRev.txt +714 -0
- package/data/official/TWVariants.txt +7 -1
- package/data/official/TWVariantsRevPhrases.txt +987 -34
- package/dist/bundles/cn2t.d.ts +13 -4
- package/dist/bundles/cn2t.d.ts.map +1 -1
- package/dist/bundles/cn2t.js +20 -11
- package/dist/bundles/cn2t.js.map +1 -1
- package/dist/bundles/full.d.ts +13 -4
- package/dist/bundles/full.d.ts.map +1 -1
- package/dist/bundles/full.js +26 -5
- package/dist/bundles/full.js.map +1 -1
- package/dist/bundles/t2cn.d.ts +9 -4
- package/dist/bundles/t2cn.d.ts.map +1 -1
- package/dist/bundles/t2cn.js +14 -5
- package/dist/bundles/t2cn.js.map +1 -1
- package/dist/converter.d.ts +33 -9
- package/dist/converter.d.ts.map +1 -1
- package/dist/converter.js +105 -38
- package/dist/converter.js.map +1 -1
- package/dist/core.d.ts +53 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +208 -1
- package/dist/core.js.map +1 -1
- package/dist/dict/CNTWPhrases.d.ts +1 -1
- package/dist/dict/CNTWPhrases.d.ts.map +1 -1
- package/dist/dict/CNTWPhrases.js +1 -1
- package/dist/dict/CNTWPhrases.js.map +1 -1
- package/dist/dict/HKVariants.d.ts +1 -1
- package/dist/dict/HKVariants.d.ts.map +1 -1
- package/dist/dict/HKVariants.js +1 -1
- package/dist/dict/HKVariants.js.map +1 -1
- package/dist/dict/HKVariantsRev.d.ts +1 -1
- package/dist/dict/HKVariantsRev.d.ts.map +1 -1
- package/dist/dict/HKVariantsRev.js +1 -1
- package/dist/dict/HKVariantsRev.js.map +1 -1
- package/dist/dict/HKVariantsRevPhrases.d.ts +1 -1
- package/dist/dict/HKVariantsRevPhrases.d.ts.map +1 -1
- package/dist/dict/HKVariantsRevPhrases.js +1 -1
- package/dist/dict/HKVariantsRevPhrases.js.map +1 -1
- package/dist/dict/JPVariants.d.ts +1 -1
- package/dist/dict/JPVariants.d.ts.map +1 -1
- package/dist/dict/JPVariants.js +1 -1
- package/dist/dict/JPVariants.js.map +1 -1
- package/dist/dict/JPVariantsRev.d.ts +1 -1
- package/dist/dict/JPVariantsRev.d.ts.map +1 -1
- package/dist/dict/JPVariantsRev.js +1 -1
- package/dist/dict/JPVariantsRev.js.map +1 -1
- package/dist/dict/STCharacters.d.ts +1 -1
- package/dist/dict/STCharacters.d.ts.map +1 -1
- package/dist/dict/STCharacters.js +1 -1
- package/dist/dict/STCharacters.js.map +1 -1
- package/dist/dict/STPhrases.d.ts +1 -1
- package/dist/dict/STPhrases.d.ts.map +1 -1
- package/dist/dict/STPhrases.js +1 -1
- package/dist/dict/STPhrases.js.map +1 -1
- package/dist/dict/TSCharacters.d.ts +1 -1
- package/dist/dict/TSCharacters.d.ts.map +1 -1
- package/dist/dict/TSCharacters.js +1 -1
- package/dist/dict/TSCharacters.js.map +1 -1
- package/dist/dict/TSPhrases.d.ts +1 -1
- package/dist/dict/TSPhrases.d.ts.map +1 -1
- package/dist/dict/TSPhrases.js +1 -1
- package/dist/dict/TSPhrases.js.map +1 -1
- package/dist/dict/TWPhrases.d.ts +3 -0
- package/dist/dict/TWPhrases.d.ts.map +1 -0
- package/dist/dict/TWPhrases.js +2 -0
- package/dist/dict/TWPhrases.js.map +1 -0
- package/dist/dict/TWPhrasesRev.d.ts +1 -1
- package/dist/dict/TWPhrasesRev.d.ts.map +1 -1
- package/dist/dict/TWPhrasesRev.js +1 -1
- package/dist/dict/TWPhrasesRev.js.map +1 -1
- package/dist/dict/TWVariants.d.ts +1 -1
- package/dist/dict/TWVariants.d.ts.map +1 -1
- package/dist/dict/TWVariants.js +1 -1
- package/dist/dict/TWVariants.js.map +1 -1
- package/dist/dict/TWVariantsRev.d.ts +1 -1
- package/dist/dict/TWVariantsRev.d.ts.map +1 -1
- package/dist/dict/TWVariantsRev.js +1 -1
- package/dist/dict/TWVariantsRev.js.map +1 -1
- package/dist/dict/TWVariantsRevPhrases.d.ts +1 -1
- package/dist/dict/TWVariantsRevPhrases.d.ts.map +1 -1
- package/dist/dict/TWVariantsRevPhrases.js +1 -1
- package/dist/dict/TWVariantsRevPhrases.js.map +1 -1
- package/dist/dict/index.d.ts +2 -5
- package/dist/dict/index.d.ts.map +1 -1
- package/dist/dict/index.js +2 -5
- package/dist/dict/index.js.map +1 -1
- package/dist/html-converter.d.ts.map +1 -1
- package/dist/html-converter.js +35 -15
- package/dist/html-converter.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/presets.js +1 -1
- package/dist/presets.js.map +1 -1
- package/dist/umd/cn2t.js +269 -33
- package/dist/umd/cn2t.js.map +1 -1
- package/dist/umd/cn2t.min.js +1 -1
- package/dist/umd/cn2t.min.js.map +1 -1
- package/dist/umd/full.js +286 -45
- package/dist/umd/full.js.map +1 -1
- package/dist/umd/full.min.js +1 -1
- package/dist/umd/full.min.js.map +1 -1
- package/dist/umd/t2cn.js +266 -28
- package/dist/umd/t2cn.js.map +1 -1
- package/dist/umd/t2cn.min.js +1 -1
- package/dist/umd/t2cn.min.js.map +1 -1
- package/package.json +26 -11
- package/data/custom/CharFixes.txt +0 -33
- package/data/official/TWPhrasesIT.txt +0 -389
- package/data/official/TWPhrasesName.txt +0 -84
- package/data/official/TWPhrasesOther.txt +0 -39
- package/dist/dict/CharFixes.d.ts +0 -3
- package/dist/dict/CharFixes.d.ts.map +0 -1
- package/dist/dict/CharFixes.js +0 -2
- package/dist/dict/CharFixes.js.map +0 -1
- package/dist/dict/TWPhrasesIT.d.ts +0 -3
- package/dist/dict/TWPhrasesIT.d.ts.map +0 -1
- package/dist/dict/TWPhrasesIT.js +0 -2
- package/dist/dict/TWPhrasesIT.js.map +0 -1
- package/dist/dict/TWPhrasesName.d.ts +0 -3
- package/dist/dict/TWPhrasesName.d.ts.map +0 -1
- package/dist/dict/TWPhrasesName.js +0 -2
- package/dist/dict/TWPhrasesName.js.map +0 -1
- package/dist/dict/TWPhrasesOther.d.ts +0 -3
- package/dist/dict/TWPhrasesOther.d.ts.map +0 -1
- package/dist/dict/TWPhrasesOther.js +0 -2
- package/dist/dict/TWPhrasesOther.js.map +0 -1
package/dist/bundles/cn2t.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* cn2t bundle - Simplified Chinese to Traditional Chinese only
|
|
3
3
|
* Smaller bundle size for one-way conversion
|
|
4
4
|
*/
|
|
5
|
-
import { Trie, ConverterFactory, CustomConverter, DictLike } from "../core.js";
|
|
5
|
+
import { Trie, ConverterFactory, CustomConverter, ProtectedConverter, parseOpenCCDict, DictLike } from "../core.js";
|
|
6
6
|
import { HTMLConverter, HTMLConverterOptions } from "../html-converter.js";
|
|
7
7
|
type DictGroup = DictLike[];
|
|
8
8
|
type TargetLocale = "t" | "tw" | "twp" | "hk" | "jp";
|
|
@@ -11,9 +11,18 @@ interface ConverterOptions {
|
|
|
11
11
|
to: TargetLocale;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Create a converter from Simplified Chinese to Traditional variants
|
|
14
|
+
* Create a converter from Simplified Chinese to Traditional variants.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Conversion options (locale)
|
|
17
|
+
* @param protectedDict - Optional hard-override dictionary. Matches are masked
|
|
18
|
+
* with PUA placeholders before built-in conversion, then restored after —
|
|
19
|
+
* OpenCC dictionaries never see or modify them. Highest priority.
|
|
20
|
+
*
|
|
21
|
+
* UMD bundles do NOT auto-load `data/custom/ProtectedDict.txt` (no fs
|
|
22
|
+
* access in browsers). Pass the dict explicitly. To load from a remote URL,
|
|
23
|
+
* `fetch` the text and use `parseOpenCCDict()`.
|
|
15
24
|
*/
|
|
16
|
-
declare function Converter(options: ConverterOptions): (input: string) => string;
|
|
17
|
-
export { Converter, CustomConverter, ConverterFactory, HTMLConverter, Trie };
|
|
25
|
+
declare function Converter(options: ConverterOptions, protectedDict?: DictLike): (input: string) => string;
|
|
26
|
+
export { Converter, CustomConverter, ConverterFactory, ProtectedConverter, parseOpenCCDict, HTMLConverter, Trie };
|
|
18
27
|
export type { ConverterOptions, HTMLConverterOptions, DictLike, DictGroup };
|
|
19
28
|
//# sourceMappingURL=cn2t.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn2t.d.ts","sourceRoot":"","sources":["../../src/bundles/cn2t.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"cn2t.d.ts","sourceRoot":"","sources":["../../src/bundles/cn2t.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACpH,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAW3E,KAAK,SAAS,GAAG,QAAQ,EAAE,CAAC;AAG5B,KAAK,YAAY,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;AAErD,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,EAAE,YAAY,CAAC;CAClB;AAWD;;;;;;;;;;;GAWG;AACH,iBAAS,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,CAAC,EAAE,QAAQ,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAoBjG;AAED,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AAElH,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/bundles/cn2t.js
CHANGED
|
@@ -2,32 +2,37 @@
|
|
|
2
2
|
* cn2t bundle - Simplified Chinese to Traditional Chinese only
|
|
3
3
|
* Smaller bundle size for one-way conversion
|
|
4
4
|
*/
|
|
5
|
-
import { Trie, ConverterFactory, CustomConverter } from "../core.js";
|
|
5
|
+
import { Trie, ConverterFactory, CustomConverter, ProtectedConverter, parseOpenCCDict } from "../core.js";
|
|
6
6
|
import { HTMLConverter } from "../html-converter.js";
|
|
7
7
|
import { standard2variants } from "../presets.js";
|
|
8
8
|
// Import only the dictionaries needed for cn -> t/tw/twp/hk
|
|
9
9
|
import STCharacters from "../dict/STCharacters.js";
|
|
10
10
|
import STPhrases from "../dict/STPhrases.js";
|
|
11
11
|
import TWVariants from "../dict/TWVariants.js";
|
|
12
|
-
import
|
|
13
|
-
import TWPhrasesName from "../dict/TWPhrasesName.js";
|
|
14
|
-
import TWPhrasesOther from "../dict/TWPhrasesOther.js";
|
|
12
|
+
import TWPhrases from "../dict/TWPhrases.js";
|
|
15
13
|
import HKVariants from "../dict/HKVariants.js";
|
|
16
14
|
import JPVariants from "../dict/JPVariants.js";
|
|
17
15
|
const dictMap = {
|
|
18
16
|
STCharacters,
|
|
19
17
|
STPhrases,
|
|
20
18
|
TWVariants,
|
|
21
|
-
|
|
22
|
-
TWPhrasesName,
|
|
23
|
-
TWPhrasesOther,
|
|
19
|
+
TWPhrases,
|
|
24
20
|
HKVariants,
|
|
25
21
|
JPVariants,
|
|
26
22
|
};
|
|
27
23
|
/**
|
|
28
|
-
* Create a converter from Simplified Chinese to Traditional variants
|
|
24
|
+
* Create a converter from Simplified Chinese to Traditional variants.
|
|
25
|
+
*
|
|
26
|
+
* @param options - Conversion options (locale)
|
|
27
|
+
* @param protectedDict - Optional hard-override dictionary. Matches are masked
|
|
28
|
+
* with PUA placeholders before built-in conversion, then restored after —
|
|
29
|
+
* OpenCC dictionaries never see or modify them. Highest priority.
|
|
30
|
+
*
|
|
31
|
+
* UMD bundles do NOT auto-load `data/custom/ProtectedDict.txt` (no fs
|
|
32
|
+
* access in browsers). Pass the dict explicitly. To load from a remote URL,
|
|
33
|
+
* `fetch` the text and use `parseOpenCCDict()`.
|
|
29
34
|
*/
|
|
30
|
-
function Converter(options) {
|
|
35
|
+
function Converter(options, protectedDict) {
|
|
31
36
|
const dictGroups = [];
|
|
32
37
|
// From cn to standard (always needed)
|
|
33
38
|
dictGroups.push([STCharacters, STPhrases]);
|
|
@@ -39,7 +44,11 @@ function Converter(options) {
|
|
|
39
44
|
dictGroups.push(dicts);
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
|
-
|
|
47
|
+
let convert = ConverterFactory(...dictGroups);
|
|
48
|
+
if (protectedDict) {
|
|
49
|
+
convert = ProtectedConverter(protectedDict, convert);
|
|
50
|
+
}
|
|
51
|
+
return convert;
|
|
43
52
|
}
|
|
44
|
-
export { Converter, CustomConverter, ConverterFactory, HTMLConverter, Trie };
|
|
53
|
+
export { Converter, CustomConverter, ConverterFactory, ProtectedConverter, parseOpenCCDict, HTMLConverter, Trie };
|
|
45
54
|
//# sourceMappingURL=cn2t.js.map
|
package/dist/bundles/cn2t.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn2t.js","sourceRoot":"","sources":["../../src/bundles/cn2t.ts"],"names":[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AAC,CAAC;QACrE,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,GAAG,gBAAgB,CAAC,GAAG,UAAU,CAAC,CAAC;IAC9C,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,GAAG,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/bundles/full.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Full bundle - includes all locales and converters
|
|
3
3
|
*/
|
|
4
|
-
import { Trie, ConverterFactory, CustomConverter, DictLike } from "../core.js";
|
|
4
|
+
import { Trie, ConverterFactory, CustomConverter, ProtectedConverter, parseOpenCCDict, DictLike } from "../core.js";
|
|
5
5
|
import { HTMLConverter, HTMLConverterOptions } from "../html-converter.js";
|
|
6
6
|
import { LocaleCode } from "../presets.js";
|
|
7
7
|
type DictGroup = DictLike[];
|
|
@@ -10,9 +10,18 @@ interface ConverterOptions {
|
|
|
10
10
|
to: LocaleCode;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Create a converter with the specified locales
|
|
13
|
+
* Create a converter with the specified locales.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Conversion options (from/to locale)
|
|
16
|
+
* @param protectedDict - Optional hard-override dictionary. Matches are masked
|
|
17
|
+
* with PUA placeholders before built-in conversion, then restored — OpenCC
|
|
18
|
+
* dictionaries never see or modify them. Highest priority.
|
|
19
|
+
*
|
|
20
|
+
* UMD bundles do NOT auto-load `data/custom/ProtectedDict.txt` (no fs in
|
|
21
|
+
* browsers). Pass the dict explicitly; use `parseOpenCCDict` to parse
|
|
22
|
+
* OpenCC-format text fetched at runtime.
|
|
14
23
|
*/
|
|
15
|
-
declare function Converter(options: ConverterOptions): (input: string) => string;
|
|
24
|
+
declare function Converter(options: ConverterOptions, protectedDict?: DictLike): (input: string) => string;
|
|
16
25
|
declare const Locale: {
|
|
17
26
|
from: {
|
|
18
27
|
[k: string]: string[];
|
|
@@ -21,6 +30,6 @@ declare const Locale: {
|
|
|
21
30
|
[k: string]: string[];
|
|
22
31
|
};
|
|
23
32
|
};
|
|
24
|
-
export { Converter, CustomConverter, ConverterFactory, HTMLConverter, Locale, Trie };
|
|
33
|
+
export { Converter, CustomConverter, ConverterFactory, ProtectedConverter, parseOpenCCDict, HTMLConverter, Locale, Trie };
|
|
25
34
|
export type { ConverterOptions, HTMLConverterOptions, LocaleCode, DictLike, DictGroup };
|
|
26
35
|
//# sourceMappingURL=full.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full.d.ts","sourceRoot":"","sources":["../../src/bundles/full.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"full.d.ts","sourceRoot":"","sources":["../../src/bundles/full.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACpH,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAwC,UAAU,EAAE,MAAM,eAAe,CAAC;AAKjF,KAAK,SAAS,GAAG,QAAQ,EAAE,CAAC;AAE5B,UAAU,gBAAgB;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,UAAU,CAAC;CAChB;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,CAAC,EAAE,QAAQ,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAmCjG;AAGD,QAAA,MAAM,MAAM;;;;;;;CAGX,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAE1H,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/bundles/full.js
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Full bundle - includes all locales and converters
|
|
3
3
|
*/
|
|
4
|
-
import { Trie, ConverterFactory, CustomConverter } from "../core.js";
|
|
4
|
+
import { Trie, ConverterFactory, CustomConverter, ProtectedConverter, parseOpenCCDict } from "../core.js";
|
|
5
5
|
import { HTMLConverter } from "../html-converter.js";
|
|
6
6
|
import { variants2standard, standard2variants } from "../presets.js";
|
|
7
7
|
// Import all dictionaries
|
|
8
8
|
import * as dict from "../dict/index.js";
|
|
9
9
|
/**
|
|
10
|
-
* Create a converter with the specified locales
|
|
10
|
+
* Create a converter with the specified locales.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Conversion options (from/to locale)
|
|
13
|
+
* @param protectedDict - Optional hard-override dictionary. Matches are masked
|
|
14
|
+
* with PUA placeholders before built-in conversion, then restored — OpenCC
|
|
15
|
+
* dictionaries never see or modify them. Highest priority.
|
|
16
|
+
*
|
|
17
|
+
* UMD bundles do NOT auto-load `data/custom/ProtectedDict.txt` (no fs in
|
|
18
|
+
* browsers). Pass the dict explicitly; use `parseOpenCCDict` to parse
|
|
19
|
+
* OpenCC-format text fetched at runtime.
|
|
11
20
|
*/
|
|
12
|
-
function Converter(options) {
|
|
21
|
+
function Converter(options, protectedDict) {
|
|
22
|
+
// Reject unknown locales loudly rather than silently skipping a step and
|
|
23
|
+
// returning partially-converted text (JS callers bypass the TS type check).
|
|
24
|
+
if (options.from !== "t" && !variants2standard[options.from]) {
|
|
25
|
+
throw new Error(`Unknown 'from' locale: ${options.from}`);
|
|
26
|
+
}
|
|
27
|
+
if (options.to !== "t" && !standard2variants[options.to]) {
|
|
28
|
+
throw new Error(`Unknown 'to' locale: ${options.to}`);
|
|
29
|
+
}
|
|
13
30
|
const dictGroups = [];
|
|
14
31
|
// From variant to standard
|
|
15
32
|
if (options.from !== "t") {
|
|
@@ -27,12 +44,16 @@ function Converter(options) {
|
|
|
27
44
|
dictGroups.push(dicts);
|
|
28
45
|
}
|
|
29
46
|
}
|
|
30
|
-
|
|
47
|
+
let convert = ConverterFactory(...dictGroups);
|
|
48
|
+
if (protectedDict) {
|
|
49
|
+
convert = ProtectedConverter(protectedDict, convert);
|
|
50
|
+
}
|
|
51
|
+
return convert;
|
|
31
52
|
}
|
|
32
53
|
// Locale data for ConverterBuilder compatibility
|
|
33
54
|
const Locale = {
|
|
34
55
|
from: Object.fromEntries(Object.entries(variants2standard).map(([locale, files]) => [locale, files.map((name) => dict[name]).filter(Boolean)])),
|
|
35
56
|
to: Object.fromEntries(Object.entries(standard2variants).map(([locale, files]) => [locale, files.map((name) => dict[name]).filter(Boolean)])),
|
|
36
57
|
};
|
|
37
|
-
export { Converter, CustomConverter, ConverterFactory, HTMLConverter, Locale, Trie };
|
|
58
|
+
export { Converter, CustomConverter, ConverterFactory, ProtectedConverter, parseOpenCCDict, HTMLConverter, Locale, Trie };
|
|
38
59
|
//# sourceMappingURL=full.js.map
|
package/dist/bundles/full.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full.js","sourceRoot":"","sources":["../../src/bundles/full.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAY,MAAM,YAAY,CAAC;
|
|
1
|
+
{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A+B,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAC1K,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/bundles/t2cn.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* t2cn bundle - Traditional Chinese to Simplified Chinese only
|
|
3
3
|
* Smaller bundle size for one-way conversion
|
|
4
4
|
*/
|
|
5
|
-
import { Trie, ConverterFactory, CustomConverter, DictLike } from "../core.js";
|
|
5
|
+
import { Trie, ConverterFactory, CustomConverter, ProtectedConverter, parseOpenCCDict, DictLike } from "../core.js";
|
|
6
6
|
import { HTMLConverter, HTMLConverterOptions } from "../html-converter.js";
|
|
7
7
|
type DictGroup = DictLike[];
|
|
8
8
|
type SourceLocale = "t" | "tw" | "twp" | "hk" | "jp";
|
|
@@ -11,9 +11,14 @@ interface ConverterOptions {
|
|
|
11
11
|
to?: "cn";
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Create a converter from Traditional variants to Simplified Chinese
|
|
14
|
+
* Create a converter from Traditional variants to Simplified Chinese.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Conversion options (locale)
|
|
17
|
+
* @param protectedDict - Optional hard-override dictionary. See cn2t bundle
|
|
18
|
+
* docs for semantics. UMD bundles do not auto-load ProtectedDict.txt;
|
|
19
|
+
* pass the dict explicitly (use `parseOpenCCDict` for OpenCC-format text).
|
|
15
20
|
*/
|
|
16
|
-
declare function Converter(options: ConverterOptions): (input: string) => string;
|
|
17
|
-
export { Converter, CustomConverter, ConverterFactory, HTMLConverter, Trie };
|
|
21
|
+
declare function Converter(options: ConverterOptions, protectedDict?: DictLike): (input: string) => string;
|
|
22
|
+
export { Converter, CustomConverter, ConverterFactory, ProtectedConverter, parseOpenCCDict, HTMLConverter, Trie };
|
|
18
23
|
export type { ConverterOptions, HTMLConverterOptions, DictLike, DictGroup };
|
|
19
24
|
//# sourceMappingURL=t2cn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"t2cn.d.ts","sourceRoot":"","sources":["../../src/bundles/t2cn.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"t2cn.d.ts","sourceRoot":"","sources":["../../src/bundles/t2cn.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACpH,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAe3E,KAAK,SAAS,GAAG,QAAQ,EAAE,CAAC;AAG5B,KAAK,YAAY,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;AAErD,UAAU,gBAAgB;IACxB,IAAI,EAAE,YAAY,CAAC;IACnB,EAAE,CAAC,EAAE,IAAI,CAAC;CACX;AAeD;;;;;;;GAOG;AACH,iBAAS,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,CAAC,EAAE,QAAQ,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAoBjG;AAED,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AAElH,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/bundles/t2cn.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* t2cn bundle - Traditional Chinese to Simplified Chinese only
|
|
3
3
|
* Smaller bundle size for one-way conversion
|
|
4
4
|
*/
|
|
5
|
-
import { Trie, ConverterFactory, CustomConverter } from "../core.js";
|
|
5
|
+
import { Trie, ConverterFactory, CustomConverter, ProtectedConverter, parseOpenCCDict } from "../core.js";
|
|
6
6
|
import { HTMLConverter } from "../html-converter.js";
|
|
7
7
|
import { variants2standard } from "../presets.js";
|
|
8
8
|
// Import only the dictionaries needed for t/tw/twp/hk -> cn
|
|
@@ -29,9 +29,14 @@ const dictMap = {
|
|
|
29
29
|
JPShinjitaiPhrases,
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
|
-
* Create a converter from Traditional variants to Simplified Chinese
|
|
32
|
+
* Create a converter from Traditional variants to Simplified Chinese.
|
|
33
|
+
*
|
|
34
|
+
* @param options - Conversion options (locale)
|
|
35
|
+
* @param protectedDict - Optional hard-override dictionary. See cn2t bundle
|
|
36
|
+
* docs for semantics. UMD bundles do not auto-load ProtectedDict.txt;
|
|
37
|
+
* pass the dict explicitly (use `parseOpenCCDict` for OpenCC-format text).
|
|
33
38
|
*/
|
|
34
|
-
function Converter(options) {
|
|
39
|
+
function Converter(options, protectedDict) {
|
|
35
40
|
const dictGroups = [];
|
|
36
41
|
// From source variant to standard
|
|
37
42
|
if (options.from !== "t") {
|
|
@@ -43,7 +48,11 @@ function Converter(options) {
|
|
|
43
48
|
}
|
|
44
49
|
// From standard to cn (always needed)
|
|
45
50
|
dictGroups.push([TSCharacters, TSPhrases]);
|
|
46
|
-
|
|
51
|
+
let convert = ConverterFactory(...dictGroups);
|
|
52
|
+
if (protectedDict) {
|
|
53
|
+
convert = ProtectedConverter(protectedDict, convert);
|
|
54
|
+
}
|
|
55
|
+
return convert;
|
|
47
56
|
}
|
|
48
|
-
export { Converter, CustomConverter, ConverterFactory, HTMLConverter, Trie };
|
|
57
|
+
export { Converter, CustomConverter, ConverterFactory, ProtectedConverter, parseOpenCCDict, HTMLConverter, Trie };
|
|
49
58
|
//# sourceMappingURL=t2cn.js.map
|
package/dist/bundles/t2cn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"t2cn.js","sourceRoot":"","sources":["../../src/bundles/t2cn.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAY,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"t2cn.js","sourceRoot":"","sources":["../../src/bundles/t2cn.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAY,MAAM,YAAY,CAAC;AACpH,OAAO,EAAE,aAAa,EAAwB,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,4DAA4D;AAC5D,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,aAAa,MAAM,0BAA0B,CAAC;AACrD,OAAO,oBAAoB,MAAM,iCAAiC,CAAC;AACnE,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,aAAa,MAAM,0BAA0B,CAAC;AACrD,OAAO,oBAAoB,MAAM,iCAAiC,CAAC;AACnE,OAAO,aAAa,MAAM,0BAA0B,CAAC;AACrD,OAAO,qBAAqB,MAAM,kCAAkC,CAAC;AACrE,OAAO,kBAAkB,MAAM,+BAA+B,CAAC;AAY/D,MAAM,OAAO,GAA2B;IACtC,YAAY;IACZ,SAAS;IACT,aAAa;IACb,oBAAoB;IACpB,YAAY;IACZ,aAAa;IACb,oBAAoB;IACpB,aAAa;IACb,qBAAqB;IACrB,kBAAkB;CACnB,CAAC;AAEF;;;;;;;GAOG;AACH,SAAS,SAAS,CAAC,OAAyB,EAAE,aAAwB;IACpE,MAAM,UAAU,GAAgB,EAAE,CAAC;IAEnC,kCAAkC;IAClC,IAAI,OAAO,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACxD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACrE,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,sCAAsC;IACtC,UAAU,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;IAE3C,IAAI,OAAO,GAAG,gBAAgB,CAAC,GAAG,UAAU,CAAC,CAAC;IAC9C,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,GAAG,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/converter.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ export interface ConverterOptions {
|
|
|
14
14
|
to: LocaleCode;
|
|
15
15
|
/** Whether to load custom phrase dictionary (default: true for twp) */
|
|
16
16
|
loadCustomPhrases?: boolean;
|
|
17
|
-
/** Whether to apply character fixes (default: true) */
|
|
18
|
-
applyCharFixes?: boolean;
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
19
|
* Locale preset data containing dictionary groups
|
|
@@ -31,17 +29,43 @@ export interface LocalePreset {
|
|
|
31
29
|
*/
|
|
32
30
|
export declare function ConverterBuilder(localePreset: LocalePreset): (options: ConverterOptions) => (input: string) => string;
|
|
33
31
|
/**
|
|
34
|
-
*
|
|
32
|
+
* Dictionary files for a conversion, GROUPED BY CONVERSION STEP.
|
|
33
|
+
*
|
|
34
|
+
* Returns `string[][]`: each inner array is one conversion step
|
|
35
|
+
* (variant→standard, then standard→variant). Each step MUST be loaded into a
|
|
36
|
+
* SINGLE merged trie so the trie's longest-match lets phrase dictionaries
|
|
37
|
+
* (STPhrases, *RevPhrases) win over single-character dictionaries.
|
|
38
|
+
*
|
|
39
|
+
* Correct usage:
|
|
40
|
+
* ConverterFactory(...getDictFiles(from, to).map(group => buildTrieFromGroup(group)))
|
|
41
|
+
*
|
|
42
|
+
* Do NOT flatten the groups and run each file as its own group — that converts
|
|
43
|
+
* characters first, so the phrase dict's source keys no longer exist and every
|
|
44
|
+
* phrase dictionary becomes dead code (头发→頭發 instead of 頭髮). That flat-list
|
|
45
|
+
* mental model is exactly what this grouped return type exists to prevent. If you
|
|
46
|
+
* only need the flat file list (e.g. to know which dict files to bundle), call
|
|
47
|
+
* `getDictFiles(from, to).flat()`.
|
|
48
|
+
*
|
|
49
|
+
* @throws {Error} if `from` or `to` is an unknown locale (i.e. not `'t'` and not
|
|
50
|
+
* a key of `variants2standard` / `standard2variants`).
|
|
35
51
|
*/
|
|
36
|
-
export declare function getDictFiles(from: LocaleCode, to: LocaleCode): string[];
|
|
52
|
+
export declare function getDictFiles(from: LocaleCode, to: LocaleCode): string[][];
|
|
37
53
|
/**
|
|
38
|
-
* Load dictionaries and create a converter
|
|
39
|
-
*
|
|
54
|
+
* Load dictionaries and create a converter.
|
|
55
|
+
*
|
|
56
|
+
* @param options - Converter options (locale, optional flags)
|
|
57
|
+
* @param protectedDict - Hard-override dictionary. Matches are masked with PUA
|
|
58
|
+
* placeholders before built-in conversion runs, then restored after — OpenCC
|
|
59
|
+
* built-in dictionaries never see or modify them. Highest priority.
|
|
60
|
+
*
|
|
61
|
+
* If omitted, `createConverter` auto-loads the bundled `data/custom/ProtectedDict.txt`
|
|
62
|
+
* (Node-only convenience). Pass an explicit value (including `[]`) to bypass.
|
|
40
63
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
64
|
+
* **Breaking change in v1.3.1:** Replaces v1.0.x's `customDict` (soft
|
|
65
|
+
* override). If you depended on chained A→B (custom) → B→C (standard),
|
|
66
|
+
* rewrite as A→C directly.
|
|
43
67
|
*/
|
|
44
|
-
export declare function createConverter(options: ConverterOptions,
|
|
68
|
+
export declare function createConverter(options: ConverterOptions, protectedDict?: DictLike): Promise<(input: string) => string>;
|
|
45
69
|
export type { LocaleCode } from "./presets.js";
|
|
46
70
|
export type { DictLike, DictGroup } from "./core.js";
|
|
47
71
|
//# sourceMappingURL=converter.d.ts.map
|
package/dist/converter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAwC,SAAS,EAAE,QAAQ,EAAmB,MAAM,WAAW,CAAC;AACvG,OAAO,EAAwC,UAAU,EAAE,MAAM,cAAc,CAAC;AAKhF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yBAAyB;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,yBAAyB;IACzB,EAAE,EAAE,UAAU,CAAC;IACf,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAChC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,YAAY,IAC/B,SAAS,gBAAgB,KAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAehF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,MAAM,EAAE,EAAE,CAkBzE;AAsBD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,gBAAgB,EACzB,aAAa,CAAC,EAAE,QAAQ,GACvB,OAAO,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAwEpC;AAGD,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/converter.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* High-level API for creating converters
|
|
4
4
|
*/
|
|
5
5
|
// Imports removed
|
|
6
|
-
import { ConverterFactory } from "./core.js";
|
|
6
|
+
import { ConverterFactory, ProtectedConverter, parseOpenCCDict } from "./core.js";
|
|
7
7
|
import { variants2standard, standard2variants } from "./presets.js";
|
|
8
8
|
/**
|
|
9
9
|
* Create a Converter factory with locale preset
|
|
@@ -25,31 +25,94 @@ export function ConverterBuilder(localePreset) {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Dictionary files for a conversion, GROUPED BY CONVERSION STEP.
|
|
29
|
+
*
|
|
30
|
+
* Returns `string[][]`: each inner array is one conversion step
|
|
31
|
+
* (variant→standard, then standard→variant). Each step MUST be loaded into a
|
|
32
|
+
* SINGLE merged trie so the trie's longest-match lets phrase dictionaries
|
|
33
|
+
* (STPhrases, *RevPhrases) win over single-character dictionaries.
|
|
34
|
+
*
|
|
35
|
+
* Correct usage:
|
|
36
|
+
* ConverterFactory(...getDictFiles(from, to).map(group => buildTrieFromGroup(group)))
|
|
37
|
+
*
|
|
38
|
+
* Do NOT flatten the groups and run each file as its own group — that converts
|
|
39
|
+
* characters first, so the phrase dict's source keys no longer exist and every
|
|
40
|
+
* phrase dictionary becomes dead code (头发→頭發 instead of 頭髮). That flat-list
|
|
41
|
+
* mental model is exactly what this grouped return type exists to prevent. If you
|
|
42
|
+
* only need the flat file list (e.g. to know which dict files to bundle), call
|
|
43
|
+
* `getDictFiles(from, to).flat()`.
|
|
44
|
+
*
|
|
45
|
+
* @throws {Error} if `from` or `to` is an unknown locale (i.e. not `'t'` and not
|
|
46
|
+
* a key of `variants2standard` / `standard2variants`).
|
|
29
47
|
*/
|
|
30
48
|
export function getDictFiles(from, to) {
|
|
31
|
-
const
|
|
49
|
+
const groups = [];
|
|
32
50
|
if (from !== "t") {
|
|
33
|
-
|
|
51
|
+
const fromFiles = variants2standard[from];
|
|
52
|
+
// Reject unknown locales loudly instead of silently producing a converter
|
|
53
|
+
// that skips the step (which would return partially/un-converted text).
|
|
54
|
+
if (!fromFiles)
|
|
55
|
+
throw new Error(`Unknown 'from' locale: ${from}`);
|
|
56
|
+
if (fromFiles.length)
|
|
57
|
+
groups.push(fromFiles);
|
|
34
58
|
}
|
|
35
59
|
if (to !== "t") {
|
|
36
|
-
|
|
60
|
+
const toFiles = standard2variants[to];
|
|
61
|
+
if (!toFiles)
|
|
62
|
+
throw new Error(`Unknown 'to' locale: ${to}`);
|
|
63
|
+
if (toFiles.length)
|
|
64
|
+
groups.push(toFiles);
|
|
65
|
+
}
|
|
66
|
+
return groups;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Try to auto-load the bundled `data/custom/ProtectedDict.txt`. Returns undefined in
|
|
70
|
+
* browsers/Deno, on any I/O error, or when the file parses to zero entries.
|
|
71
|
+
* Resolves via `import.meta.url` so it works in both source (tsx) and
|
|
72
|
+
* built (dist) environments.
|
|
73
|
+
*/
|
|
74
|
+
async function tryLoadPackageProtectedDict() {
|
|
75
|
+
try {
|
|
76
|
+
const fsMod = await import("node:fs/promises");
|
|
77
|
+
const urlMod = await import("node:url");
|
|
78
|
+
// converter.{ts,js} is one level deep under (src|dist); data/ is sibling.
|
|
79
|
+
const filePath = urlMod.fileURLToPath(new URL("../data/custom/ProtectedDict.txt", import.meta.url));
|
|
80
|
+
const text = await fsMod.readFile(filePath, "utf8");
|
|
81
|
+
const parsed = parseOpenCCDict(text);
|
|
82
|
+
return parsed.length > 0 ? parsed : undefined;
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return undefined;
|
|
37
86
|
}
|
|
38
|
-
return files;
|
|
39
87
|
}
|
|
40
88
|
/**
|
|
41
|
-
* Load dictionaries and create a converter
|
|
42
|
-
* This is the recommended way to create converters in Node.js
|
|
89
|
+
* Load dictionaries and create a converter.
|
|
43
90
|
*
|
|
44
|
-
* @param options - Converter options
|
|
45
|
-
* @param
|
|
91
|
+
* @param options - Converter options (locale, optional flags)
|
|
92
|
+
* @param protectedDict - Hard-override dictionary. Matches are masked with PUA
|
|
93
|
+
* placeholders before built-in conversion runs, then restored after — OpenCC
|
|
94
|
+
* built-in dictionaries never see or modify them. Highest priority.
|
|
95
|
+
*
|
|
96
|
+
* If omitted, `createConverter` auto-loads the bundled `data/custom/ProtectedDict.txt`
|
|
97
|
+
* (Node-only convenience). Pass an explicit value (including `[]`) to bypass.
|
|
98
|
+
*
|
|
99
|
+
* **Breaking change in v1.3.1:** Replaces v1.0.x's `customDict` (soft
|
|
100
|
+
* override). If you depended on chained A→B (custom) → B→C (standard),
|
|
101
|
+
* rewrite as A→C directly.
|
|
46
102
|
*/
|
|
47
|
-
export async function createConverter(options,
|
|
48
|
-
|
|
103
|
+
export async function createConverter(options, protectedDict) {
|
|
104
|
+
// Warn JS callers still passing the removed v1.0.x option. TypeScript catches
|
|
105
|
+
// this as an excess property, but JS users wouldn't see the breakage otherwise.
|
|
106
|
+
if (options && typeof options === "object" && "applyCharFixes" in options) {
|
|
107
|
+
console.warn("[js-opencc] The `applyCharFixes` option was removed in v1.3.x. " +
|
|
108
|
+
"CharFixes.txt is replaced by `protectedDict` (hard override) — see README migration section.");
|
|
109
|
+
}
|
|
110
|
+
// Auto-load bundled data/custom/ProtectedDict.txt if no explicit dict provided
|
|
111
|
+
if (!protectedDict) {
|
|
112
|
+
protectedDict = await tryLoadPackageProtectedDict();
|
|
113
|
+
}
|
|
49
114
|
const dictGroups = [];
|
|
50
|
-
// Import all dictionaries
|
|
51
115
|
const dictModules = await import("./dict/index.js");
|
|
52
|
-
// Helper to load dictionary from modules
|
|
53
116
|
const loadDictFromModule = (name) => {
|
|
54
117
|
const dictData = dictModules[name];
|
|
55
118
|
if (!dictData)
|
|
@@ -58,26 +121,36 @@ export async function createConverter(options, customDict) {
|
|
|
58
121
|
const parts = entry.split(" ");
|
|
59
122
|
const k = parts[0];
|
|
60
123
|
const v = parts.slice(1).join(" ");
|
|
61
|
-
return [k, v || k];
|
|
124
|
+
return [k, v || k];
|
|
62
125
|
});
|
|
63
126
|
};
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
127
|
+
// (a) Built-in dictionaries — loaded per conversion-step group from
|
|
128
|
+
// getDictFiles. Each step is ONE merged trie so the trie's longest-match lets
|
|
129
|
+
// phrase dictionaries win over single-char dictionaries; running each file as
|
|
130
|
+
// its own group converts chars first and leaves the phrase dict's simplified
|
|
131
|
+
// source keys gone (头发→頭發 instead of 頭髮). getDictFiles returns the groups
|
|
132
|
+
// already shaped correctly — this loop just turns file names into dicts.
|
|
133
|
+
const loadGroup = (files) => {
|
|
134
|
+
const group = [];
|
|
135
|
+
for (const name of files) {
|
|
136
|
+
const dict = loadDictFromModule(name);
|
|
137
|
+
if (dict)
|
|
138
|
+
group.push(dict);
|
|
139
|
+
else
|
|
140
|
+
console.warn(`Dictionary ${name} not found. Run 'npm run sync:opencc' first.`);
|
|
72
141
|
}
|
|
142
|
+
return group;
|
|
143
|
+
};
|
|
144
|
+
for (const fileGroup of getDictFiles(options.from, options.to)) {
|
|
145
|
+
const group = loadGroup(fileGroup);
|
|
146
|
+
if (group.length)
|
|
147
|
+
dictGroups.push(group);
|
|
73
148
|
}
|
|
74
|
-
//
|
|
149
|
+
// (b) CNTWPhrases (ordinary vocabulary dict, stays in main chain)
|
|
75
150
|
const loadPhrases = options.loadCustomPhrases ?? (options.to === "twp" || options.from === "twp");
|
|
76
151
|
if (loadPhrases) {
|
|
77
152
|
const phrases = loadDictFromModule("CNTWPhrases");
|
|
78
153
|
if (phrases) {
|
|
79
|
-
// For cn → twp: use as-is (大陸 → 台灣)
|
|
80
|
-
// For twp → cn: reverse the mapping (台灣 → 大陸)
|
|
81
154
|
if (options.from === "twp" && options.to === "cn") {
|
|
82
155
|
const reversed = phrases.map(([cn, tw]) => [tw, cn]);
|
|
83
156
|
dictGroups.unshift([reversed]);
|
|
@@ -87,18 +160,12 @@ export async function createConverter(options, customDict) {
|
|
|
87
160
|
}
|
|
88
161
|
}
|
|
89
162
|
}
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
dictGroups.unshift([fixes]);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
// Add user-provided custom dictionary
|
|
99
|
-
if (customDict) {
|
|
100
|
-
dictGroups.unshift([customDict]);
|
|
163
|
+
// (c) Build the inner converter chain
|
|
164
|
+
let convert = ConverterFactory(...dictGroups);
|
|
165
|
+
// (d) User protectedDict wraps as outermost PROTECTED layer (highest priority).
|
|
166
|
+
if (protectedDict) {
|
|
167
|
+
convert = ProtectedConverter(protectedDict, convert);
|
|
101
168
|
}
|
|
102
|
-
return
|
|
169
|
+
return convert;
|
|
103
170
|
}
|
|
104
171
|
//# sourceMappingURL=converter.js.map
|
package/dist/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,kBAAkB;AAElB,OAAO,EAAE,gBAAgB,EAAuB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