You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac OS Sequoia下OpenCC自定义配置报错:未知分词类型

解决OpenCC自定义配置报错"Unknown segmentation type: default"

问题原因

你使用的default并非OpenCC支持的合法分词类型,且尝试的simple、text、none也不符合当前版本OpenCC的配置规范,导致报错。

解决步骤

1. 使用内置分词配置(推荐)

直接复用OpenCC内置的中文分词配置,无需手动指定分词字典,配置修改如下:

{
  "name": "custom",
  "description": "Custom CN to TW glossary",
  "segmentation": {
    "type": "json",
    "file": "/opt/homebrew/share/opencc/segmentation/cn.json"
  },
  "conversion_chain": [
    {
      "dict": {
        "type": "ocd2",
        "file": "/Users/f/Downloads/zh-test/custom.ocd2"
      }
    }
  ]
}
  • 注意:如果是Intel芯片Mac,内置配置路径改为/usr/local/share/opencc/segmentation/cn.json。

2. 手动指定MMSEG分词(进阶)

若需要自定义分词字典,可使用mmseg类型并指定内置分词字典路径:

{
  "name": "custom",
  "description": "Custom CN to TW glossary",
  "segmentation": {
    "type": "mmseg",
    "dict": {
      "type": "ocd2",
      "file": "/opt/homebrew/share/opencc/dictionary/zhs-common.ocd2"
    }
  },
  "conversion_chain": [
    {
      "dict": {
        "type": "ocd2",
        "file": "/Users/f/Downloads/zh-test/custom.ocd2"
      }
    }
  ]
}
  • Intel芯片Mac的字典路径为/usr/local/share/opencc/dictionary/zhs-common.ocd2。

3. 验证配置合法性

执行以下命令检查配置文件是否正确:

opencc --check-config /Users/f/Downloads/zh-test/custom-config.json

如果无报错,再执行原转换命令即可正常运行。

内容的提问来源于stack exchange,提问作者Neeku

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 20:35:05