/** * Realise. * * @param wt * the wt * @return the string * @throws XMLRealiserException * the xML realiser exception */ public static string realise(wrapper.XmlDocumentElement wt) { string output = ""; if (wt != null) { try { if (lexicon == null) { lexicon = Lexicon.DefaultLexicon; } UnWrapper w = new UnWrapper(lexicon); DocumentElement t = w.UnwrapDocumentElement(wt); if (t != null) { Realiser r = new Realiser(lexicon); r.initialise(); NLGElement tr = r.realise(t); output = tr.Realisation; } } catch (Exception e) { throw new XMLRealiserException("NLG XMLRealiser Error", e); } } return output; }
/** * Gets the request. * * @param input * the input * @return the request * @throws XMLRealiserException * the xML realiser exception */ public static wrapper.RequestType getRequest(StringReader input) { wrapper.NLGSpec spec = UnWrapper.getNLGSpec(input); wrapper.RequestType request = spec.Request; if (request == null) { throw new XMLRealiserException("Must have Request element"); } return request; }
/** * Gets the recording. * * @param input * the input * @return the recording * @throws XMLRealiserException * the xML realiser exception */ public static wrapper.RecordSet getRecording(StringReader input) { wrapper.NLGSpec spec = UnWrapper.getNLGSpec(input); wrapper.RecordSet recording = spec.Recording; if (recording == null) { throw new XMLRealiserException("Must have Recording element"); } return recording; }