Giter Site home page Giter Site logo

lewisling / android-opencc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qichuan/android-opencc

0.0 2.0 0.0 2.14 MB

An Android library project for conversion between Traditional and Simplified Chinese

Java 5.72% Makefile 0.02% C++ 93.50% CMake 0.76%

android-opencc's Introduction

Introduction

An Android port to OPENCC, a library to convert Simplified Chinese to Traditional Chinese and vice versa. In additional, it also adopts the regional vocabulary and terminology interchangeably during conversion among Mainland China Simplified Chinese, Taiwan Traditional Chinese and Hong Kong Traditional Chinese.

Example

滑鼠裡面的矽二極體壞了,導致游標解析度降低。

in Traditional Taiwan Chinese will be converted to

鼠标里面的硅二极管坏了,导致光标分辨率降低。

in Simplified Chinese and using Mainland China terminology

Installation

//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.6.0@aar'
}

Usage

To use Chinese converter is easy, just call ChineseConverter.convert(originalText, conversionType, context));

Supported conversation types

  • 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 繁體(臺灣正體標準)到簡體並轉換爲中國大陸常用詞彙

Explanation

android-opencc leverages on the original OpenCC project and invoke the native code via JNI, the text phrase dictionary files are shipped in the assets folder. Android NDK does not provide means to create and read file streams from directly from assets folder, therefore the dictionary files are then copied to the application data folder in the first call of ChineseConverter.convert()

If you need to update the dictionary files in the assets folder, please remember to call ChineseConverter.clearDictDataFolder() once to clear the old dictionary files, so the new dictionary files will be effective in the next ChineseConverter.convert() call.

Compilation

You need the Android NDK for compilation, please download the NDK and configure the path to NDK in local.properties file.

Example apk

Download here

Feel free to feedback if there are any issues, and hope this library can be useful for you.

References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.