Code Monkey home page Code Monkey logo

pinyin's Introduction

汉字转拼音

PHP版汉字拼音(字符串包含数字、拼音、多音字、首字母等)

简单转换

Pinyin_Pinyin::convertPinyin('UTF8-PHP版汉字转拼音');

UTF8-PHPbanhanzizhuanpinyin

简单转换,自定义连接符

Pinyin_Pinyin::convertPinyin('UTF8-PHP版汉字转拼音', '_');

U_T_F_8_-_P_H_P_ban_han_zi_zhuan_pin_yin

首字母转换

Pinyin_Pinyin::convertInitalPinyin('UTF8-PHP版汉字转拼音'); UTF8-PHPbhzzpy

多音字

Pinyin_Pinyin::convertPinyinList('UTF8-PHP版汉字转拼音多音字-圈');

array(
'UTF8-PHPbanhanzizhuanpinyinduoyinzi-quan',
'UTF8-PHPbanhanzizhuanpinyinduoyinzi-juan',
'UTF8-PHPbanhanzizhuanpinyinduoyinzi-juan',
);

多音字首字母

Pinyin_Pinyin::convertInitalPinyinList('UTF8-PHP版汉字转拼音多音字-圈');

array(
'UTF8-PHPbhzzpydyz-q',
'UTF8-PHPbhzzpydyz-j',
'UTF8-PHPbhzzpydyz-j',
);

所有转换结果

Pinyin_Pinyin::convertAllPinyinList('UTF8-PHP版汉字转拼音多音字-圈');

array (
'full' =>
array (
'UTF8-PHPbanhanzizhuanpinyinduoyinzi-quan',
'UTF8-PHPbanhanzizhuanpinyinduoyinzi-juan',
'UTF8-PHPbanhanzizhuanpinyinduoyinzi-juan',
), 'initial' =>
array (
'UTF8-PHPbhzzpydyz-q',
'UTF8-PHPbhzzpydyz-j',
'UTF8-PHPbhzzpydyz-j',
),

更新

  1. 拆解了复杂大方法为多个简单方法;
  2. 修复单个汉字或汉字开头转换异常;
  3. 去重结果中重复结果
  4. 清理冗余判断;
  5. 增加自定义分隔符;
  6. 增加 Demo 文件;

pinyin's People

Contributors

gitsher avatar

Watchers

 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.