cn.hutool.extra.pinyin.engine.bopomofo4j.Bopomofo4jEngine Maven / Gradle / Ivy
package cn.hutool.extra.pinyin.engine.bopomofo4j;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.pinyin.PinyinEngine;
import com.rnkrsoft.bopomofo4j.Bopomofo4j;
import com.rnkrsoft.bopomofo4j.ToneType;
/**
* 封装了Bopomofo4j的引擎。
*
*
* Bopomofo4j封装,项目:https://gitee.com/rnkrsoft/Bopomofo4j。
*
*
*
* 引入:
*
* <dependency>
* <groupId>com.rnkrsoft.bopomofo4j</groupId>
* <artifactId>bopomofo4j</artifactId>
* <version>1.0.0</version>
* </dependency>
*
*
* @author looly
* @since 5.4.5
*/
public class Bopomofo4jEngine implements PinyinEngine {
public Bopomofo4jEngine(){
Bopomofo4j.local();
}
@Override
public String getPinyin(char c) {
return Bopomofo4j.pinyin(String.valueOf(c), ToneType.WITHOUT_TONE, false, false, StrUtil.EMPTY);
}
@Override
public String getPinyin(String str, String separator) {
return Bopomofo4j.pinyin(str, ToneType.WITHOUT_TONE, false, false, separator);
}
}