Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.apache.ctakes.temporal.ae.feature;
 
 import java.util.List;
 
import  org.cleartk.ml.Feature;
public class CoordinateFeaturesExtractor implements
	public List<Feature> extract(JCas jCasIdentifiedAnnotation arg1,
		ArrayList<Feature> feats = new ArrayList<>();
		List<BaseTokenarg1Tokens = JCasUtil.selectCovered(jCasBaseToken.classarg1);
		List<BaseTokenarg2Tokens = JCasUtil.selectCovered(jCasBaseToken.classarg2);
		int arg1Length = arg1Tokens == null ? 0 : arg1Tokens.size();
		int arg2Length = arg2Tokens == null ? 0 : arg2Tokens.size();
		if(arg1Length != arg2Length || arg1Length == 0 || arg2Length == 0){
			return feats;
		}
		for (int i=0; i<arg1Lengthi++){
			if(!arg1Tokens.get(i).getPartOfSpeech().equals(arg2Tokens.get(i).getPartOfSpeech())){
				return feats;
			}
		}
		int begin = arg1.getEnd();
		int end   = arg2.getBegin();
		if ( begin > end ){
			begin = arg2.getEnd();
			end   = arg1.getBegin();
		}
		if ( begin >= end ){
			return feats;
		}
		List<EventMentionbetweenEvents = JCasUtil.selectCovered(jCasEventMention.classbeginend);
		int eventInBetween  = betweenEvents == null ? 0 : betweenEvents.size();
		if(eventInBetween >0) return feats;
		List<BaseTokenbetweenTokens = JCasUtil.selectCovered(jCasBaseToken.classbeginend);
		for (BaseToken tokenbetweenTokens){
			String tokenwd = token.getCoveredText();
			if(token.getPartOfSpeech().startsWith("CC")||tokenwd.equals(",")||tokenwd.equals(";")||tokenwd.equals("/")||tokenwd.equals("w")||tokenwd.equals("&")||tokenwd.equalsIgnoreCase("versus")||tokenwd.equalsIgnoreCase("vs")||tokenwd.equalsIgnoreCase("with")){
				feats.add(new Feature("Coordinate_feature""Coordinate"));
				break;
			}
		}
		return feats;
	}
New to GrepCode? Check out our FAQ X