source: FCSannotrans/trunk/src/main/java/nl/mpi/annot/translate/AnnotationTranslator.java @ 6988

Last change on this file since 6988 was 6988, checked in by Leif-Jöran, 8 years ago

Completing the translation configuration test from provided file by printing the annotation tables instead of trying to find CGN tables to test if there are no CGN translation types provided.

File size: 2.7 KB
Line 
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 */
6package nl.mpi.annot.translate;
7
8import java.util.ArrayList;
9import java.util.List;
10
11/**
12 *
13 * @author petbei
14 *
15 *
16 */
17public class AnnotationTranslator {
18       
19    class TranslationPair {
20        String fromStr;
21        String toStr;
22        TranslationPair(String f, String t) {
23            fromStr = f;
24            toStr = t;
25        }
26    }
27   
28    //enum TranslationType {
29    //    TT_undefined,
30    //    TT_replaceLiteral,
31    //    TT_attributedReplace,
32    //    TT_replacePerSegment,
33    //    TT_replacePerSegmentAndSpellcheck
34    //}
35   
36    SymbolTable       resources;          //--- unique set of resources
37    SymbolTable       layers;             //--- unique set of layers/views
38    SymbolTable       formalisms;         //--- unique set of linguistic encoding formalisms (UD17, CGN PoS, X-Sampa, IPA, CG sampa, ...)
39    TranslationTypes  translationTypes;   //--- method to translate a String in formalism A to Formalism B
40    ResourceLayers    resourceLayers;     //--- unique resource/layer combinations
41    TranslationTables translationTables;  //--- unique translation tables
42
43    public AnnotationTranslator(String xmlUri) {
44        resources           = new SymbolTable();
45        layers              = new SymbolTable();
46        formalisms          = new SymbolTable();
47        translationTypes    = new TranslationTypes();
48        resourceLayers      = new ResourceLayers();
49        translationTables   = new TranslationTables();
50        XMLparser xp = new XMLparser(xmlUri, resources, layers, formalisms, translationTypes, resourceLayers, translationTables);
51    }
52   
53    TranslationType getTranslationType(String ttId) {
54        return translationTypes.getTranslationType(ttId);
55    }
56
57    public List<TranslationTable> getTranslationTables() {
58        return translationTables.getList();
59    }
60
61    TranslationTable findTranslationTable(String fromRes, String fromLay, String toRes, String toLay, TranslationType ty) {
62        return translationTables.find(fromRes, fromLay, toRes, toLay, ty);
63    }
64   
65    public TranslationResult translateAnnotation(String tabId, String inStr) {
66        System.err.println("*** WARNING *** not implemented yet: \"AnnotationTranslator::AnnotationTranslator(void)\" -> AnnoTransResult");
67        return (TranslationResult) null;
68    }
69   
70    public TranslationTable getTranslationTableDetails(String tableId) {
71        System.err.println("*** WARNING *** not implemented yet: \"AnnotationTranslator::getTranslationTableDetails(String tableId)\" -> TranslationTable");
72        return (TranslationTable) null;
73    }
74}
Note: See TracBrowser for help on using the repository browser.