-
Notifications
You must be signed in to change notification settings - Fork 7
/
double_pinyin_abc.schema.yaml
143 lines (134 loc) · 4.98 KB
/
double_pinyin_abc.schema.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Rime schema
# encoding: utf-8
schema:
schema_id: double_pinyin_abc # 專有的方案標識
name: 智能ABC雙拼
version: "0.17"
author:
- 佛振 <chen.sst@gmail.com>
description: |
朙月拼音+智能ABC雙拼方案。
dependencies:
- stroke
switches:
- name: ascii_mode
reset: 0
states: [ 中文, 西文 ]
- name: full_shape
states: [ 半角, 全角 ]
- name: simplification
states: [ 漢字, 汉字 ]
- name: ascii_punct
states: [ 。,, ., ]
engine:
processors:
- ascii_composer
- recognizer
- key_binder
- speller
- punctuator
- selector
- navigator
- express_editor
segmentors:
- ascii_segmentor
- matcher
- abc_segmentor
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- reverse_lookup_translator
- script_translator
filters:
- simplifier
- uniquifier
speller:
alphabet: zyxwvutsrqponmlkjihgfedcba # 呃,倒背字母表完全是個人喜好
delimiter: " '" # 隔音符號用「'」;第一位的空白用來自動插入到音節邊界處
algebra: # 拼寫運算規則,這個纔是實現雙拼方案的重點。寫法有很多種,當然也可以把四百多個音節碼一條一條地列舉
- erase/^xx$/ # 碼表中有幾個拼音不明的字,編碼成xx了,消滅他
- derive/^([jqxy])u$/$1v/
- xform/^zh/A/ # 替換聲母鍵,用大寫以防與原有的字母混淆
- xform/^ch/E/
- xform/^sh/V/
- xform/^([aoe].*)$/O$1/ # 添上固定的零聲母o,先標記爲大寫O
- xform/ei$/Q/ # 替換韻母鍵
- xform/ian$/W/ # ※2
- xform/er$|iu$/R/ # 對應兩種韻母的;音節er現在變爲OR了
- xform/[iu]ang$/T/ # ※1
- xform/ing$/Y/
- xform/uo$/O/
- xform/uan$/P/ # ※3
- xform/i?ong$/S/
- xform/[iu]a$/D/
- xform/en$/F/
- xform/eng$/G/
- xform/ang$/H/ # 檢查一下在此之前是否已轉換過了帶界音的ang;好,※1處有了
- xform/an$/J/ # 如果※2、※3還無有出現在上文中,應該把他們提到本行之前
- xform/iao$/Z/ # 對——像這樣讓iao提前出場
- xform/ao$/K/
- xform/in$|uai$/C/ # 讓uai提前出場
- xform/ai$/L/
- xform/ie$/X/
- xform/ou$/B/
- xform/un$/N/
- xform/[uv]e$|ui$/M/
- xlit/QWERTYOPASDFGHJKLZXCVBNM/qwertyopasdfghjklzxcvbnm/ # 最後把雙拼碼全部變小寫
translator:
dictionary: luna_pinyin # 與【朙月拼音】共用詞典
prism: double_pinyin_abc # prism 要以本輸入方案的名稱來命名,以免把朙月拼音的拼寫映射表覆蓋掉
preedit_format: # 這段代碼用來將輸入的雙拼碼反轉爲全拼顯示;待見雙拼碼的可以把這段拿掉
- xform/o(\w)/0$1/ # 零聲母先改爲0,以方便後面的轉換
- xform/(\w)q/$1ei/ # 雙拼第二碼轉換爲韻母
- xform/(\w)n/$1un/ # 提前轉換雙拼碼 n 和 g,因爲轉換後的拼音裏就快要出現這兩個字母了,那時將難以分辨出雙拼碼
- xform/(\w)g/$1eng/ # 當然也可以採取事先將雙拼碼變爲大寫的辦法來與轉換過的拼音做區分,可誰讓我是高手呢
- xform/(\w)w/$1ian/
- xform/([dtnljqx])r/$1iu/ # 對應多種韻母的雙拼碼,按搭配的聲母做區分(最好別用排除式如 [^o]r 容易出狀況)
- xform/0r/0er/ # 另一種情況,注意先不消除0,以防後面把e當作聲母轉換爲ch
- xform/([nljqx])t/$1iang/
- xform/(\w)t/$1uang/ # 上一行已經把對應到 iang 的雙拼碼 t 消滅,於是這裏不用再列舉相配的聲母
- xform/(\w)y/$1ing/
- xform/([dtnlgkhaevrzcs])o/$1uo/
- xform/(\w)p/$1uan/
- xform/([jqx])s/$1iong/
- xform/(\w)s/$1ong/
- xform/([gkhaevrzcs])d/$1ua/
- xform/(\w)d/$1ia/
- xform/(\w)f/$1en/
- xform/(\w)h/$1ang/
- xform/(\w)j/$1an/
- xform/(\w)k/$1ao/ # 默默檢查:雙拼碼 o 已經轉換過了
- xform/(\w)l/$1ai/
- xform/(\w)z/$1iao/
- xform/(\w)x/$1ie/
- xform/([gkhaev])c/$1uai/
- xform/(\w)c/$1in/
- xform/(\w)b/$1ou/
- xform/([nl])m/$1ve/
- xform/([jqxy])m/$1ue/
- xform/(\w)m/$1ui/
- "xform/(^|[ '])a/$1zh/" # 復原聲母,音節開始處的雙拼字母a改寫爲zh;其他位置的才真正是a
- "xform/(^|[ '])e/$1ch/"
- "xform/(^|[ '])v/$1sh/"
- xform/0(\w)/$1/ # 好了,現在可以把零聲母拿掉啦
- xform/([nl])v/$1ü/ # 這樣纔是漢語拼音 :-)
- xform/([jqxy])v/$1u/
reverse_lookup:
dictionary: stroke
enable_completion: true
prefix: "`"
suffix: "'"
tips: 〔筆畫〕
preedit_format:
- xlit/hspnz/一丨丿丶乙/
comment_format:
- xform/([nl])v/$1ü/
punctuator:
import_preset: default
key_binder:
import_preset: default
recognizer:
import_preset: default
patterns:
reverse_lookup: "`[a-z]*'?$"