java.lang.Object
org.miaixz.bus.extra.pinyin.provider.bopomofo4j.Bopomofo4JProvider
- All Implemented Interfaces:
Serializable,org.miaixz.bus.core.Provider,PinyinProvider
Encapsulates the Bopomofo4j engine.
Bopomofo4j encapsulation, project: https://gitee.com/rnkrsoft/Bopomofo4j.
To introduce (dependency):
<dependency>
<groupId>com.rnkrsoft.bopomofo4j</groupId>
<artifactId>bopomofo4j</artifactId>
<version>1.0.0</version>
</dependency>
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetPinyin(char c, boolean tone) Converts a single character to its Pinyin, with an option to retain tone marks.Retrieves the complete Pinyin for a given string, with an option to retain tone marks.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.extra.pinyin.PinyinProvider
getFirstLetter, getFirstLetter, getPinyin, getPinyin, type
-
Constructor Details
-
Bopomofo4JProvider
public Bopomofo4JProvider()Constructs a new Bopomofo4JProvider instance. Initializes the Bopomofo4j library for local use.
-
-
Method Details
-
getPinyin
Description copied from interface:PinyinProviderConverts a single character to its Pinyin, with an option to retain tone marks. If the character is a Chinese character, its Pinyin is returned; otherwise, the character itself is returned as a string.- Specified by:
getPinyinin interfacePinyinProvider- Parameters:
c- The character to convert.tone-trueto retain tone marks in the Pinyin,falseotherwise.- Returns:
- The Pinyin of the Chinese character, or the character itself if not Chinese.
-
getPinyin
Description copied from interface:PinyinProviderRetrieves the complete Pinyin for a given string, with an option to retain tone marks. Non-Chinese characters remain as is.- Specified by:
getPinyinin interfacePinyinProvider- Parameters:
str- The input string.separator- The separator to use between each Pinyin character.tone-trueto retain tone marks in the Pinyin,falseotherwise.- Returns:
- The Pinyin representation of the string.
-