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


Java Predefine.TAG_PEOPLE属性代码示例

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

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

示例1: compile

/**
     * 编译,比如将词性为数词的转为##数##
     * @param tag 标签
     * @param name 原词
     * @return 编译后的等效词
     */
    public static String compile(String tag, String name)
    {
        if (tag.startsWith("m")) return Predefine.TAG_NUMBER;
        else if (tag.startsWith("nr")) return Predefine.TAG_PEOPLE;
        else if (tag.startsWith("ns")) return Predefine.TAG_PLACE;
        else if (tag.startsWith("nt")) return Predefine.TAG_GROUP;
        else if (tag.startsWith("t")) return Predefine.TAG_TIME;
        else if (tag.equals("x")) return Predefine.TAG_CLUSTER;
        else if (tag.equals("nx")) return Predefine.TAG_PROPER;
        else if (tag.equals("xx")) return Predefine.TAG_OTHER;

//        switch (tag)
//        {
//            case "m":
//            case "mq":
//                return Predefine.TAG_NUMBER;
//            case "nr":
//            case "nr1":
//            case "nr2":
//            case "nrf":
//            case "nrj":
//                return Predefine.TAG_PEOPLE;
//            case "ns":
//            case "nsf":
//                return Predefine.TAG_PLACE;
//            case "nt":
//                return Predefine.TAG_TIME;
//            case "x":
//                return Predefine.TAG_CLUSTER;
//            case "nx":
//                return Predefine.TAG_PROPER;
//        }

        return name;
    }
 
开发者ID:priester,项目名称:hanlpStudy,代码行数:41,代码来源:PosTagCompiler.java


示例2: compileRealWord

/**
 * 将原词转为等效词串
 * 
 * @param realWord
 *            原来的词
 * @param attribute
 *            等效词串
 * @return
 */
private String compileRealWord(String realWord,
		CoreDictionary.Attribute attribute) {
	if (attribute.nature.length == 1) {
		switch (attribute.nature[0]) {
		case nr:
		case nr1:
		case nr2:
		case nrf:
		case nrj: {
			wordID = CoreDictionary.NR_WORD_ID;
			// this.attribute =
			// CoreDictionary.get(CoreDictionary.NR_WORD_ID);
			return Predefine.TAG_PEOPLE;
		}
		case ns:
		case nsf: {
			wordID = CoreDictionary.NS_WORD_ID;
			// 在地名识别的时候,希望类似"河镇"的词语保持自己的词性,而不是未##地的词性
			// this.attribute =
			// CoreDictionary.get(CoreDictionary.NS_WORD_ID);
			return Predefine.TAG_PLACE;
		}
		// case nz:
		case nx: {
			wordID = CoreDictionary.NX_WORD_ID;
			this.attribute = CoreDictionary.get(CoreDictionary.NX_WORD_ID);
			return Predefine.TAG_PROPER;
		}
		case nt:
		case ntc:
		case ntcf:
		case ntcb:
		case ntch:
		case nto:
		case ntu:
		case nts:
		case nth:
		case nit: {
			wordID = CoreDictionary.NT_WORD_ID;
			// this.attribute =
			// CoreDictionary.get(CoreDictionary.NT_WORD_ID);
			return Predefine.TAG_GROUP;
		}
		case m:
		case mq: {
			wordID = CoreDictionary.M_WORD_ID;
			this.attribute = CoreDictionary.get(CoreDictionary.M_WORD_ID);
			return Predefine.TAG_NUMBER;
		}
		case x: {
			wordID = CoreDictionary.X_WORD_ID;
			this.attribute = CoreDictionary.get(CoreDictionary.X_WORD_ID);
			return Predefine.TAG_CLUSTER;
		}
		// case xx:
		// case w:
		// {
		// word= Predefine.TAG_OTHER;
		// }
		// break;
		case t: {
			wordID = CoreDictionary.T_WORD_ID;
			this.attribute = CoreDictionary.get(CoreDictionary.T_WORD_ID);
			return Predefine.TAG_TIME;
		}
		}
	}

	return realWord;
}
 
开发者ID:priester,项目名称:hanlpStudy,代码行数:79,代码来源:Vertex.java


示例3: compileRealWord

