1 | /* |
---|
2 | * To change this license header, choose License Headers in Project Properties. |
---|
3 | * To change this template file, choose Tools | Templates |
---|
4 | * and open the template in the editor. |
---|
5 | */ |
---|
6 | package nl.mpi.annot.translate; |
---|
7 | |
---|
8 | import java.util.ArrayList; |
---|
9 | |
---|
10 | /** |
---|
11 | * |
---|
12 | * @author petbei |
---|
13 | * |
---|
14 | * |
---|
15 | */ |
---|
16 | public class AnnotationTranslator { |
---|
17 | |
---|
18 | class TranslationPair { |
---|
19 | String fromStr; |
---|
20 | String toStr; |
---|
21 | TranslationPair(String f, String t) { |
---|
22 | fromStr = f; |
---|
23 | toStr = t; |
---|
24 | } |
---|
25 | } |
---|
26 | |
---|
27 | //enum TranslationType { |
---|
28 | // TT_undefined, |
---|
29 | // TT_replaceLiteral, |
---|
30 | // TT_attributedReplace, |
---|
31 | // TT_replacePerSegment, |
---|
32 | // TT_replacePerSegmentAndSpellcheck |
---|
33 | //} |
---|
34 | |
---|
35 | SymbolTable resources; //--- unique set of resources |
---|
36 | SymbolTable layers; //--- unique set of layers/views |
---|
37 | SymbolTable formalisms; //--- unique set of linguistic encoding formalisms (UD17, CGN PoS, X-Sampa, IPA, CG sampa, ...) |
---|
38 | TranslationTypes translationTypes; //--- method to translate a String in formalism A to Formalism B |
---|
39 | ResourceLayers resourceLayers; //--- unique resource/layer combinations |
---|
40 | TranslationTables translationTables; //--- unique translation tables |
---|
41 | |
---|
42 | public AnnotationTranslator(String xmlUri) { |
---|
43 | resources = new SymbolTable(); |
---|
44 | layers = new SymbolTable(); |
---|
45 | formalisms = new SymbolTable(); |
---|
46 | translationTypes = new TranslationTypes(); |
---|
47 | resourceLayers = new ResourceLayers(); |
---|
48 | translationTables = new TranslationTables(); |
---|
49 | XMLparser xp = new XMLparser(xmlUri, resources, layers, formalisms, translationTypes, resourceLayers, translationTables); |
---|
50 | } |
---|
51 | |
---|
52 | TranslationType getTranslationType(String ttId) { |
---|
53 | return translationTypes.getTranslationType(ttId); |
---|
54 | } |
---|
55 | |
---|
56 | TranslationTable findTranslationTable(String fromRes, String fromLay, String toRes, String toLay, TranslationType ty) { |
---|
57 | return translationTables.find(fromRes, fromLay, toRes, toLay, ty); |
---|
58 | } |
---|
59 | |
---|
60 | public TranslationResult translateAnnotation(String tabId, String inStr) { |
---|
61 | System.err.println("*** WARNING *** not implemented yet: \"AnnotationTranslator::AnnotationTranslator(void)\" -> AnnoTransResult"); |
---|
62 | return (TranslationResult) null; |
---|
63 | } |
---|
64 | |
---|
65 | public TranslationTable getTranslationTableDetails(String tableId) { |
---|
66 | System.err.println("*** WARNING *** not implemented yet: \"AnnotationTranslator::getTranslationTableDetails(String tableId)\" -> TranslationTable"); |
---|
67 | return (TranslationTable) null; |
---|
68 | } |
---|
69 | } |
---|