# Rime schema
# encoding: utf-8

schema:
  schema_id: luna_pinyin
  name: 朙月拼音
  version: "0.14.test"
  author:
    - 佛振 <chen.sst@gmail.com>
  description: |
    Rime 預設的拼音輸入方案。
    參考以下作品而創作：
      * CC-CEDICT
      * Android open source project
      * Chewing - 新酷音
      * opencc - 開放中文轉換

switches:
  - name: ascii_mode
    reset: 0
    states: [ 中文, 西文 ]
  - name: full_shape
    states: [ 半角, 全角 ]
  - name: ascii_punct
    states: [ 句讀, 符號 ]
#  - name: simplification
#    states: [ 漢字, 汉字 ]
  - options: [ zh_trad, zh_tw, zh_simp ]
    states:
      - 傳統漢字
      - 臺灣正體
      - 簡化字
    reset: 0

engine:
  processors:
    - ascii_composer
    - recognizer
    - key_binder
    - speller
    - punctuator
    - selector
    - navigator
    - express_editor
  segmentors:
    - ascii_segmentor
    - matcher
    - abc_segmentor
    - affix_segmentor@alphabet
    - affix_segmentor@cangjie
    - affix_segmentor@pinyin
    - punct_segmentor
    - fallback_segmentor
  translators:
    - punct_translator
    - reverse_lookup_translator
    - script_translator
    - table_translator@cangjie
    - script_translator@pinyin
  filters:
    - reverse_lookup_filter@cangjie_lookup
    - simplifier@zh_simp
    - simplifier@zh_tw
    - uniquifier

speller:
  alphabet: zyxwvutsrqponmlkjihgfedcba
  delimiter: " '"
  algebra:
    - erase/^xx$/
    - abbrev/^([a-z]).+$/$1/
    - abbrev/^([zcs]h).+$/$1/
    - derive/^([nl])ve$/$1ue/
    - derive/^([jqxy])u/$1v/
    - derive/un$/uen/
    - derive/ui$/uei/
    - derive/iu$/iou/
    - derive/([aeiou])ng$/$1gn/
    - derive/([dtngkhrzcs])o(u|ng)$/$1o/
    - derive/ong$/on/
    - derive/ao$/oa/
    - derive/([iu])a(o|ng?)$/a$1$2/

translator:
  dictionary: luna_pinyin
  preedit_format:
    - xform/([nljqxy])v/$1ü/

alphabet:
  tag: alphabet
  prefix: ':'
  suffix: ';'
  tips: 〔西文〕
  closing_tips: 〔中文〕

cangjie:
  tag: cangjie
  dictionary: cangjie5
  prefix: 'C:'
  suffix: ';'
  tips: 〔倉頡〕
  closing_tips: 〔拼音〕
  preedit_format:
    - "xlit|abcdefghijklmnopqrstuvwxyz|日月金木水火土竹戈十大中一弓人心手口尸廿山女田難卜符|"
  comment_format:
    - "xlit|abcdefghijklmnopqrstuvwxyz~|日月金木水火土竹戈十大中一弓人心手口尸廿山女田難卜符～|"

pinyin:
  tag: pinyin
  dictionary: luna_pinyin
  enable_user_dict: false
  prefix: 'P:'
  suffix: ';'
  tips: 〔拼音〕
  preedit_format:
    - xform/([nl])v/$1ü/

cangjie_lookup:
  tags: [ pinyin ]
  dictionary: cangjie5
  comment_format:
    - "xlit|abcdefghijklmnopqrstuvwxyz ~|日月金木水火土竹戈十大中一弓人心手口尸廿山女田難卜符、～|"

reverse_lookup:
  dictionary: cangjie5
  enable_completion: true
  prefix: '`'
  suffix: "'"
  tips: 〔倉頡〕
  preedit_format:
    - "xlit|abcdefghijklmnopqrstuvwxyz|日月金木水火土竹戈十大中一弓人心手口尸廿山女田難卜符|"
  comment_format:
    - xform/([nl])v/$1ü/

zh_simp:
  option_name: zh_simp
  tips: all

zh_tw:
  option_name: zh_tw
  opencc_config: zht2zhtw_v.ini

punctuator:
  import_preset: default

key_binder:
  import_preset: default

recognizer:
  import_preset: default
  patterns:
    alphabet: '(?<![A-Z]):[^;]*;?$'
    cangjie: "C:[a-z']*;?$"
    pinyin: "P:[a-z']*;?$"
    reverse_lookup: "`[a-z]*'?$"
