当前位置: 首页>>代码示例>>Java>>正文


Java UnicodeBlock.HANGUL_COMPATIBILITY_JAMO属性代码示例

本文整理汇总了Java中java.lang.Character.UnicodeBlock.HANGUL_COMPATIBILITY_JAMO属性的典型用法代码示例。如果您正苦于以下问题:Java UnicodeBlock.HANGUL_COMPATIBILITY_JAMO属性的具体用法?Java UnicodeBlock.HANGUL_COMPATIBILITY_JAMO怎么用?Java UnicodeBlock.HANGUL_COMPATIBILITY_JAMO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.lang.Character.UnicodeBlock的用法示例。


在下文中一共展示了UnicodeBlock.HANGUL_COMPATIBILITY_JAMO属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appendIrregularDictionary

/**
 * 불규칙 사전에 추가
 * 
 * @param paPair
 */
private void appendIrregularDictionary(ProblemAnswerPair paPair) {
	if (this.isIrregular(paPair.getProblem(), paPair.getAnswerList())) {
		// 자소 단위로 변환하여 불규칙 패턴 추출			
		List<Pair<String, String>> irrRuleList = irrParser.parse(
				this.convertJaso(paPair.getProblem()),
				this.convertJaso(paPair.getAnswerList()));
		for (Pair<String, String> pair : irrRuleList) {
			//트레이닝 셋의 오류로 인한 skip(세종 코퍼스 기준)
			if (pair.getSecond().trim().length() == 0) {
				;
			}else{
				//불규칙 대상에 자소 단위가 포함된 경우 skip
				if(this.irrExclusiveSet.contains(pair.getFirst()+"\t"+pair.getSecond().substring(0, pair.getSecond().lastIndexOf("/")))){
					continue;
				}
				boolean hasJamoProblem = false;
				String tmpProblem = this.unitParser.combine(pair.getFirst());
				for(int i=0;i<tmpProblem.length();i++){
					if(StringUtil.getUnicodeBlock(tmpProblem.charAt(i)) == UnicodeBlock.HANGUL_COMPATIBILITY_JAMO){
						hasJamoProblem = true;
						break;
					}
				}
				if(hasJamoProblem)continue;
				//놓으 -> 놓+으시와 같은 경우 skip
				//않으 -> 않+으시
				if(pair.getFirst().endsWith("ㅇㅡ") && pair.getSecond().endsWith("ㅇㅡㅅㅣ/EP")){
					continue;
				}					
				irrDic.append(this.unitParser.combine(pair.getFirst()), this.unitParser.combine(pair.getSecond()));
				//					irrDic.append(pair.getFirst(), pair.getSecond());
			}
		}
	}
}
 
开发者ID:shin285,项目名称:KOMORAN,代码行数:40,代码来源:CorpusBuilder.java

示例2: appendWordDictionary

/**
	 * 단어 사전에 형태소, 품사 쌍 데이터 추가
	 * 
	 * @param answerList
	 */
	private void appendWordDictionary(List<Pair<String, String>> answerList) {
		for (Pair<String, String> pair : answerList) {
			if(pair.getFirst().trim().length() == 1){
				if(StringUtil.getUnicodeBlock(pair.getFirst().trim().charAt(0)) == UnicodeBlock.HANGUL_COMPATIBILITY_JAMO 
						&& pair.getSecond().contains("NN")){
					continue;
				}
			}
			
			if(pair.getSecond().equals("SH") || 
					pair.getSecond().equals("SN") || 
					pair.getSecond().equals("SL")){
				continue;
			}
			
			//analyzer와 의존성이 있는 관계로 rule parser에 해당 내용이 포함되어 있어야함
			//근데 이걸 하면 빨라질까?
//			if(pair.getSecond().equals("SF")	//마침표, 물음표, 느낌표 . ? !
//					|| pair.getSecond().equals("SP")	//쉼표, 가운뎃점, 콜론, 빗금 , / ; :
//					|| pair.getSecond().equals("SS")	//따옴표, 괄호표, 줄표 " ' ` - < > { } [ ] ( )
//					|| pair.getSecond().equals("SO") 	//붙임표(물결, 숨김, 빠짐) ~
//					){	//줄임표 ...
//				continue;
//			}
			
			wordDic.append(pair.getFirst(), pair.getSecond());
		}
	}
 
开发者ID:shin285,项目名称:KOMORAN,代码行数:33,代码来源:CorpusBuilder.java

示例3: setCharacterSubsets

/**
 * Implements InputMethod.setCharacterSubsets for Windows.
 *
 * @see java.awt.im.spi.InputMethod#setCharacterSubsets
 */
@Override
public void setCharacterSubsets(Subset[] subsets) {
    if (subsets == null){
        setConversionStatus(context, cmode);
        setOpenStatus(context, open);
        return;
    }

    // Use first subset only. Other subsets in array is ignored.
    // This is restriction of Win32 implementation.
    Subset subset1 = subsets[0];

    Locale locale = getNativeLocale();
    int newmode;

    if (locale == null) {
        return;
    }

    if (locale.getLanguage().equals(Locale.JAPANESE.getLanguage())) {
        if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) {
            setOpenStatus(context, false);
        } else {
            if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
                || subset1 == InputSubset.KANJI
                || subset1 == UnicodeBlock.HIRAGANA)
                newmode = IME_CMODE_NATIVE | IME_CMODE_FULLSHAPE;
            else if (subset1 == UnicodeBlock.KATAKANA)
                newmode = IME_CMODE_NATIVE | IME_CMODE_KATAKANA| IME_CMODE_FULLSHAPE;
            else if (subset1 == InputSubset.HALFWIDTH_KATAKANA)
                newmode = IME_CMODE_NATIVE | IME_CMODE_KATAKANA;
            else if (subset1 == InputSubset.FULLWIDTH_LATIN)
                newmode = IME_CMODE_FULLSHAPE;
            else
                return;
            setOpenStatus(context, true);
            newmode |= (getConversionStatus(context)&IME_CMODE_ROMAN);   // reserve ROMAN input mode
            setConversionStatus(context, newmode);
        }
    } else if (locale.getLanguage().equals(Locale.KOREAN.getLanguage())) {
        if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) {
            setOpenStatus(context, false);
        } else {
            if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
                || subset1 == InputSubset.HANJA
                || subset1 == UnicodeBlock.HANGUL_SYLLABLES
                || subset1 == UnicodeBlock.HANGUL_JAMO
                || subset1 == UnicodeBlock.HANGUL_COMPATIBILITY_JAMO)
                newmode = IME_CMODE_NATIVE;
            else if (subset1 == InputSubset.FULLWIDTH_LATIN)
                newmode = IME_CMODE_FULLSHAPE;
            else
                return;
            setOpenStatus(context, true);
            setConversionStatus(context, newmode);
        }
    } else if (locale.getLanguage().equals(Locale.CHINESE.getLanguage())) {
        if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) {
            setOpenStatus(context, false);
        } else {
            if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
                || subset1 == InputSubset.TRADITIONAL_HANZI
                || subset1 == InputSubset.SIMPLIFIED_HANZI)
                newmode = IME_CMODE_NATIVE;
            else if (subset1 == InputSubset.FULLWIDTH_LATIN)
                newmode = IME_CMODE_FULLSHAPE;
            else
                return;
            setOpenStatus(context, true);
            setConversionStatus(context, newmode);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:78,代码来源:WInputMethod.java

示例4: symbolParsing

private boolean symbolParsing(Lattice lattice, char jaso, int idx) {

        Character.UnicodeBlock unicodeBlock = Character.UnicodeBlock.of(jaso);
        //숫자
        if (Character.isDigit(jaso)) {
            return false;
        } else if (unicodeBlock == Character.UnicodeBlock.BASIC_LATIN) {
            //영어
            if (((jaso >= 'A') && (jaso <= 'Z')) || ((jaso >= 'a') && (jaso <= 'z'))) {
                return false;
            } else if (this.resources.getObservation().getTrieDictionary().getValue("" + jaso) != null) {
                return false;
            } else if (jaso == ' ') {
                return false;
            }
            //아스키 코드 범위 내에 사전에 없는 경우에는 기타 문자
            else {
                lattice.put(idx, idx + 1, "" + jaso, SYMBOL.SW, this.resources.getTable().getId(SYMBOL.SW), SCORE.SW);
                return true;
            }
        }
        //한글
        else if (unicodeBlock == UnicodeBlock.HANGUL_COMPATIBILITY_JAMO
                || unicodeBlock == UnicodeBlock.HANGUL_JAMO
                || unicodeBlock == UnicodeBlock.HANGUL_JAMO_EXTENDED_A
                || unicodeBlock == UnicodeBlock.HANGUL_JAMO_EXTENDED_B
                || unicodeBlock == UnicodeBlock.HANGUL_SYLLABLES) {
            return false;
        }
        //일본어
        else if (unicodeBlock == UnicodeBlock.KATAKANA
                || unicodeBlock == UnicodeBlock.KATAKANA_PHONETIC_EXTENSIONS) {
            return false;
        }
        //중국어
        else if (UnicodeBlock.CJK_COMPATIBILITY.equals(unicodeBlock)
                || UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS.equals(unicodeBlock)
                || UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A.equals(unicodeBlock)
                || UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B.equals(unicodeBlock)
                || UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS.equals(unicodeBlock)) {
            return false;
        }
        //그 외 문자인 경우
        else {
            lattice.put(idx, idx + 1, "" + jaso, SYMBOL.SW, this.resources.getTable().getId(SYMBOL.SW), SCORE.SW);
            return true;
        }
    }
 
开发者ID:shin285,项目名称:KOMORAN,代码行数:48,代码来源:Komoran.java

示例5: setCharacterSubsets

/**
 * Implements InputMethod.setCharacterSubsets for Windows.
 *
 * @see java.awt.im.spi.InputMethod#setCharacterSubsets
 */
public void setCharacterSubsets(Subset[] subsets) {
    if (subsets == null){
        setConversionStatus(context, cmode);
        setOpenStatus(context, open);
        return;
    }

    // Use first subset only. Other subsets in array is ignored.
    // This is restriction of Win32 implementation.
    Subset subset1 = subsets[0];

    Locale locale = getNativeLocale();
    int newmode;

    if (locale == null) {
        return;
    }

    if (locale.getLanguage().equals(Locale.JAPANESE.getLanguage())) {
        if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) {
            setOpenStatus(context, false);
        } else {
            if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
                || subset1 == InputSubset.KANJI
                || subset1 == UnicodeBlock.HIRAGANA)
                newmode = IME_CMODE_NATIVE | IME_CMODE_FULLSHAPE;
            else if (subset1 == UnicodeBlock.KATAKANA)
                newmode = IME_CMODE_NATIVE | IME_CMODE_KATAKANA| IME_CMODE_FULLSHAPE;
            else if (subset1 == InputSubset.HALFWIDTH_KATAKANA)
                newmode = IME_CMODE_NATIVE | IME_CMODE_KATAKANA;
            else if (subset1 == InputSubset.FULLWIDTH_LATIN)
                newmode = IME_CMODE_FULLSHAPE;
            else
                return;
            setOpenStatus(context, true);
            newmode |= (getConversionStatus(context)&IME_CMODE_ROMAN);   // reserve ROMAN input mode
            setConversionStatus(context, newmode);
        }
    } else if (locale.getLanguage().equals(Locale.KOREAN.getLanguage())) {
        if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) {
            setOpenStatus(context, false);
        } else {
            if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
                || subset1 == InputSubset.HANJA
                || subset1 == UnicodeBlock.HANGUL_SYLLABLES
                || subset1 == UnicodeBlock.HANGUL_JAMO
                || subset1 == UnicodeBlock.HANGUL_COMPATIBILITY_JAMO)
                newmode = IME_CMODE_NATIVE;
            else if (subset1 == InputSubset.FULLWIDTH_LATIN)
                newmode = IME_CMODE_FULLSHAPE;
            else
                return;
            setOpenStatus(context, true);
            setConversionStatus(context, newmode);
        }
    } else if (locale.getLanguage().equals(Locale.CHINESE.getLanguage())) {
        if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) {
            setOpenStatus(context, false);
        } else {
            if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
                || subset1 == InputSubset.TRADITIONAL_HANZI
                || subset1 == InputSubset.SIMPLIFIED_HANZI)
                newmode = IME_CMODE_NATIVE;
            else if (subset1 == InputSubset.FULLWIDTH_LATIN)
                newmode = IME_CMODE_FULLSHAPE;
            else
                return;
            setOpenStatus(context, true);
            setConversionStatus(context, newmode);
        }
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:77,代码来源:WInputMethod.java

示例6: symbolParsing

/**
 * 입력된 문자로부터 symbol을 구분하여 lattice에 삽입
 * @param in
 * @param i
 */
private void symbolParsing(String in, int i) {
	char ch = in.charAt(i);
	Character.UnicodeBlock unicodeBlock = Character.UnicodeBlock.of(ch);
	//숫자
	if(Character.isDigit(ch)){
		
	}
	else if(unicodeBlock == Character.UnicodeBlock.BASIC_LATIN){
		//영어
		if (((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z'))) {
			;
		}
		else if(observation.getTrieDictionary().get(ch) != null){
			;
		}
		//symbol
		else{
			this.lattice.put(i, i+1, ""+ch, this.table.getId(SYMBOL.SW), SCORE.SW);
		}
	}
	//한글
	else if(unicodeBlock == UnicodeBlock.HANGUL_COMPATIBILITY_JAMO 
			|| unicodeBlock == UnicodeBlock.HANGUL_JAMO
			|| unicodeBlock == UnicodeBlock.HANGUL_JAMO_EXTENDED_A
			||unicodeBlock == UnicodeBlock.HANGUL_JAMO_EXTENDED_B
			||unicodeBlock == UnicodeBlock.HANGUL_SYLLABLES){
		;
	}
	//일본어
	else if(unicodeBlock == UnicodeBlock.KATAKANA
			|| unicodeBlock == UnicodeBlock.KATAKANA_PHONETIC_EXTENSIONS){
		
	}
	//중국어
	else if(UnicodeBlock.CJK_COMPATIBILITY.equals(unicodeBlock)				
			|| UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS.equals(unicodeBlock)
			|| UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A.equals(unicodeBlock)
			|| UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B.equals(unicodeBlock)
			|| UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS.equals(unicodeBlock)){
		;
	}
	else{
		this.lattice.put(i, i+1, ""+ch, this.table.getId(SYMBOL.SW), SCORE.SW);
	}
}
 
开发者ID:shineware,项目名称:komoran-2.0,代码行数:50,代码来源:Komoran.java

示例7: isKoreanUnicodeBlock

private static boolean isKoreanUnicodeBlock(UnicodeBlock unicodeBlock) {
    return unicodeBlock == UnicodeBlock.HANGUL_SYLLABLES ||
            unicodeBlock == UnicodeBlock.HANGUL_JAMO ||
            unicodeBlock == UnicodeBlock.HANGUL_COMPATIBILITY_JAMO;
}
 
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:5,代码来源:NameSplitter.java


注:本文中的java.lang.Character.UnicodeBlock.HANGUL_COMPATIBILITY_JAMO属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。