Code Monkey home page Code Monkey logo

unipinyin's Introduction

UniPinyin

Java 汉语拼音查询工具。支持CJK基本字符集及扩充区A的中文汉字,共26679个,其中多音字6769个。

警告!UniPinyin目前并不支持句中多音字判定。如:

Pinyin.getPinyinString("好读书不好读书,好读书不好读书。");
// 返回结果为 hǎo dú shū bù hǎo dú shū , hǎo dú shū bù hǎo dú shū 。

下载

#用法 ##1 下载 jar 包或添加gradle依赖:

compile 'com.nillith:unipinyin:1.0.0'

##2 使用

// 返回字符串
Pinyin.getPinyinString('你'); // nǐ 
Pinyin.getPinyinString("你好,世界!"); // nǐ hǎo , shì jiè !

// 返回Pinyin对象
Pinyin hao = Pinyin.getPinyin('好');
Pinyin[] hw = Pinyin.getPinyin("你好,世界!");

// Pinyin对象的使用
hao.getInitial(); // h 声母
hao.getFinal(); // ǎo 韵母 
hao.getFinalAscii(); // ao 韵母的ascii形式
hao.getTone(); // 3 声调
hao.toString(); // hǎo
hao.toStringAscii(); // hao3
hao.toStringAsciiNoTone(); // hao


// 其他字符串方法
Pinyin.getPinyinStringAscii("你好,世界!"); // ni3 hao3 , shi4 jie4 !
Pinyin.getPinyinStringAsciiNoTone("你好,世界!"); // ni hao , shi jie !
Pinyin.getPinyinString("你好,世界!", "-"/*自定义分隔符*/, true/*忽略无查询结果的字符*/); // nǐ-hǎo-shì-jiè


Pinyin.isHeteronym('好'); // true  判断是否是多音字
Pinyin[] all = Pinyin.getPinyinAll('好'); // 获取多音字所有的拼音对象

License

Nillith, 2016. Licensed under an Apache-2 license.

unipinyin's People

Contributors

nillith avatar

Watchers

James Cloos avatar angcyo avatar  avatar

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.