gate.creole.orthomatcher.MatchRule16 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of annie Show documentation
Show all versions of annie Show documentation
ANNIE is a general purpose information extraction system that
provides the building blocks of many other GATE applications.
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