Skip to content

Decoding

cteichmann edited this page Jul 10, 2015 · 2 revisions

Decoding

Decoding in IRTGs means finding a joint parse for Objects in from a subset of the Interpretations and then mapping that joint parse into one of the other interpretations.

Code

First you will need to write a mapping from the string names of the interpretations used for reading the inputs to the string representations of the inputs. We assume that this mapping is stored in "Map<String,String> input". Then you simply ask your Interpreted Regular Tree Automaton Instance "irtg" to decode this input:

#!java

Set<Object> result = irtg.decode(input);

The return set contains all the objects to which any joint parse for the inputs is mapped. Note that there may be an infinite number of those and in this case the method may not terminate! If you instead just want a decoding of the Viterbi Parse for the inputs, then this will take a little more code:

#!java

TreeAutomaton chart = irtg.parse(input);
Tree<String> best = chart.viterbi();
Object result = irtg.getInterpretation(nameOfDesiredInterpretationForOutput).interpret(best);
Clone this wiki locally