# 添加了模糊音的自定义配置文件 rime_ice.custom.yaml
# https://github.com/Mark24Code/rime-auto-deploy/issues/1
patch:
  # 拼写设定
  speller:
    # 如果不想让什么标点直接上屏，可以加在 alphabet，或者编辑标点符号为两个及以上的映射
    alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
    delimiter: " '"  # 第一位<空格>是拼音之间的分隔符；第二位<'>表示可以手动输入单引号来分割拼音。
    algebra:
      ### 模糊音
      # 声母
      - derive/^([zcs])h/$1/          # z c s → zh ch sh
      - derive/^([zcs])([^h])/$1h$2/  # zh ch sh → z c s
      - derive/^l/n/  # n → l
      - derive/^n/l/  # l → n
      - derive/^f/h/  # …………
      - derive/^h/f/  # …………
      # - derive/^l/r/
      # - derive/^r/l/
      # - derive/^g/k/
      # - derive/^k/g/
      # 韵母
      # - derive/ang/an/
      # - derive/an/ang/
      # - derive/eng/en/
      # - derive/en/eng/
      # - derive/in/ing/
      # - derive/ing/in/
      # - derive/ian/iang/
      # - derive/iang/ian/
      # - derive/uan/uang/
      # - derive/uang/uan/
      # - derive/ai/an/
      # - derive/an/ai/
      # - derive/ong/un/
      # - derive/un/ong/
      # - derive/ong/on/
      # - derive/iong/un/
      # - derive/un/iong/
      # - derive/ong/eng/
      # - derive/eng/ong/
      # 拼音音节
      # - derive/^fei$/hui/
      # - derive/^hui$/fei/
      # - derive/^hu$/fu/
      # - derive/^fu$/hu/
      # - derive/^wang$/huang/
      # - derive/^huang$/wang/

      ### 旧时的拼写规则
      # - derive/un$/uen/
      # - derive/ui$/uei/
      # - derive/iu$/iou/

      ### 超级简拼
      - erase/^hm$/ # 响应超级简拼，取消「噷 hm」的独占
      - erase/^m$/  # 响应超级简拼，取消「呣 m」的独占
      - erase/^n$/  # 响应超级简拼，取消「嗯 n」的独占
      - erase/^ng$/ # 响应超级简拼，取消「嗯 ng」的独占
      - abbrev/^([a-z]).+$/$1/   # 超级简拼
      - abbrev/^([zcs]h).+$/$1/  # 超级简拼中，zh ch sh 视为整体（ch'sh → 城市），而不是像这样分开（c'h's'h → 吃好睡好）。

      ### v u 转换，增加对词库中「nue/nve」「qu/qv」等不同注音的支持
      - derive/^([nl])ue$/$1ve/
      - derive/^([nl])ve$/$1ue/
      - derive/^([jqxy])u/$1v/
      - derive/^([jqxy])v/$1u/

      ### 可输入大写字母，做了 xlit 转写是为了适配双拼
      - xlit/āḃçďēḟḡĥīĵḱĺḿńōṕɋŕśťūṽẃẋȳź/ABCDEFGHIJKLMNOPQRSTUVWXYZ/

      ### 自动纠错
      # 有些规则对全拼简拼混输有副作用：如「x'ai 喜爱」被纠错为「xia 下」
      # zh、ch、sh
      - derive/([zcs])h(a|e|i|u|ai|ei|an|en|ou|uo|ua|un|ui|uan|uai|uang|ang|eng|ong)$/h$1$2/  # hzi → zhi
      - derive/([zcs])h([aeiu])$/$1$2h/  # zih → zhi
      # ai
      - derive/^([wghk])ai$/$1ia/  # wia → wai
      # ia
      - derive/([qjx])ia$/$1ai/  # qai → qia
      # ei
      - derive/([wtfghkz])ei$/$1ie/
      # ie
      - derive/([jqx])ie$/$1ei/
      # ao
      - derive/([rtypsdghklzcbnm])ao$/$1oa/
      # ou
      - derive/([ypfm])ou$/$1uo/
      # uo（无）
      # an
      - derive/([wrtypsdfghklzcbnm])an$/$1na/
      # en
      - derive/([wrpsdfghklzcbnm])en$/$1ne/
      # ang
      - derive/([wrtypsdfghklzcbnm])ang$/$1nag/
      - derive/([wrtypsdfghklzcbnm])ang$/$1agn/
      # eng
      - derive/([wrtpsdfghklzcbnm])eng$/$1neg/
      - derive/([wrtpsdfghklzcbnm])eng$/$1egn/
      # ing
      - derive/([qtypdjlxbnm])ing$/$1nig/
      - derive/([qtypdjlxbnm])ing$/$1ign/
      # ong
      - derive/([rtysdghklzcn])ong$/$1nog/
      - derive/([rtysdghklzcn])ong$/$1ogn/
      # iao
      - derive/([qtpdjlxbnm])iao$/$1ioa/
      - derive/([qtpdjlxbnm])iao$/$1oia/
      # ui
      - derive/([rtsghkzc])ui$/$1iu/
      # iu
      - derive/([qjlxnm])iu$/$1ui/
      # ian
      - derive/([qtpdjlxbnm])ian$/$1ain/
      # - derive/([qtpdjlxbnm])ian$/$1ina/ # 和「李娜、蒂娜、缉拿」等常用词有冲突
      # in
      - derive/([qypjlxbnm])in$/$1ni/
      # iang
      - derive/([qjlxn])iang$/$1aing/
      - derive/([qjlxn])iang$/$1inag/
      # ua
      - derive/([g|k|h|zh|sh])ua$/$1au/
      # uai
      - derive/([g|h|k|zh|ch|sh])uai$/$1aui/
      - derive/([g|h|k|zh|ch|sh])uai$/$1uia/
      # uan
      - derive/([qrtysdghjklzxcn])uan$/$1aun/
      # - derive/([qrtysdghjklzxcn])uan$/$1una/ # 和「去哪、露娜」等常用词有冲突
      # un
      - derive/([qrtysdghjklzxc])un$/$1nu/
      # ue
      - derive/([nlyjqx])ue$/$1eu/
      # uang
      - derive/([g|h|k|zh|ch|sh])uang$/$1aung/
      - derive/([g|h|k|zh|ch|sh])uang$/$1uagn/
      - derive/([g|h|k|zh|ch|sh])uang$/$1unag/
      - derive/([g|h|k|zh|ch|sh])uang$/$1augn/
      # iong
      - derive/([jqx])iong$/$1inog/
      - derive/([jqx])iong$/$1oing/
      - derive/([jqx])iong$/$1iogn/
      - derive/([jqx])iong$/$1oign/
      # 其他
      - derive/([rtsdghkzc])o(u|ng)$/$1o/ # do → dou|dong
      - derive/ong$/on/ # lon → long
      - derive/([tl])eng$/$1en/ # ten → teng
      - derive/([qwrtypsdfghjklzxcbnm])([aeio])ng$/$1ng/ # lng → lang、leng、ling、long
