当前位置:网站首页>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);
}
边栏推荐
- AsyncSocket长连接棒包装问题解决
- 14 MySQL-视图
- 3: Chapter 1: understanding JVM specification 2: JVM specification, introduction;
- Huawei simulator ENSP - hcip - MPLS experiment
- 俄外交部:日韩参加北约峰会影响亚洲安全稳定
- TVS管 与 稳压二极管参数对比
- C# 文件与文件夹操作
- Qcombox (rewrite) + qcompleter (auto completion, auto loading the drop-down options of qcombox, setting the background color)
- VS2010编写动态链接库DLL和单元测试,转让DLL测试的正确性
- Spire Office 7.5.4 for NET
猜你喜欢

STM32__ 06 - single channel ADC

Dynamic memory management (malloc/calloc/realloc)

基于脉冲神经网络的物体检测

Neural structured learning - Part 2: training with natural graphs

How to design API return code (error code)?

Research notes I software engineering and calculation volume II (Chapter 1-7)

Hcip course notes-16 VLAN, three-tier architecture, MPLS virtual private line configuration

TVS管和ESD管的技术指标和选型指南-嘉立创推荐

21.PWM应用编程

【LeetCode】5. Valid palindrome
随机推荐
【LeetCode】5. Valid Palindrome·有效回文
Calculating the number of daffodils in C language
98. Verify the binary search tree ●●
同事悄悄告诉我,飞书通知还能这样玩
How to design API return code (error code)?
98. 验证二叉搜索树 ●●
Objective C message dispatch mechanism
2022.6.20-6.26 AI行业周刊(第103期):新的小生命
俄外交部:日韩参加北约峰会影响亚洲安全稳定
regular expression
做自媒体影视短视频剪辑号,在哪儿下载素材?
el-cascader的使用以及报错解决
【经典控制理论】自控实验总结
如何提升口才
What is the process of building a website
GFS分布式文件系統
哪些偏门项目可以做到?自媒体做到月赚一万以上很难吗?
MySQL (2) -- simple query, conditional query
idea 连接mysql ,直接贴配置文件的url 比较方便
Live tiktok shop 2022 latest gameplay card slot overseas live e-commerce new traffic