当前位置:网站首页>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);
}
边栏推荐
- LeetCode——Add Binary
- 同事悄悄告诉我,飞书通知还能这样玩
- 4点告诉你实时聊天与聊天机器人组合的优势
- 11gR2 Database Services for &quot;Policy&quot; and &quot;Administrator&quot; Managed Databases (文件 I
- 帶外和帶內的區別
- (4)UART应用设计及仿真验证2 —— TX模块设计(无状态机)
- Rasa 3.x 学习系列-Rasa X 社区版(免费版) 更改
- Bao Yan notes II software engineering and calculation volume II (Chapter 13-16)
- VS2010 writes DLL and unit test of dynamic link library, and transfers the correctness of DLL test
- Golang code checking tool
猜你喜欢
无刷驱动设计——浅谈MOS驱动电路
进击的技术er——自动化
3: Chapter 1: understanding JVM specification 2: JVM specification, introduction;
GFS分布式文件系統
成为程序员的你,后悔了吗?
698. 划分为k个相等的子集 ●●
开关电源Buck电路CCM及DCM工作模式
98. 验证二叉搜索树 ●●
orgchart. JS organization chart, presenting structural data in an elegant way
Live tiktok shop 2022 latest gameplay card slot overseas live e-commerce new traffic
随机推荐
Fiddler Everywhere 3.2.1 Crack
Introduction to JVM
Pyqt control part (I)
MySQL replace primary key delete primary key add primary key
Go language implementation principle -- lock implementation principle
Neural structured learning - Part 2: training with natural graphs
(4) UART application design and simulation verification 2 - RX module design (stateless machine)
asp. Net pop-up layer instance
Object detection based on impulse neural network
Hcip course notes-16 VLAN, three-tier architecture, MPLS virtual private line configuration
(4)UART应用设计及仿真验证2 —— TX模块设计(无状态机)
poj 2762 Going from u to v or from v to u? (infer whether it is a weak link diagram)
TS type declaration
Comparison of parameters between TVs tube and zener diode
俄外交部:日韩参加北约峰会影响亚洲安全稳定
[Yu Yue education] NC machining technology reference materials of Shaanxi University of science and technology
How to insert data into MySQL database- How can I insert data into a MySQL database?
GFS Distributed File System
【原创】程序员团队管理的核心是什么?
哪些偏门项目可以做到?自媒体做到月赚一万以上很难吗?