当前位置:网站首页>Convert Chinese into pinyin
Convert Chinese into pinyin
2022-07-05 23:39:00 【Chen Hu_ sixty-three】
Chinese to Pinyin without tone
Introduce dependencies :
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
</dependency>
Example :
public static void main(String[] args) throws Exception{
HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
// Pinyin lowercase
format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
// Without tone
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
/** * The first parameter : Chinese to convert * The second parameter : Converted format * The third parameter : Separator of converted Pinyin * Fourth parameter : If you encounter something that cannot be converted, do you want to keep it * After the transformation :hello,shi,jie */
System.out.println(PinyinHelper.toHanYuPinyinString("hello, The world ", format, ",", true));
}
Chinese to Pinyin with tone
Introduce dependencies :
<dependency>
<groupId>com.github.stuxuhai</groupId>
<artifactId>jpinyin</artifactId>
<version>1.1.8</version>
</dependency>
Example :
public static void main(String[] args) throws Exception {
/** * The first parameter : String to convert * The second parameter : Phonetic separator after conversion * The third parameter : Specify phonetic format with tone * Output results :hello,shìjiè */
String s = PinyinHelper.convertToPinyinString("hello, The world ", "", PinyinFormat.WITH_TONE_MARK);
System.out.println(s);
}
边栏推荐
- CIS benchmark tool Kube bench
- Go language implementation principle -- map implementation principle
- Xinyuan & Lichuang EDA training camp - brushless motor drive
- 2022.6.20-6.26 AI industry weekly (issue 103): new little life
- Neural structured learning 4 antagonistic learning for image classification
- Do you regret becoming a programmer?
- idea 连接mysql ,直接贴配置文件的url 比较方便
- Common static methods of math class
- 21.PWM应用编程
- 3D point cloud slam
猜你喜欢
Hcip course notes-16 VLAN, three-tier architecture, MPLS virtual private line configuration
保研笔记一 软件工程与计算卷二(1-7章)
Rsync remote synchronization
Go language implementation principle -- map implementation principle
MySQL delete uniqueness constraint unique
GFS distributed file system
Spreadjs 15.1 CN and spreadjs 15.1 en
TVS管和ESD管的技术指标和选型指南-嘉立创推荐
CIS benchmark tool Kube bench
Spire Office 7.5.4 for NET
随机推荐
idea 连接mysql ,直接贴配置文件的url 比较方便
Neural structured learning - Part 3: training with synthesized graphs
(4)UART应用设计及仿真验证2 —— TX模块设计(无状态机)
开关电源Buck电路CCM及DCM工作模式
GFS分布式文件系統
如何获取localStorage中存储的所有值
如何提升口才
(4)UART應用設計及仿真驗證2 —— TX模塊設計(無狀態機)
有什么不起眼却挣钱的副业?
The interface of grafana tool displays an error, incluxdb error
Rasa 3.x 学习系列-Rasa 3.2.1 新版本发布
Calculating the number of daffodils in C language
Multi camera stereo calibration
AsyncSocket长连接棒包装问题解决
2022.6.20-6.26 AI industry weekly (issue 103): new little life
[Yu Yue education] NC machining technology reference materials of Shaanxi University of science and technology
rsync远程同步
poj 2762 Going from u to v or from v to u? (推断它是否是一个薄弱环节图)
无刷驱动设计——浅谈MOS驱动电路
Redis高可用——主从复制、哨兵模式、集群