/**
     * 将原词转为等效词串
     * @param realWord 原来的词
     * @param attribute 等效词串
     * @return
     */
    private String compileRealWord(String realWord, CoreDictionary.Attribute attribute)
    {
        if (attribute.nature.length == 1)
        {
            switch (attribute.nature[0])
            {
                case nr:
                case nr1:
                case nr2:
                case nrf:
                case nrj:
                {
                    wordID = CoreDictionary.NR_WORD_ID;
                    return Predefine.TAG_PEOPLE;
                }
                case ns:
                case nsf:
                {
                    wordID = CoreDictionary.NS_WORD_ID;
                    return Predefine.TAG_PLACE;
                }
//                case nz:
                case nx:
                {
                    wordID = CoreDictionary.NX_WORD_ID;
                    return Predefine.TAG_PROPER;
                }
                case nt:
                case ntc:
                case ntcf:
                case ntcb:
                case ntch:
                case nto:
                case ntu:
                case nts:
                case nth:
                case nit:
                {
                    wordID = CoreDictionary.NT_WORD_ID;
                    return Predefine.TAG_GROUP;
                }
                case m:
                case mq:
                {
                    wordID = CoreDictionary.M_WORD_ID;
                    return Predefine.TAG_NUMBER;
                }
                case x:
                {
                    wordID = CoreDictionary.X_WORD_ID;
                    return Predefine.TAG_CLUSTER;
                }
//                case xx:
//                case w:
//                {
//                    word= Predefine.TAG_OTHER;
//                }
//                break;
                case t:
                {
                    wordID = CoreDictionary.T_WORD_ID;
                    return Predefine.TAG_TIME;
                }
            }
        }

        return realWord;
    }
 
开发者ID:ml-distribution,项目名称:HanLP,代码行数:74,代码来源:Vertex.java


示例4: newTranslatedPersonInstance

/**
 * 创建一个音译人名实例
 * 
 * @param realWord
 * @return
 */
public static Vertex newTranslatedPersonInstance(String realWord,
		int frequency) {
	return new Vertex(Predefine.TAG_PEOPLE, realWord,
			new CoreDictionary.Attribute(Nature.nrf, frequency));
}
 
开发者ID:priester,项目名称:hanlpStudy,代码行数:11,代码来源:Vertex.java


示例5: newJapanesePersonInstance

/**
 * 创建一个日本人名实例
 * 
 * @param realWord
 * @return
 */
public static Vertex newJapanesePersonInstance(String realWord,
		int frequency) {
	return new Vertex(Predefine.TAG_PEOPLE, realWord,
			new CoreDictionary.Attribute(Nature.nrj, frequency));
}
 
开发者ID:priester,项目名称:hanlpStudy,代码行数:11,代码来源:Vertex.java


示例6: newPersonInstance

/**
 * 创建一个人名实例
 * 
 * @param realWord
 * @param frequency
 * @return
 */
public static Vertex newPersonInstance(String realWord, int frequency) {
	return new Vertex(Predefine.TAG_PEOPLE, realWord,
			new CoreDictionary.Attribute(Nature.nr, frequency));
}
 
开发者ID:priester,项目名称:hanlpStudy,代码行数:11,代码来源:Vertex.java


示例7: newTranslatedPersonInstance

/**
 * 创建一个音译人名实例
 *
 * @param realWord
 * @return
 */
public static Vertex newTranslatedPersonInstance(String realWord, int frequency)
{
    return new Vertex(Predefine.TAG_PEOPLE, realWord, new CoreDictionary.Attribute(Nature.nrf, frequency));
}
 
开发者ID:ml-distribution,项目名称:HanLP,代码行数:10,代码来源:Vertex.java


示例8: newJapanesePersonInstance

/**
 * 创建一个日本人名实例
 *
 * @param realWord
 * @return
 */
public static Vertex newJapanesePersonInstance(String realWord, int frequency)
{
    return new Vertex(Predefine.TAG_PEOPLE, realWord, new CoreDictionary.Attribute(Nature.nrj, frequency));
}
 
开发者ID:ml-distribution,项目名称:HanLP,代码行数:10,代码来源:Vertex.java


示例9: newPersonInstance

/**
 * 创建一个人名实例
 *
 * @param realWord
 * @param frequency
 * @return
 */
public static Vertex newPersonInstance(String realWord, int frequency)
{
    return new Vertex(Predefine.TAG_PEOPLE, realWord, new CoreDictionary.Attribute(Nature.nr, frequency));
}
 
开发者ID:ml-distribution,项目名称:HanLP,代码行数:11,代码来源:Vertex.java



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