-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME
More file actions
34 lines (25 loc) · 1.25 KB
/
README
File metadata and controls
34 lines (25 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# pinyin4cpp
pinyin4j cpp版本
1、目前不支持多音字,汉子有多个拼音时,出其中一个
2、在pinyin4j的基础上做了一些性能改进,减少字符串操作
3、中文和拼音对应文件编到代码里了,使用时不需要字典文件
4、支持输出简拼
依赖:boost
install:
./configure --prefix= $(install_dir)
make
make install
通过头文件和动态库使用
demo/test.cc 编译生成 $(install_dir)/bin/test
用法:
PinyinHelper ph;
HanyuPinyinOutputFormat hpof;
hpof.setCaseType(HanyuPinyinCaseType::UPPERCASE); //拼音大写
hpof.setCaseType(HanyuPinyinCaseType::LOWERCASE); //拼音小写(默认值)
hpof.setToneType(HanyuPinyinToneType::WITHOUT_TONE); //不要声调
hpof.setToneType(HanyuPinyinToneType::WITH_TONE_NUMBER); //声调放在拼音后面用数字表示(默认值)
hpof.setVCharType(HanyuPinyinVCharType::WITH_U_AND_COLON); //u:转成ü
hpof.setVCharType(HanyuPinyinVCharType::WITH_V); //u:转成v (默认值)
hpof.setSpellType(HanyuPinyinSpellType::FIRST_LETTER); //首字母简拼
hpof.setSpellType(HanyuPinyinSpellType::FULL_LETTER); //全拼(默认值)
string res=ph.toHanYuPinyinString(s,hpof);