# Rime schema
# encoding: utf-8

schema:
  schema_id: yale
  name: 耶魯粵語拼音
  version: "0.1"
  author:
    - 幸延 <a0726h77@gmail.com>
  description: |
    耶魯粵語拼音方案
    https://zh-yue.wikipedia.org/wiki/%E9%A6%99%E6%B8%AF%E8%AA%9E%E8%A8%80%E5%AD%B8%E5%AD%B8%E6%9C%83%E7%B2%B5%E8%AA%9E%E6%8B%BC%E9%9F%B3%E6%96%B9%E6%A1%88
  dependencies:
    - luna_pinyin

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
    - script_translator
    - reverse_lookup_translator
  filters:
    - simplifier
    - uniquifier

speller:
  alphabet: zyxwvutsrqponmlkjihgfedcba
  delimiter: " '"
  algebra:
    - xform/^jy/y/           # 粵 jyut -> yut
    - xform/^j/y/            # 用 jung -> yung
    - xform/^z/j/            # 抓 zaa -> ja
    - xform/^c/ch/           # 叉 caa -> cha
    - xform/aa$/a/           # 煆 haa -> ha
    - xform/eu/iu/           # 掉 deu -> diu
    - xform/eo/eu/           # 蹲 deon -> deun
    - xform/oe/eu/           # 剁 doek -> deuk
    - xform/em/im/           # 舐 lem -> lim
    - xform/ep/ip/           # 夾 gep -> gip
    - abbrev/^([a-z]).+$/$1/ # 首字母簡拼
    - abbrev/^(ng).+$/$1/    # 聲母簡拼
    - abbrev/^(ch).+$/$1/    # 聲母簡拼
    - abbrev/^([gk]w).+$/$1/ # 聲母簡拼

translator:
  dictionary: jyutping
  prism: yale
  spelling_hints: 5
  comment_format: &comment_rules
    - xform/jy/y/
    - xform/j/y/
    - xform/z/j/
    - xform/c/ch/
    - xform/aa(\>|$)/a/
    - xform/eu/iu/
    - xform/eo/eu/
    - xform/oe/eu/
    - xform/em/im/
    - xform/ep/ip/

reverse_lookup:
  dictionary: luna_pinyin
  prefix: "`"
  suffix: "'"
  tips: 〔拼音〕
  preedit_format:
    - xform/([nl])v/$1ü/
    - xform/([nl])ue/$1üe/
    - xform/([jqxy])v/$1u/
  comment_format: *comment_rules

punctuator:
  import_preset: default

key_binder:
  import_preset: default

recognizer:
  import_preset: default
  patterns:
    reverse_lookup: "`[a-z]*'?$"
