01 package gate.creole.orthomatcher.SampleOrthoMatcher;
02
03 import static gate.creole.ANNIEConstants.ANNOTATION_COREF_FEATURE_NAME;
04 import static gate.creole.ANNIEConstants.LOOKUP_ANNOTATION_TYPE;
05 import static gate.creole.ANNIEConstants.PERSON_GENDER_FEATURE_NAME;
06 import gate.Annotation;
07 import gate.AnnotationSet;
08 import gate.Document;
09 import gate.Factory;
10 import gate.FeatureMap;
11 import gate.creole.ExecutionException;
12 import gate.creole.orthomatcher.AnnotationOrthography;
13 import gate.creole.orthomatcher.OrthoMatcherHelper;
14 import gate.util.Err;
15 import gate.util.InvalidOffsetException;
16
17 import java.util.ArrayList;
18 import java.util.HashMap;
19 import java.util.HashSet;
20 import java.util.Iterator;
21 import java.util.List;
22 import java.util.Map;
23
24
25 /*
26 * This sample orthography shows you how to create your own orthography.
27 * Those methods that you do not need to change can use the code from the BasicAnnotationOrthography.
28 * This sample othography copies the behavior of the default one - BasicAnnotationOrthography.
29 */
30 public class SampleAnnotationOrthography implements gate.creole.orthomatcher.AnnotationOrthography {
31
32 private final String personType;
33 private final AnnotationOrthography defaultOrthography;
34 private final boolean extLists;
35
36 public SampleAnnotationOrthography(String personType, boolean extLists,
37 AnnotationOrthography defaultOrthography) {
38 this.personType = personType;
39 this.defaultOrthography = defaultOrthography;
40 this.extLists = extLists;
41 }
42
43 public String getStringForAnnotation(Annotation a, gate.Document d)
44 throws ExecutionException {
45
46 return defaultOrthography.getStringForAnnotation(a,d);
47 }
48
49 public String stripPersonTitle (String annotString, Annotation annot, Document doc, Map<Integer, List<Annotation>> tokensMap, HashMap normalizedTokensMap,AnnotationSet nameAllAnnots)
50 throws ExecutionException {
51 return defaultOrthography.stripPersonTitle(annotString,annot,doc,tokensMap,normalizedTokensMap,nameAllAnnots);
52 }
53
54 public boolean matchedAlready(Annotation annot1, Annotation annot2,List matchesDocFeature,AnnotationSet nameAllAnnots) {
55 return defaultOrthography.matchedAlready(annot1,annot2,matchesDocFeature,nameAllAnnots);
56 }
57
58 public void updateMatches(Annotation newAnnot, Annotation prevAnnot,List matchesDocFeature,AnnotationSet nameAllAnnots) {
59 defaultOrthography.updateMatches(newAnnot, prevAnnot,matchesDocFeature,nameAllAnnots);
60 }
61
62 public HashSet buildTables(AnnotationSet nameAllAnnots) {
63
64 return defaultOrthography.buildTables(nameAllAnnots);
65 }
66
67 public boolean allNonStopTokensInOtherAnnot(ArrayList<Annotation> arg0,
68 ArrayList<Annotation> arg1, String arg2, boolean arg3) {
69
70 return defaultOrthography.allNonStopTokensInOtherAnnot(arg0, arg1, arg2, arg3);
71 }
72
73 public boolean fuzzyMatch(String arg1,
74 String arg2) {
75
76 return defaultOrthography.fuzzyMatch(arg1, arg2);
77 }
78
79 public Annotation updateMatches(Annotation newAnnot, String annotString,HashMap processedAnnots,AnnotationSet nameAllAnnots,List matchesDocFeature) {
80
81 return defaultOrthography.updateMatches(newAnnot, annotString, processedAnnots,nameAllAnnots,matchesDocFeature);
82 }
83
84 public boolean isUnknownGender(String arg0) {
85
86 return defaultOrthography.isUnknownGender(arg0);
87 }
88
89 }
|