android-opencc基于OpenCC的源代码,通过Android NDK编译并使用JNI调用OpenCC的中文简繁转换。它拥有OpenCC的最新词库,并支持以下转换。
HK2S, Traditional Chinese (Hong Kong Standard) to Simplified Chinese 香港繁體(香港小學學習字詞表標準)到簡體
S2HK, Simplified Chinese to Traditional Chinese (Hong Kong Standard) 簡體到香港繁體(香港小學學習字詞表標準)
S2T, Simplified Chinese to Traditional Chinese 簡體到繁體
S2TW, Simplified Chinese to Traditional Chinese (Taiwan Standard) 簡體到臺灣正體
S2TWP, Simplified Chinese to Traditional Chinese (Taiwan Standard) with Taiwanese idiom 簡體到繁體(臺灣正體標準)並轉換爲臺灣常用詞彙
T2HK, Traditional Chinese to Traditional Chinese (Hong Kong Standard) 繁體到香港繁體(香港小學學習字詞表標準)
T2S, Traditional Chinese to Simplified Chinese 繁體到簡體
T2TW, Traditional Chinese to Traditional Chinese (Taiwan Standard) 繁體臺灣正體
TW2S, Traditional Chinese (Taiwan Standard) to Simplified Chinese 臺灣正體到簡體
TW2SP, Traditional Chinese (Taiwan Standard) to Simplified Chinese with Mainland Chinese idiom 繁體(臺灣正體標準)到簡體並轉換爲中國大陸常用詞彙
范例:
滑鼠裡面的矽二極體壞了,導致游標解析度降低。(臺灣常用詞彙)
可以转换成
鼠标里面的硅二极管坏了,导致光标分辨率降低。(大陆常用词汇)
使用方法:
//Add a custom repository
repositories {
...
maven {
url 'https://dl.bintray.com/qichuan/maven/'
}
}
// Add the dependency
dependencies {
...
compile 'com.zqc.opencc.android.lib:lib-opencc-android:0.8.0@aar'
}
文章转载自 开源中国社区[http://www.oschina.net]