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


Java POS.getPOSForLabel方法代码示例

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


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

示例1: processRecord

import net.sf.extjwnl.data.POS; //导入方法依赖的package包/类
private void processRecord(String[] r, BiConsumer<InteractionDefinition, Collection<String>> consumer){
	if (r.length < 2) {
		return;
	}

	String type = r[0];
	String subType = r[1];

	if ("Type".equalsIgnoreCase(type) && "Subtype".equalsIgnoreCase(subType)) {
		// Header, ignore
		return;
	}

	String source = getOrEmpty(r, 2);
	String target = getOrEmpty(r, 3);
	String lemma = getOrEmpty(r, 4);
	POS pos = POS.getPOSForLabel(getOrEmpty(r, 5).toLowerCase());

	if (pos == null) {
		// Can't include words without a POS
		return;
	}

	InteractionDefinition i = new InteractionDefinition(type, subType, new Word(lemma, pos), source,
			target);

	List<String> alternatives = new ArrayList<>(r.length - 6);
	for (int j = 6; j < r.length; j++) {
		String alternative = r[j].trim();
		if (!alternative.isEmpty()) {
			alternatives.add(alternative);
		}
	}

	consumer.accept(i, alternatives);
}
 
开发者ID:dstl,项目名称:baleen,代码行数:37,代码来源:CsvInteractionReader.java

示例2: DetachSuffixesOperation

import net.sf.extjwnl.data.POS; //导入方法依赖的package包/类
public DetachSuffixesOperation(Dictionary dictionary, Map<String, Param> params) throws JWNLException {
    super(dictionary, params);
    suffixMap = new EnumMap<>(POS.class);
    for (Param p : params.values()) {
        POS pos = POS.getPOSForLabel(p.getName());
        if (pos != null) {
            suffixMap.put(pos, getSuffixArray(dictionary, p.getValue()));
        }
    }
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:11,代码来源:DetachSuffixesOperation.java

示例3: baseForms

import net.sf.extjwnl.data.POS; //导入方法依赖的package包/类
public CSList<String> baseForms(String lemma, String pos) throws Exception {
    CSList<String> result = null;
    String lowercaseLemma = lemma.toLowerCase();
    String fullpos = null;
    if (pos.length() == 1)
        fullpos = LangUtils.shortPOSToFullPOS(pos);
    else
        fullpos = pos; 
    String key = lowercaseLemma + "/" + fullpos;
    result = bfDict.get(key);
    if (result == null)
    {
        StringVector vector = BaseformOverrides.getWords().get(lowercaseLemma + '/' + pos);
        if (vector!=null)
        {
            result = new CSList<String>(new String[]{ vector.get("baseform") });
        }
        else
        {
            if (supportedPartsOfSpeech.contains(fullpos))
            {
            	// sso 7/9/2017: Verify that the lemma is an actual word and not just a random string
            	// before calling wnDict.getMorphologicalProcessor().lookupAllBaseForms()
            	String[] tokens = Util.split(lowercaseLemma);
            	if (tokens.length > MAX_ALLOWED_TOKENIZERS_IN_LEMMA) {
            		result = new CSList<String>(new String[]{ lowercaseLemma }); 
            	} else {
            	
             	POS fullposobj = POS.getPOSForLabel(fullpos);
                 List<String> bf = (List<String>) wnDict.getMorphologicalProcessor().lookupAllBaseForms(fullposobj,lowercaseLemma);
                 if (bf.size() > 0)
                 {
                 	String[] bfa = bf.toArray(new String [bf.size()]);
                     result = new CSList<String>(bfa);
                 }
                 else
                     result = new CSList<String>(new String[]{ lowercaseLemma });
            	}
            }
            else
            {
                result = new CSList<String>(new String[]{ lowercaseLemma });
            } 
        } 
        bfDict.put(key, result);
    }
     
    return result;
}
 
开发者ID:datancoffee,项目名称:sirocco,代码行数:50,代码来源:BaseFormsDictionary.java


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