Page
Library
Module
Module type
Parameter
Class
Class type
Source
Opencc1_1SourceOCaml OpenCC, bindings for opencc (v1.1) - Open Chinese Convert
Open Chinese Convert (OpenCC, 開放中文轉換) is an opensource project for conversion between Traditional Chinese and Simplified Chinese, supporting character-level conversion, phrase-level conversion, variant conversion and regional idioms among Mainland China, Taiwan and Hong kong.
the type of opencc instances
Opencc1.create config creates a new opencc instance. config should be the path of the appropriate config file.
Opencc1.convert_utf8 opencc text returns the converted string. text is UTF-8 encoded input string.
Opencc1.error () returns the last error message.
On a debian jessie x86_64 system, the source code below:
let ()=
let opencc= Opencc1_1.create "/usr/share/opencc/s2t.json" in
print_endline (Opencc1_1.convert_utf8 opencc "汉字");;will print out 漢字