wongdean / rime-settings

接近原生的鼠须管 Rime 配置
1.5k stars 156 forks source link

小鹤双拼如何使用模糊音呢? #73

Closed cjahv closed 10 months ago

cjahv commented 1 year ago

直接将luna_pinyin.custom.yaml的模糊音配置复制到double_pinyin_flypy.custom.yaml输入法就变成全拼了

修改后的double_pinyin_flypy.custom.yaml

patch:
  schema/name: 小鹤双拼
  switches:
    - name: ascii_mode
      reset: 0
      states: [ 中文, 西文 ]
    - name: emoji_suggestion
      reset: 1
      states: [ "No", "Yes" ]
    - name: full_shape
      states: [ 半角, 全角 ]
    - name: simplification
      reset: 1
      states: [ 漢字, 汉字 ]
    - name: ascii_punct
      states: [ 。,, ., ]
  engine/translators:
    # - lua_translator@date_translator
    # - lua_translator@week_translator
    - punct_translator
    - script_translator
    - table_translator@custom_phrase
  engine/filters:
    - simplifier@emoji_suggestion
    - simplifier
    - uniquifier
    #- charset_filter@gbk
    # - single_char_filter
  engine/processors:
    - ascii_composer
    - recognizer
    - key_binder
    - speller
    - punctuator
    - selector
    - navigator
    - express_editor
  emoji_suggestion:
    opencc_config: emoji.json
    option_name: emoji_suggestion
    # tips: all
  reverse_lookup: {}

  #載入朙月拼音擴充詞庫
  'translator/dictionary': luna_pinyin.extended
  'translator/preedit_format': {}

  # 自定义符号上屏
  punctuator:
    import_preset: symbols
    # 自定义快捷符号输入
    # symbols:
    #   "/fs": [½, ‰, ¼, ⅓, ⅔, ¾, ⅒ ]
    half_shape:
      "#": "#"
      "*": "*"
      "`": "`"
      "~": "~"
      "@": "@"
      "=": "="
      "/": ["/", "÷",]
      '\': "、"
      # "_" : "──"
      "'": {pair: ["「", "」"]}
      "[": ["【", "["]
      "]": ["】", "]"]
      "$": ["¥", "$", "€", "£", "¢", "¤"]
      "<": ["《", "〈", "«", "<"]
      ">": ["》", "〉", "»", ">"]

  recognizer/patterns/punct: "^/([0-9]0?|[A-Za-z]+)$"

  ### 双拼使用自定义词典 custom_phrase.txt
  custom_phrase:
    dictionary: ""
    user_dict: custom_phrase
    db_class: stabledb
    enable_completion: false
    enable_sentence: false
    initial_quality: 1
  "engine/translators/@5": table_translator@custom_phrase

# Rx: BlindingDark/rime-easy-en:customize:schema=double_pinyin_flypy
  # __include: easy_en:/patch
  # easy_en/enable_sentence: false
# Rx: lotem/rime-octagram-data:customize:schema=luna_pinyin,model=hans
  __include: grammar:/hant
# Rx: BlindingDark/rime-lua-select-character:customize:schema=luna_pinyin
  # __include: lua_select_character:/patch # 需要lua_selector打开本行注释

  "speller/algebra":
      - erase/^xx$/                      # 第一行保留
      # 模糊音定義
      # 需要哪組就刪去行首的 # 號,單雙向任選
      - derive/^([zcs])h/$1/             # zh, ch, sh => z, c, s
      - derive/^([zcs])([^h])/$1h$2/     # z, c, s => zh, ch, sh

      # - derive/^n/l/                     # n => l
      # - derive/^l/n/                     # l => n

实在是找不到双拼模糊音的办法了🙇🏻

cjahv commented 10 months ago

找到解决办法了,直接改double_pinyin_flypy.schema.yaml或者复制speller/algebra到double_pinyin_flypy.custom.yaml后,再改模糊音,完整的speller/algebra部分参考:

  "speller/algebra":
    - erase/^xx$/
    - derive/^([jqxy])u$/$1v/
    - derive/^([aoe])([ioun])$/$1$1$2/
    - derive/^([zcs])h/$1/             # zh, ch, sh => z, c, s
    - derive/^([zcs])([^h])/$1h$2/     # z, c, s => zh, ch, sh
    - derive/([ei])n$/$1ng/            # en => eng, in => ing
    - derive/([ei])ng$/$1n/            # eng => en, ing => in
    - xform/^([aoe])(ng)?$/$1$1$2/
    - xform/iu$/Q/
    - xform/(.)ei$/$1W/
    - xform/uan$/R/
    - xform/[uv]e$/T/
    - xform/un$/Y/
    - xform/^sh/U/
    - xform/^ch/I/
    - xform/^zh/V/
    - xform/uo$/O/
    - xform/ie$/P/
    - xform/i?ong$/S/
    - xform/ing$|uai$/K/
    - xform/(.)ai$/$1D/
    - xform/(.)en$/$1F/
    - xform/(.)eng$/$1G/
    - xform/[iu]ang$/L/
    - xform/(.)ang$/$1H/
    - xform/ian$/M/
    - xform/(.)an$/$1J/
    - xform/(.)ou$/$1Z/
    - xform/[iu]a$/X/
    - xform/iao$/N/
    - xform/(.)ao$/$1C/
    - xform/ui$/V/
    - xform/in$/B/
    - xlit/QWRTYUIOPSDFGHJKLZXCVBNM/qwrtyuiopsdfghjklzxcvbnm/