1. OpenCC简介
OpenCC是繁简互换工具,项目详细介绍可以参考:
2. Mac OS系统下OpenCC的安装
2.1 安装
通过Homebrew可以快速安装OpenCC,执行以下命令:
$ brew install OpenCC
2.2 验证
执行以下命令:
$ OpenCC -h
如果看到以下帮助信息,则说明OpenCC安装成功:
Open Chinese Convert (OpenCC) Command Line Tool
Author: Carbo Kuo <byvoid@byvoid.com>
Bug Report: http://github.com/BYVoid/OpenCC/issues
Usage:
OpenCC [--noflush <bool>] [-i <file>] [-o <file>] [-c <file>] [--]
[--version] [-h]
Options:
--noflush <bool>
Disable flush for every line
-i <file>, --input <file>
Read original text from <file>.
-o <file>, --output <file>
Write converted text to <file>.
-c <file>, --config <file>
Configuration file
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
--version
Displays version information and exits.
-h, --help
Displays usage information and exits.
Open Chinese Convert (OpenCC) Command Line Tool
3. OpenCC的使用
3.1 命令行使用
$ echo '我买了3个鼠标,坏了两个。' | opencc -c s2t