-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
返回值存在一点小问题 #31
Comments
这个库很久没维护了,来这里一起助力吧:https://github.com/wnjustdoit/pinyin4j |
参考 issues 28 提到的 汉语拼音正词法基本规则,实际上返回值是正确的,读一下这个基本规则应该就能理解了。 |
那可不是这个问题,这个bug我已经修复了(你可以试试任意的句子,都可以正常分割的):https://github.com/wnjustdoit/pinyin4j/blob/master/src/test/java/net/sourceforge/pinyin4j/test/NewPinyinHelperTest.java |
用的你库试了一下,确实没有出现最后两个中文字符中间未拼接分隔符的现象。 |
代码:
private static final HanyuPinyinOutputFormat HANYU_PINYIN_OUTPUT_FORMAT = new HanyuPinyinOutputFormat();
public static String getPinYinChar(String str) {
try {
return PinyinHelper.toHanYuPinyinString(str, HANYU_PINYIN_OUTPUT_FORMAT, " ", false);
} catch (BadHanyuPinyinOutputFormatCombination badHanyuPinyinOutputFormatCombination) {
throw new GlobalSystemException(badHanyuPinyinOutputFormatCombination.getMessage(), badHanyuPinyinOutputFormatCombination);
}
}
测试:
@test
public void getPinYinChar(){
String s = PinYinUtil.getPinYinChar("大鱼吃小鱼,杨幂是个女的");
System.out.println(s);
}
输出结果:
da yu chi xiao yu yang mi shi ge nüde
bug描述:
separate我使用的是一个空格,返回值最后 [ 女的] 的拼音未使用separate 进行拼接
感谢开源
The text was updated successfully, but these errors were encountered: