Java Chinese Simplified conversion tool opencc4j

Source: Internet
Author: User

Creation Reason

The simplified conversion of Chinese is a very common requirement.

But a lot of tool classes are simply mapping. (Use Map, collection, properties) and so on.

There is a serious problem: there may be a problem with the conversion of special phrases .

Opencc

OPENCC is a very good conversion tool. However, there are no direct Java-friendly jars available.

Opencc4j

OPENCC4J is the Java usage version provided on top of the tools above.

opencc4j How to use Maven to introduce
<dependency>    <groupId>com.github.houbb</groupId>    <artifactId>opencc4j</artifactId>    <version>1.0.2</version></dependency>
Convert to Simplified
String original = "生命不息,奮鬥不止";String result = ZhConverterUtil.convertToSimple(original);

Result is

生命不息,奋斗不止
Convert to Traditional
String original = "生命不息,奋斗不止";String result = ZhConverterUtil.convertToTraditional(original);

Result is

生命不息,奮鬥不止

Java Chinese Simplified conversion tool opencc4j

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.