GATE API Basics The CREOLE Model Execution Control
The GATE Embedded API
Track II, Module 5 Second GATE Training Course May 2010
The GATE Embedded API 1 / 46
The GATE Embedded API Track II, Module 5 Second GATE Training - - PowerPoint PPT Presentation
GATE API Basics The CREOLE Model Execution Control The GATE Embedded API Track II, Module 5 Second GATE Training Course May 2010 The GATE Embedded API 1 / 46 GATE API Basics The CREOLE Model Execution Control Outline GATE API Basics 1
GATE API Basics The CREOLE Model Execution Control
The GATE Embedded API 1 / 46
GATE API Basics The CREOLE Model Execution Control
The GATE Embedded API 2 / 46
GATE API Basics The CREOLE Model Execution Control
The GATE Embedded API 3 / 46
GATE API Basics The CREOLE Model Execution Control
1 import gate.*; 2 public class Main { 3
4
5
6
7
8
9 } The GATE Embedded API 4 / 46
GATE API Basics The CREOLE Model Execution Control
The GATE Embedded API 5 / 46
GATE API Basics The CREOLE Model Execution Control
The GATE Embedded API 5 / 46
GATE API Basics The CREOLE Model Execution Control
The GATE Embedded API 5 / 46
GATE API Basics The CREOLE Model Execution Control
1 package gatetutorial; 2 3 import gate.*; 4 import gate.gui.*; 5 6 public class Main { 7
8
9
10
11
12
13
14
15
16 } The GATE Embedded API 6 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 7 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 8 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 9 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 10 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 11 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 12 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
1 public interface FeatureBearer{ 2
3 4
5 } The GATE Embedded API 13 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
1 public interface FeatureMap extends Map<Object, Object> 2 { 3
4
5
6
7 }
1 public interface FeatureMapListener 2
3 { 4
5 } The GATE Embedded API 14 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 15 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 16 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
1 public static Resource createResource( 2
3
4
5
6
7 }
The GATE Embedded API 17 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 18 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
1 FeatureMap params = Factory.newFeatureMap(); 2 params.put( 3
4
5 FeatureMap feats = Factory.newFeatureMap(); 6 feats.put("createdBy", "me!"); 7 Factory.createResource("gate.corpora.DocumentImpl", 8
The GATE Embedded API 19 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
1 import gate.*; 2
3 Document doc = Factory.newDocument("Document text"); 4
5 doc = Factory.newDocument(new URL("http://gate.ac.uk")); 6
7 doc = Factory.newDocument(new URL("http://gate.ac.uk"), 8
1 Corpus corpus = Factory.newCorpus("Corpus Name"); The GATE Embedded API 20 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 21 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 22 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 23 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
1
2 public DocumentContent getContent(); 3
4 public AnnotationSet getAnnotations(); 5
6 public AnnotationSet getAnnotations(String name); 7
8 public Set<String> getAnnotationSetNames(); 9
10 public Map<String, AnnotationSet> 11
12
13 public String toXml(); 14
15 public String toXml(Set aSourceAnnotationSet, 16
The GATE Embedded API 24 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 25 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
1
2 public Node firstNode(); 3
4 public Node lastNode();
1
2 public Integer add(Long start, Long end, 3
4
5 public Integer add(Node start, Node end, 6
The GATE Embedded API 26 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
1
2 public Annotation get(Integer id); 3
4 public AnnotationSet get(String type) 5
6 public Set<String> getAllTypes() 7
8 public AnnotationSet get(Set<String> types) The GATE Embedded API 27 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
1
2
3 public AnnotationSet get(Long offset) 4
5 public AnnotationSet get(Long startOffset, 6
7
8 public AnnotationSet getContained(Long startOffset, 9
10
11 public AnnotationSet getCovering(String neededType, 12
The GATE Embedded API 28 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
1
2 public AnnotationSet get(String type, 3
4
5 public AnnotationSet get(String type, 6
7
8 public AnnotationSet get(String type, 9
10
11 public AnnotationSet get(String type, 12
The GATE Embedded API 29 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 30 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
The GATE Embedded API 31 / 46
GATE API Basics The CREOLE Model Execution Control CREOLE Basics Resources, Parameters, Features Annotations, Documents, Corpora
1
2
3
4
1 public Long getOffset(); The GATE Embedded API 32 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
The GATE Embedded API 33 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
1 public interface Executable { 2
3
4
5 }
1 public interface ProcessingResource 2
3 { 4
5
6 } The GATE Embedded API 34 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
1 public interface LanguageAnalyser 2
3 4
5
6 7
8
9 10
11
12 13
14
The GATE Embedded API 35 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
1
2 File pluginsDir = Gate.getPluginsHome(); 3
4 File aPluginDir = new File(pluginsDir, "Tools"); 5
6 Gate.getCreoleRegister().registerDirectories( 7
The GATE Embedded API 36 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
The GATE Embedded API 37 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
The GATE Embedded API 38 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
The GATE Embedded API 39 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
1 public interface Controller extends Resource, 2
3
4
5
6 }
The GATE Embedded API 40 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
The GATE Embedded API 41 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
The GATE Embedded API 42 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
The GATE Embedded API 43 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
The GATE Embedded API 44 / 46
GATE API Basics The CREOLE Model Execution Control Processing Resources and Language Analysers Controllers
1
2
3 public static void saveObjectToFile(Object obj, 4
5
6 7
8
9 public static Object loadObjectFromFile(File file) 10
11
12
13 public static Object loadObjectFromUrl(URL url) 14
15
The GATE Embedded API 45 / 46
GATE API Basics The CREOLE Model Execution Control
The GATE Embedded API 46 / 46