01 package gate.creole.orthomatcher;
02
03 import java.util.HashSet;
04 import java.util.Map;
05
06 /** RULE #1: If the two names are identical then they are the same
07 * no longer used, because I do the check for same string via the
08 * hash table of previous annotations
09 * Condition(s): depend on case
10 * Applied to: annotations other than names
11 */
12 public class MatchRule1 implements OrthoMatcherRule{
13
14 OrthoMatcher orthomatcher;
15
16 public MatchRule1(OrthoMatcher orthmatcher){
17 this.orthomatcher=orthmatcher;
18 }
19
20 public boolean value(String s1,
21 String s2) {
22
23
24 boolean retVal = OrthoMatcherHelper.straightCompare(s1, s2, orthomatcher.caseSensitive);
25 //if straight compare didn't work, try a little extra logic
26 if (!retVal)
27 retVal = orthomatcher.getOrthography().fuzzyMatch(s1, s2);
28
29 if (retVal && orthomatcher.log.isDebugEnabled()) {
30 orthomatcher.log.debug("rule 1 matched " + s1 + "(id: " + orthomatcher.longAnnot.getId() + ") to "
31 + s2+ "(id: " + orthomatcher.shortAnnot.getId() + ")");
32 }
33
34 if (retVal) OrthoMatcherHelper.usedRule(1);
35
36 return retVal;
37 }
38
39 public String getId(){
40 return "MatchRule1";
41 }
42 }
|