# Rime schema
# encoding: utf-8

schema:
  schema_id: jyutping
  name: 粵語拼音（無聲調）
  version: "0.15"
  author:
    - 佛振 <chen.sst@gmail.com>
    - LeiMaau <leimaau@qq.com>
    - 劉邦後代 <laubonghaudoi@icloud.com>
  description: |
    採用香港語言學會粵語拼音方案
    https://www.lshk.org/jyutping
    兼容教育學院拼音方案
    碼表源自 scim-table-zh
  dependencies:
    - luna_pinyin
    - stroke
    - cangjie5

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
    - affix_segmentor@luna_pinyin
    - affix_segmentor@stroke
    - affix_segmentor@cangjie5
    - abc_segmentor
    - punct_segmentor
    - fallback_segmentor
  translators:
    - punct_translator
    - script_translator
    - script_translator@luna_pinyin
    - table_translator@stroke
    - table_translator@cangjie5
  filters:
    - simplifier
    - uniquifier
    - reverse_lookup_filter@reverse_lookup

speller:
  alphabet: zyxwvutsrqponmlkjihgfedcba
  delimiter: " '"
  algebra:
    - derive/^jy?([aeiou])/y$1/  # 容錯 je -> ye, jyu -> yu
    - derive/^jyu/ju/            # 容錯 jyu -> ju
    - derive/yu/y/               # 教院式 jyu -> jy
    - derive/eoi$/oey/           # 教院式
    - derive/eoi$/eoy/           # 容錯
    - derive/eo/oe/              # 教院式
    - derive/oe(ng|k)$/eo$1/     # 容錯
    - derive/aa$/a/              # 容錯
    - abbrev/^([a-z]).+$/$1/     # 首字母簡拼
    - derive/^z/dz/              # 教院式
    - derive/^c/ts/              # 教院式
    - abbrev/^(dz).+$/$1/        # 聲母簡拼
    - abbrev/^(ts).+$/$1/        # 聲母簡拼

    # 取消下兩行註釋，支持疑影不分
    #- derive/^ng([aeiou])/$1/
    #- derive/^([aeiou])/ng$1/

    # 取消下行註釋，支持 n- 併入 l- ，如「你」讀若「理」
    #- derive/^n/l/

    # 取消下行註釋，支持 gw-、kw- 併入 g-、k- ，如「國」讀若「各」、「廓」讀若「確」
    #- derive/^(g|k)w/$1/

    # 取消下行註釋，支持獨立鼻音韻 ng 併入 m，如「吳」讀若「唔」
    #- derive/^ng$/m/

translator:
  dictionary: jyutping
  spelling_hints: 5

luna_pinyin:
  tag: luna_pinyin
  dictionary: luna_pinyin
  enable_user_dict: false
  prefix: "`"
  suffix: ";"
  tips: 〔拼音〕
  preedit_format:
    - xform/([nl])v/$1ü/
    - xform/([nl])ue/$1üe/
    - xform/([jqxy])v/$1u/

stroke:
  tag: stroke
  dictionary: stroke
  enable_user_dict: false
  prefix: "x"
  suffix: ";"
  tips: 〔筆畫〕
  preedit_format:
    - xlit/hspnz/一丨丿丶乙/
    
cangjie5:
  tag: cangjie5
  dictionary: cangjie5
  enable_user_dict: false
  prefix: "v"
  suffix: ";"
  tips: 〔倉頡五代〕
  preedit_format:
    - 'xform/^([a-z]*)$/$1\t（\U$1\E）/'
    - "xlit|ABCDEFGHIJKLMNOPQRSTUVWXYZ|日月金木水火土竹戈十大中一弓人心手口尸廿山女田難卜符|"
  comment_format:
    - "xlit|abcdefghijklmnopqrstuvwxyz~|日月金木水火土竹戈十大中一弓人心手口尸廿山女田難卜符～|"
  disable_user_dict_for_patterns:
    - "^z.*$"
    - "^yyy.*$"

reverse_lookup:
  tags:  [luna_pinyin, stroke, cangjie5]
  overwrite_comment: false
  dictionary: jyutping

punctuator:
  import_preset: default

key_binder:
  import_preset: default

recognizer:
  import_preset: default
  patterns:
    punct: "^/([0-9]0?|[a-z]+)$"
    luna_pinyin: "`[a-z]*'?$"
    stroke: "x[hspnz]*'?$"
    cangjie5: "v[a-z]*'?$"
