# Rime schema
# encoding: utf-8

# 适配了仓输入法 [Hamster](https://github.com/imfuxiao/Hamster/) 九宫格布局。
#
# 可选，支持英文：
# 1. 解开 `engine/translators` 下的注释
# 2. 将 `others/Hamster/melt_eng.custom.yaml` 里的文件拷贝至配置目录，该补丁转写了英文的拼写规则到九宫格；

__include: rime_ice.schema.yaml:/

schema:
  schema_id: t9
  name: 仓·九宫格
  version: "2.0.0"
  author:
    - Dvel
    - "[morse.hsiao](https://github.com/imfuxiao)"
  description: |
    九宫格 for 仓输入法
  dependencies:
    - melt_eng # 英文输入，作为次翻译器挂载到拼音方案

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
    - lua_translator@*date_translator # 时间、日期、星期
    - table_translator@custom_phrase # 自定义短语 custom_phrase_t9.txt
    # - table_translator@melt_eng     # 英文输入
  filters:
    - simplifier@emoji # Emoji
    - simplifier@traditionalize # 简繁切换
    - uniquifier # 去重

translator:
  prism: t9
  spelling_hints: 100
  comment_format: []

# 自定义短语：custom_phrase_t9.txt
# ⚠️ 编码要用数字
custom_phrase:
  dictionary: ""
  user_dict: custom_phrase_t9
  db_class: stabledb
  enable_completion: false
  enable_sentence: false
  initial_quality: 99

# 九宫格 1 键上的符号序列
punctuator:
  half_shape:
    "1": [1, "@", ".", "/", ":", "_", "-", "#"]
    "@": [1, "@", ！, ：, 、, ……, ～]
    "#": [0, "#", "$", "%", "^", "&", "*", "(", ")"]

# 输入时按 1 可以分词
key_binder:
  bindings:
    - { when: has_menu, accept: 1, send: apostrophe }

speller:
  alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA987654321
  initials: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA987654321
  algebra:
    # ### 超级简拼
    - abbrev/^([a-z]).+$/$1/ # 超级简拼
    - abbrev/^([zcs]h).+$/$1/ # 超级简拼中，zh ch sh 视为整体（ch'sh → 城市），而不是像这样分开（c'h's'h → 吃好睡好）。
    - 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/
    # ### 九宫格数字映射
    - derive/[abc]/2/
    - derive/[def]/3/
    - derive/[hgi]/4/
    - derive/[jkl]/5/
    - derive/[omn]/6/
    - derive/[pqrs]/7/
    - derive/[tuv]/8/
    - derive/[wxyz]/9/
