# Rime schema
# encoding: utf-8

schema:
  schema_id: liujgoj
  name: 溜歌粵語拼音
  version: "2022.04.10"
  author:
    - sgalal <sgalal.me@outlook.com>
    - LeiMaau <leimaau@qq.com>
    - chaaklau <chaakming@gmail.com>
    - laubonghaudoi <laubonghaudoi@icloud.com>
    - tanxpyox <tanxpyox@gmail.com>
    - William915 <William915@gmail.com>
    - szc126 (@szc126)
    - Bing Jeung <bing@ososo.io>
    - Ayaka Mikazuki <ayaka@mail.shn.hk>
    - graphemecluster <graphemecluster@gmail.com>
    - Liujgoj Cantonese <liujgoj@gmail.com>


  description: |-
    採用溜歌粵語拼音方案
    https://www.liujgoj.com
    支援聲調顯示同輸入
  

  dependencies:
    - luna_pinyin
    - loengfan
    - stroke
    - cangjie5

switches:
  - name: ascii_mode
    reset: 0
    states: [ 中文, 西文 ]
  - name: full_shape
    states: [ 半角, 全角 ]
  - options: [ noop, variants_hk, trad_tw, simplification ]
    states: [ 傳統漢字, 香港傳統漢字, 臺灣傳統漢字, 大陆简化汉字 ]
    # 修改下行，改變預設用字 [0, 1, 2, 3 --> 對應上表]
    reset: 0
  - name: ascii_punct
    states: [ 。，, ．， ]
  - name: emoji_suggestion
    # 取消下行註釋，預設啓動 emoji
    #reset: 1
    states: [ 冇 Emoji, 有 Emoji ]

engine:
  processors:
    - ascii_composer
    - recognizer
    - key_binder
    - speller
    - punctuator
    - selector
    - navigator
    - express_editor
  segmentors:
    - ascii_segmentor
    - matcher
    - affix_segmentor@luna_pinyin
    - affix_segmentor@loengfan
    - affix_segmentor@stroke
    - affix_segmentor@cangjie5
    - abc_segmentor
    - punct_segmentor
    - fallback_segmentor
  translators:
    - punct_translator
    - script_translator
    - script_translator@luna_pinyin
    - script_translator@loengfan
    - table_translator@stroke
    - table_translator@cangjie5
  filters:
    - simplifier@variants_hk
    - simplifier@trad_tw
    - simplifier
    - simplifier@emoji_suggestion
    - uniquifier
    - reverse_lookup_filter@liujgoj_reverse_lookup

speller:
  alphabet: zyxwvutsrqponmlkjihgfedcba
  delimiter: " '"
  algebra:
    # 取消下兩行註釋，支援疑影交替： ng- 通 Ø-，Ø- 通 ng-
    #- derive/^ng([aeiou])/$1/
    #- derive/^([aeiou])/ng$1/

    # 取消下行註釋，支援泥來合流： n- 併入 l- ，如「你」讀若「理」
    #- derive/^n(?!g)/l/

    # 取消下行註釋，支援圓唇輔音合口韻缺位： gw-, kw- 併入 g-, k- ，如「國」讀若「各」、「廓」讀若「確」
    #- derive/^(g|k)w/$1/

    # 取消下行註釋，支援獨立鼻音韻 ng 併入 m，如「吳」讀若「唔」
    #- derive/^ng([123456])$/m$1/

    
    - abbrev/^([a-z]).+$/$1/      # 首字母簡拼
    #- abbrev/^([gk]w|ng).+$/$1/   # 首2字母簡拼

translator:
  dictionary: liujgoj
  spelling_hints: 5  # 將呢度改作 0，可以去除候選字後邊嘅粵拼提示
  preedit_format:


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

loengfan:
  tag: loengfan
  dictionary: loengfan
  prefix: "r"
  suffix: ";"
  tips: 〔粵語兩分〕

stroke:
  tag: stroke
  dictionary: stroke
  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.*$"


liujgoj_reverse_lookup:
  tags: [ luna_pinyin, loengfan, stroke, cangjie5 ]
  overwrite_comment: false
  dictionary: liujgoj

variants_hk:
  option_name: variants_hk
  opencc_config: t2hkf.json

trad_tw:
  option_name: trad_tw
  opencc_config: t2tw.json

emoji_suggestion:
  opencc_config: emoji.json
  option_name: emoji_suggestion
  tips: all

punctuator:
  import_preset: symbols_cantonese

key_binder:
  import_preset: default

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