com.whaleal.icefrog.extra.pinyin.engine.bopomofo4j.Bopomofo4jEngine Maven / Gradle / Ivy
package com.whaleal.icefrog.extra.pinyin.engine.bopomofo4j;
import com.whaleal.icefrog.core.util.StrUtil;
import com.whaleal.icefrog.extra.pinyin.PinyinEngine;
import com.rnkrsoft.bopomofo4j.Bopomofo4j;
import com.rnkrsoft.bopomofo4j.ToneType;
/**
* 封装了Bopomofo4j的引擎。
*
*
* Bopomofo4j封装,项目:https://github.com/rnkrsoft/Bopomofo4j。
*
*
*
* 引入:
*
* <dependency>
* <groupId>com.rnkrsoft.bopomofo4j</groupId>
* <artifactId>bopomofo4j</artifactId>
* <version>1.0.0</version>
* </dependency>
*
*
* @author Looly
* @author wh
* @since 1.0.0
*/
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);
}
}