All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gate.creole.orthomatcher.MatchRule16 Maven / Gradle / Ivy

Go to download

ANNIE is a general purpose information extraction system that provides the building blocks of many other GATE applications.

There is a newer version: 9.1
Show newest version
package gate.creole.orthomatcher;

import gate.Annotation;

/**
 * RULE #15: Does every token in the shorter name appear in the longer name?
 */
public class MatchRule16 implements OrthoMatcherRule {

    OrthoMatcher orthmatcher;
	
	public MatchRule16(OrthoMatcher orthomatcher){
			this.orthmatcher=orthomatcher;
	}
	
	@Override
  public boolean value(String s1, String s2) {
	
	  boolean result =true;
	  
		//do a token-by-token test
	    Annotation token1, token2;
	    // catch (ExecutionException e) {}
	    for (int i=0; i < orthmatcher.tokensShortAnnot.size(); i++) {
	      token1 = orthmatcher.tokensShortAnnot.get(i);
	      //first check if not punctuation, because we need to skip it
	      if (token1.getFeatures().get(OrthoMatcher.TOKEN_KIND_FEATURE_NAME).equals(OrthoMatcher.PUNCTUATION_VALUE))
	        continue;

	      String ts1 = (String)token1.getFeatures().get(OrthoMatcher.TOKEN_STRING_FEATURE_NAME);
	      boolean foundMatch = false;
	      for (int j=0; j




© 2015 - 2024 Weber Informatics LLC | Privacy Policy