All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat Maven / Gradle / Ivy

Go to download

Support Chinese character (both Simplified and Tranditional) to most popular Pinyin systems, including Hanyu Pinyin, Tongyong Pinyin, Wade-Giles, MPS2, Yale and Gwoyeu Romatzyh. Support multiple pronounciations and customized output.

The newest version!
/**
 * This file is part of pinyin4j (http://sourceforge.net/projects/pinyin4j/) and distributed under
 * GNU GENERAL PUBLIC LICENSE (GPL).
 * 
 * pinyin4j is free software; you can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 * 
 * pinyin4j is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with pinyin4j.
 */

package net.sourceforge.pinyin4j.format;

/**
 * This classes define how the Hanyu Pinyin should be outputted.
 * 
 * 

* The output feature includes: *

    *
  • Output format of character 'ü'; *
  • Output format of Chinese tones; *
  • Cases of letters in outputted string *
* *

* Default values of these features are listed below: * *

* HanyuPinyinVCharType := WITH_U_AND_COLON
* HanyuPinyinCaseType := LOWERCASE
* HanyuPinyinToneType := WITH_TONE_NUMBER
* *

* Some combinations of output format options are meaningless. For example, * WITH_TONE_MARK and WITH_U_AND_COLON. * *

* The combination of different output format options are listed below. For * example, '吕' * *

* * * * * * * * * * * * * * * * * * * * * * * * * * * *
LOWERCASE
CombinationWITH_U_AND_COLONWITH_VWITH_U_UNICODE
WITH_TONE_NUMBERlu:3lv3lü3
WITHOUT_TONElu:lv
WITH_TONE_MARKthrow exceptionthrow exception
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
UPPERCASE
CombinationWITH_U_AND_COLONWITH_VWITH_U_UNICODE
WITH_TONE_NUMBERLU:3LV3LÜ3
WITHOUT_TONELU:LV
WITH_TONE_MARKthrow exceptionthrow exception
* * @see HanyuPinyinVCharType * @see HanyuPinyinCaseType * @see HanyuPinyinToneType * * @author Li Min ([email protected]) * */ final public class HanyuPinyinOutputFormat { public HanyuPinyinOutputFormat() { restoreDefault(); } /** * Restore default variable values for this class * * Default values are listed below: * *

* HanyuPinyinVCharType := WITH_U_AND_COLON
* HanyuPinyinCaseType := LOWERCASE
* HanyuPinyinToneType := WITH_TONE_NUMBER
*/ public void restoreDefault() { vCharType = HanyuPinyinVCharType.WITH_U_AND_COLON; caseType = HanyuPinyinCaseType.LOWERCASE; toneType = HanyuPinyinToneType.WITH_TONE_NUMBER; } /** * Returns the output cases of Hanyu Pinyin characters * * @see HanyuPinyinCaseType */ public HanyuPinyinCaseType getCaseType() { return caseType; } /** * Define the output cases of Hanyu Pinyin characters * * @param caseType * the output cases of Hanyu Pinyin characters * * @see HanyuPinyinCaseType */ public void setCaseType(HanyuPinyinCaseType caseType) { this.caseType = caseType; } /** * Returns the output format of Chinese tones * * @see HanyuPinyinToneType */ public HanyuPinyinToneType getToneType() { return toneType; } /** * Define the output format of Chinese tones * * @param toneType * the output format of Chinese tones * * @see HanyuPinyinToneType */ public void setToneType(HanyuPinyinToneType toneType) { this.toneType = toneType; } /** * Returns output format of character 'ü' * * @see HanyuPinyinVCharType */ public HanyuPinyinVCharType getVCharType() { return vCharType; } /** * Define the output format of character 'ü' * * @param charType * the output format of character 'ü' * * @see HanyuPinyinVCharType */ public void setVCharType(HanyuPinyinVCharType charType) { vCharType = charType; } private HanyuPinyinVCharType vCharType; private HanyuPinyinCaseType caseType; private HanyuPinyinToneType toneType; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy