@zh-keyboard/pinyin 1.1.2 → 2.0.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/data/rime-api.js +1 -1
- package/data/rime-api.wasm +0 -0
- package/data/source/default.yaml +31 -0
- package/data/source/essay.txt +223396 -0
- package/data/source/luna_pinyin.dict.yaml +26203 -0
- package/data/source/luna_pinyin.schema.yaml +74 -0
- package/data/source/symbols.yaml +7 -0
- package/dist/index.d.mts +24 -27
- package/dist/index.d.ts +24 -27
- package/dist/index.js +167 -3324
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +167 -3324
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/data/default.yaml +0 -129
- package/data/luna_pinyin.prism.bin +0 -0
- package/data/luna_pinyin.reverse.bin +0 -0
- package/data/luna_pinyin.schema.yaml +0 -179
- package/data/luna_pinyin.table.bin +0 -0
- package/data/rime-api.data +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Rime schema
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
schema:
|
|
5
|
+
schema_id: luna_pinyin
|
|
6
|
+
name: 明月拼音
|
|
7
|
+
version: "0.15.wasm"
|
|
8
|
+
author:
|
|
9
|
+
- 佛振 <chen.sst@gmail.com>
|
|
10
|
+
description: |
|
|
11
|
+
基于 Rime 预设拼音输入方案的简化字版本。
|
|
12
|
+
|
|
13
|
+
switches:
|
|
14
|
+
- name: ascii_mode
|
|
15
|
+
reset: 0
|
|
16
|
+
states: [ 中文, ABC ]
|
|
17
|
+
- name: full_shape
|
|
18
|
+
states: [ 半寬文字, 全寬文字 ]
|
|
19
|
+
- name: ascii_punct
|
|
20
|
+
states: [ 中文標點, 西文標點 ]
|
|
21
|
+
|
|
22
|
+
engine:
|
|
23
|
+
processors:
|
|
24
|
+
- ascii_composer
|
|
25
|
+
- recognizer
|
|
26
|
+
- key_binder
|
|
27
|
+
- speller
|
|
28
|
+
- punctuator
|
|
29
|
+
- selector
|
|
30
|
+
- navigator
|
|
31
|
+
- express_editor
|
|
32
|
+
segmentors:
|
|
33
|
+
- ascii_segmentor
|
|
34
|
+
- matcher
|
|
35
|
+
- abc_segmentor
|
|
36
|
+
- punct_segmentor
|
|
37
|
+
- fallback_segmentor
|
|
38
|
+
translators:
|
|
39
|
+
- punct_translator
|
|
40
|
+
- script_translator
|
|
41
|
+
filters:
|
|
42
|
+
- uniquifier
|
|
43
|
+
|
|
44
|
+
speller:
|
|
45
|
+
alphabet: zyxwvutsrqponmlkjihgfedcba
|
|
46
|
+
delimiter: " '"
|
|
47
|
+
algebra:
|
|
48
|
+
- erase/^xx$/
|
|
49
|
+
- abbrev/^([a-z]).+$/$1/
|
|
50
|
+
- abbrev/^([zcs]h).+$/$1/
|
|
51
|
+
- derive/^([nl])ve$/$1ue/correction
|
|
52
|
+
- derive/^([jqxy])u/$1v/correction
|
|
53
|
+
- derive/un$/uen/correction
|
|
54
|
+
- derive/ui$/uei/correction
|
|
55
|
+
- derive/iu$/iou/correction
|
|
56
|
+
- derive/([aeiou])ng$/$1gn/correction
|
|
57
|
+
- derive/([dtngkhrzcs])o(u|ng)$/$1o/correction
|
|
58
|
+
- derive/ong$/on/correction
|
|
59
|
+
- derive/ao$/oa/correction
|
|
60
|
+
- derive/([iu])a(o|ng?)$/a$1$2/correction
|
|
61
|
+
|
|
62
|
+
translator:
|
|
63
|
+
dictionary: luna_pinyin
|
|
64
|
+
preedit_format:
|
|
65
|
+
- xform/([nljqxy])v/$1ü/
|
|
66
|
+
|
|
67
|
+
punctuator:
|
|
68
|
+
import_preset: default
|
|
69
|
+
|
|
70
|
+
key_binder:
|
|
71
|
+
import_preset: default
|
|
72
|
+
|
|
73
|
+
recognizer:
|
|
74
|
+
import_preset: default
|
package/dist/index.d.mts
CHANGED
|
@@ -6,53 +6,42 @@ interface RimeCandidate {
|
|
|
6
6
|
comment: string;
|
|
7
7
|
}
|
|
8
8
|
interface RimeState {
|
|
9
|
-
/**
|
|
9
|
+
/** 已提交(确认)的文本,若无提交则为 null。 */
|
|
10
10
|
committed: string | null;
|
|
11
|
-
/**
|
|
11
|
+
/** 预编辑文本中光标前的部分。 */
|
|
12
12
|
preeditHead: string;
|
|
13
|
-
/**
|
|
13
|
+
/** 预编辑文本中当前选中的部分。 */
|
|
14
14
|
preeditBody: string;
|
|
15
|
-
/**
|
|
15
|
+
/** 预编辑文本中光标后的部分。 */
|
|
16
16
|
preeditTail: string;
|
|
17
|
-
/**
|
|
17
|
+
/** 预编辑文本中的光标位置。 */
|
|
18
18
|
cursorPos: number;
|
|
19
|
-
/**
|
|
19
|
+
/** 当前页的候选词列表。 */
|
|
20
20
|
candidates: RimeCandidate[];
|
|
21
21
|
/** 当前页码(从 0 开始)。 */
|
|
22
22
|
pageNo: number;
|
|
23
|
-
/**
|
|
23
|
+
/** 是否为候选词的最后一页。 */
|
|
24
24
|
isLastPage: boolean;
|
|
25
|
-
/**
|
|
25
|
+
/** 高亮候选项的索引。 */
|
|
26
26
|
highlightedIndex: number;
|
|
27
|
-
/**
|
|
27
|
+
/** 候选词选择键的标签。 */
|
|
28
28
|
selectLabels: string[];
|
|
29
29
|
}
|
|
30
30
|
interface RimeWasmOptions {
|
|
31
|
-
/**
|
|
32
|
-
* rime-api.js、rime-api.wasm 以及所有数据文件(YAML 配置 + 二进制词典)的 URL 或路径前缀。
|
|
33
|
-
* 默认为当前目录。
|
|
34
|
-
*/
|
|
31
|
+
/** rime-api.js、rime-api.wasm 所在 URL 或路径前缀。默认为当前目录。 */
|
|
35
32
|
wasmDir?: string;
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
* 文件会从 `wasmDir` 获取并在引擎初始化前写入虚拟文件系统的 `/rime/build/`。
|
|
39
|
-
* 默认为 luna_pinyin 的 schema、词典文件以及配置 YAML。
|
|
40
|
-
*/
|
|
41
|
-
dataFiles?: string[];
|
|
33
|
+
/** 词库版本号。传入后自动比对 IndexedDB 缓存,版本一致则跳过下载直接加载缓存。 */
|
|
34
|
+
dictVersion?: string;
|
|
42
35
|
}
|
|
43
36
|
//#endregion
|
|
44
37
|
//#region src/index.d.ts
|
|
45
38
|
type PinyinState = RimeState;
|
|
46
|
-
interface RimePinyinEngineOptions extends RimeWasmOptions {
|
|
47
|
-
/**
|
|
48
|
-
* 是否默认使用简体中文
|
|
49
|
-
* @default true
|
|
50
|
-
*/
|
|
51
|
-
simplified?: boolean;
|
|
52
|
-
}
|
|
39
|
+
interface RimePinyinEngineOptions extends RimeWasmOptions {}
|
|
53
40
|
/**
|
|
54
41
|
* 创建基于 RIME WASM 的拼音引擎,实现 PinyinEngine 通用接口。
|
|
55
42
|
* 内部处理分页逻辑,processInput 返回所有页的候选词集合。
|
|
43
|
+
*
|
|
44
|
+
* 注意:词库已直接使用简体中文,不再依赖 OpenCC 繁简转换。
|
|
56
45
|
*/
|
|
57
46
|
declare class RimePinyinEngine implements PinyinEngine$1 {
|
|
58
47
|
private options;
|
|
@@ -62,10 +51,18 @@ declare class RimePinyinEngine implements PinyinEngine$1 {
|
|
|
62
51
|
constructor(options?: RimePinyinEngineOptions);
|
|
63
52
|
private getEngine;
|
|
64
53
|
initialize(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* 等待引擎初始化完成。
|
|
56
|
+
* UI 层可用此方法控制加载状态:先显示 loading,await 此方法后隐藏 loading。
|
|
57
|
+
*/
|
|
58
|
+
whenReady(): Promise<void>;
|
|
65
59
|
processInput(fullPinyin: string): Promise<RimeState | null>;
|
|
66
60
|
pickCandidate(index: number): Promise<RimeState>;
|
|
67
61
|
clearInput(): Promise<void>;
|
|
68
|
-
|
|
62
|
+
/**
|
|
63
|
+
* 将用户词典数据持久化到 IndexedDB。
|
|
64
|
+
*/
|
|
65
|
+
syncData(): Promise<void>;
|
|
69
66
|
destroy(): Promise<void>;
|
|
70
67
|
}
|
|
71
68
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -6,53 +6,42 @@ interface RimeCandidate {
|
|
|
6
6
|
comment: string;
|
|
7
7
|
}
|
|
8
8
|
interface RimeState {
|
|
9
|
-
/**
|
|
9
|
+
/** 已提交(确认)的文本,若无提交则为 null。 */
|
|
10
10
|
committed: string | null;
|
|
11
|
-
/**
|
|
11
|
+
/** 预编辑文本中光标前的部分。 */
|
|
12
12
|
preeditHead: string;
|
|
13
|
-
/**
|
|
13
|
+
/** 预编辑文本中当前选中的部分。 */
|
|
14
14
|
preeditBody: string;
|
|
15
|
-
/**
|
|
15
|
+
/** 预编辑文本中光标后的部分。 */
|
|
16
16
|
preeditTail: string;
|
|
17
|
-
/**
|
|
17
|
+
/** 预编辑文本中的光标位置。 */
|
|
18
18
|
cursorPos: number;
|
|
19
|
-
/**
|
|
19
|
+
/** 当前页的候选词列表。 */
|
|
20
20
|
candidates: RimeCandidate[];
|
|
21
21
|
/** 当前页码(从 0 开始)。 */
|
|
22
22
|
pageNo: number;
|
|
23
|
-
/**
|
|
23
|
+
/** 是否为候选词的最后一页。 */
|
|
24
24
|
isLastPage: boolean;
|
|
25
|
-
/**
|
|
25
|
+
/** 高亮候选项的索引。 */
|
|
26
26
|
highlightedIndex: number;
|
|
27
|
-
/**
|
|
27
|
+
/** 候选词选择键的标签。 */
|
|
28
28
|
selectLabels: string[];
|
|
29
29
|
}
|
|
30
30
|
interface RimeWasmOptions {
|
|
31
|
-
/**
|
|
32
|
-
* rime-api.js、rime-api.wasm 以及所有数据文件(YAML 配置 + 二进制词典)的 URL 或路径前缀。
|
|
33
|
-
* 默认为当前目录。
|
|
34
|
-
*/
|
|
31
|
+
/** rime-api.js、rime-api.wasm 所在 URL 或路径前缀。默认为当前目录。 */
|
|
35
32
|
wasmDir?: string;
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
* 文件会从 `wasmDir` 获取并在引擎初始化前写入虚拟文件系统的 `/rime/build/`。
|
|
39
|
-
* 默认为 luna_pinyin 的 schema、词典文件以及配置 YAML。
|
|
40
|
-
*/
|
|
41
|
-
dataFiles?: string[];
|
|
33
|
+
/** 词库版本号。传入后自动比对 IndexedDB 缓存,版本一致则跳过下载直接加载缓存。 */
|
|
34
|
+
dictVersion?: string;
|
|
42
35
|
}
|
|
43
36
|
//#endregion
|
|
44
37
|
//#region src/index.d.ts
|
|
45
38
|
type PinyinState = RimeState;
|
|
46
|
-
interface RimePinyinEngineOptions extends RimeWasmOptions {
|
|
47
|
-
/**
|
|
48
|
-
* 是否默认使用简体中文
|
|
49
|
-
* @default true
|
|
50
|
-
*/
|
|
51
|
-
simplified?: boolean;
|
|
52
|
-
}
|
|
39
|
+
interface RimePinyinEngineOptions extends RimeWasmOptions {}
|
|
53
40
|
/**
|
|
54
41
|
* 创建基于 RIME WASM 的拼音引擎,实现 PinyinEngine 通用接口。
|
|
55
42
|
* 内部处理分页逻辑,processInput 返回所有页的候选词集合。
|
|
43
|
+
*
|
|
44
|
+
* 注意:词库已直接使用简体中文,不再依赖 OpenCC 繁简转换。
|
|
56
45
|
*/
|
|
57
46
|
declare class RimePinyinEngine implements PinyinEngine$1 {
|
|
58
47
|
private options;
|
|
@@ -62,10 +51,18 @@ declare class RimePinyinEngine implements PinyinEngine$1 {
|
|
|
62
51
|
constructor(options?: RimePinyinEngineOptions);
|
|
63
52
|
private getEngine;
|
|
64
53
|
initialize(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* 等待引擎初始化完成。
|
|
56
|
+
* UI 层可用此方法控制加载状态:先显示 loading,await 此方法后隐藏 loading。
|
|
57
|
+
*/
|
|
58
|
+
whenReady(): Promise<void>;
|
|
65
59
|
processInput(fullPinyin: string): Promise<RimeState | null>;
|
|
66
60
|
pickCandidate(index: number): Promise<RimeState>;
|
|
67
61
|
clearInput(): Promise<void>;
|
|
68
|
-
|
|
62
|
+
/**
|
|
63
|
+
* 将用户词典数据持久化到 IndexedDB。
|
|
64
|
+
*/
|
|
65
|
+
syncData(): Promise<void>;
|
|
69
66
|
destroy(): Promise<void>;
|
|
70
67
|
}
|
|
71
68
|
//#endregion
|