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


Java PCM类代码示例

本文整理汇总了Java中gov.nih.nlm.nls.metamap.PCM的典型用法代码示例。如果您正苦于以下问题:Java PCM类的具体用法?Java PCM怎么用?Java PCM使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getClassification

import gov.nih.nlm.nls.metamap.PCM; //导入依赖的package包/类
public Map<Object, Object> getClassification(String term) throws Exception
{
	//String[] classfication = new String[3]; 
	Map<Object, Object> mp = new HashMap<Object, Object>();

	//Certain characters may cause MetaMap to throw an exception; 
	//filter terms before passing to mm.
	term = term.replaceAll("'", "");
	term = term.replaceAll("\"", "");

	List<Result> resultList = api.processCitationsFromString(term);
    //Result result = resultList.get(0);
	int i = 0;
    for(Result result:resultList){
	for (Utterance utterance: result.getUtteranceList()) 
	{	for (PCM pcm: utterance.getPCMList()) {
          /*for (Ev ev: pcm.getCandidatesInstance().getEvList()) {
	           System.out.println(" Candidate:");
	            System.out.println("  Score: " + ev.getScore());
	            System.out.println("  Concept Id: " + ev.getConceptId());
	            System.out.println("  Concept Name: " + ev.getConceptName());
	            System.out.println("  Preferred Name: " + ev.getPreferredName());
	            System.out.println("  Matched Words: " + ev.getMatchedWords());
	            System.out.println("  Semantic Types: " + ev.getSemanticTypes().get(0));
	            System.out.println("  MatchMap: " + ev.getMatchMap());
	            System.out.println("  MatchMap alt. repr.: " + ev.getMatchMapList());
	            System.out.println("  is Head?: " + ev.isHead());
	            System.out.println("  is Overmatch?: " + ev.isOvermatch());
	            System.out.println("  Sources: " + ev.getSources());
	            System.out.println("  Positional Info: " + ev.getPositionalInfo());
	          }*/
		
          for (Mapping map: pcm.getMappingList()) {
            for (Ev mapEv: map.getEvList()) {	  
           
            	mp.put(i++, mapEv.getConceptId());
            	mp.put(i++, mapEv.getMatchedWords());
            	mp.put(i++, mapEv.getPositionalInfo());
            	mp.put(i++, mapEv.getSemanticTypes().get(0)); //get only first SemType //.toString() for all if applicable [ SemType1, SemType2, etc.]
            	mp.put(i++, mapEv.getConceptName());
            	mp.put(i++, mapEv.getPreferredName());
            	// add further attributes here (and in run(gateDoc) --> gateMap.put(///))
            }
          }
    	}
	}
    }
return mp;
}
 
开发者ID:nikolamilosevic86,项目名称:TableDisentangler,代码行数:50,代码来源:MetaMapping.java


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