|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.pinyin4j.PinyinHelper
public class PinyinHelper
A class provides several utility functions to convert Chinese characters (both Simplified and Tranditional) into various Chinese Romanization representations
Constructor Summary | |
---|---|
private |
PinyinHelper()
|
Method Summary | |
---|---|
private static java.lang.String[] |
convertToGwoyeuRomatzyhStringArray(char ch)
|
private static java.lang.String[] |
convertToTargetPinyinStringArray(char ch,
PinyinRomanizationType targetPinyinSystem)
|
private static java.lang.String |
getFirstHanyuPinyinString(char ch,
HanyuPinyinOutputFormat outputFormat)
Deprecated. DO NOT use it again because the first retrived pinyin string may be a wrong pronouciation in a certain sentence context. This function will be removed in next release. |
private static java.lang.String[] |
getFormattedHanyuPinyinStringArray(char ch,
HanyuPinyinOutputFormat outputFormat)
Return the formatted Hanyu Pinyin representations of the given Chinese character (both in Simplified and Tranditional) in array format. |
private static java.lang.String[] |
getUnformattedHanyuPinyinStringArray(char ch)
Delegate function |
static java.lang.String[] |
toGwoyeuRomatzyhStringArray(char ch)
Get all unformmatted Gwoyeu Romatzyh presentations of a single Chinese character (both Simplified and Tranditional) |
static java.lang.String |
toHanyuPinyinString(java.lang.String str,
HanyuPinyinOutputFormat outputFormat,
java.lang.String seperater)
Deprecated. DO NOT use it again because the first retrived pinyin string may be a wrong pronouciation in a certain sentence context. This interface will be removed in next release. |
static java.lang.String[] |
toHanyuPinyinStringArray(char ch)
Get all unformmatted Hanyu Pinyin presentations of a single Chinese character (both Simplified and Tranditional) |
static java.lang.String[] |
toHanyuPinyinStringArray(char ch,
HanyuPinyinOutputFormat outputFormat)
Get all Hanyu Pinyin presentations of a single Chinese character (both Simplified and Tranditional) |
static java.lang.String[] |
toMPS2PinyinStringArray(char ch)
Get all unformmatted MPS2 (Mandarin Phonetic Symbols 2) presentations of a single Chinese character (both Simplified and Tranditional) |
static java.lang.String[] |
toTongyongPinyinStringArray(char ch)
Get all unformmatted Tongyong Pinyin presentations of a single Chinese character (both Simplified and Tranditional) |
static java.lang.String[] |
toWadeGilesPinyinStringArray(char ch)
Get all unformmatted Wade-Giles presentations of a single Chinese character (both Simplified and Tranditional) |
static java.lang.String[] |
toYalePinyinStringArray(char ch)
Get all unformmatted Yale Pinyin presentations of a single Chinese character (both Simplified and Tranditional) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
private PinyinHelper()
Method Detail |
---|
public static java.lang.String[] toHanyuPinyinStringArray(char ch)
For example,
If the input is '间', the return will be an array with
two Hanyu Pinyin strings:
"jian1"
"jian4"
If the
input is '李', the return will be an array with single Hanyu Pinyin
string:
"li3"
Special Note: If the return is "none0", that means the input Chinese character exists in Unicode CJK talbe, however, it has no pronounciation in Chinese
ch
- the given Chinese character
public static java.lang.String[] toHanyuPinyinStringArray(char ch, HanyuPinyinOutputFormat outputFormat) throws BadHanyuPinyinOutputFormatCombination
For example,
If the input is '间', the return will be an array with
two Hanyu Pinyin strings:
"jian1"
"jian4"
If the
input is '李', the return will be an array with single Hanyu Pinyin
string:
"li3"
Special Note: If the return is "none0", that means the input Chinese character is in Unicode CJK talbe, however, it has no pronounciation in Chinese
ch
- the given Chinese characteroutputFormat
- describes the desired format of returned Hanyu Pinyin String
BadHanyuPinyinOutputFormatCombination
- if certain combination of output formats happensHanyuPinyinOutputFormat
,
BadHanyuPinyinOutputFormatCombination
private static java.lang.String[] getFormattedHanyuPinyinStringArray(char ch, HanyuPinyinOutputFormat outputFormat) throws BadHanyuPinyinOutputFormatCombination
ch
- the given Chinese characteroutputFormat
- Describes the desired format of returned Hanyu Pinyin string
BadHanyuPinyinOutputFormatCombination
private static java.lang.String[] getUnformattedHanyuPinyinStringArray(char ch)
ch
- the given Chinese character
public static java.lang.String[] toTongyongPinyinStringArray(char ch)
ch
- the given Chinese character
toHanyuPinyinStringArray(char)
public static java.lang.String[] toWadeGilesPinyinStringArray(char ch)
ch
- the given Chinese character
toHanyuPinyinStringArray(char)
public static java.lang.String[] toMPS2PinyinStringArray(char ch)
ch
- the given Chinese character
toHanyuPinyinStringArray(char)
public static java.lang.String[] toYalePinyinStringArray(char ch)
ch
- the given Chinese character
toHanyuPinyinStringArray(char)
private static java.lang.String[] convertToTargetPinyinStringArray(char ch, PinyinRomanizationType targetPinyinSystem)
ch
- the given Chinese charactertargetPinyinSystem
- indicates target Chinese Romanization system should be
converted to
PinyinRomanizationType
public static java.lang.String[] toGwoyeuRomatzyhStringArray(char ch)
ch
- the given Chinese character
toHanyuPinyinStringArray(char)
private static java.lang.String[] convertToGwoyeuRomatzyhStringArray(char ch)
ch
- the given Chinese character
PinyinRomanizationType
public static java.lang.String toHanyuPinyinString(java.lang.String str, HanyuPinyinOutputFormat outputFormat, java.lang.String seperater) throws BadHanyuPinyinOutputFormatCombination
Special Note: If the return contains "none0", that means that Chinese character is in Unicode CJK talbe, however, it has not pronounciation in Chinese. This interface will be removed in next release.
str
- A given string contains Chinese charactersoutputFormat
- Describes the desired format of returned Hanyu Pinyin stringseperater
- The string is appended after a Chinese character (excluding
the last Chinese character at the end of sentence). Note!
Seperater will not appear after a non-Chinese character
BadHanyuPinyinOutputFormatCombination
private static java.lang.String getFirstHanyuPinyinString(char ch, HanyuPinyinOutputFormat outputFormat) throws BadHanyuPinyinOutputFormatCombination
ch
- The given Unicode characteroutputFormat
- Describes the desired format of returned Hanyu Pinyin string
BadHanyuPinyinOutputFormatCombination
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |