4 package de.uni_hamburg.corpora.conversion;
9 import org.exmaralda.partitureditor.jexmaralda.BasicTranscription;
10 import org.jdom.JDOMException;
11 import org.jdom.transform.XSLTransformException;
12 import org.xml.sax.SAXException;
13 import java.io.FileNotFoundException;
14 import java.io.IOException;
15 import org.exmaralda.partitureditor.jexmaralda.JexmaraldaException;
16 import org.exmaralda.partitureditor.fsm.FSMException;
17 import org.exmaralda.partitureditor.jexmaralda.segment.CHATSegmentation;
18 import org.exmaralda.partitureditor.jexmaralda.ListTranscription;
22 import java.util.Collection;
25 import javax.xml.transform.TransformerException;
26 import javax.xml.parsers.ParserConfigurationException;
27 import net.sf.saxon.trans.XPathException;
28 import javax.xml.xpath.XPathExpressionException;
42 public static final String
EXB2CHAT =
"exb2chat";
62 XSLTransformException,
72 XSLTransformException,
86 String data = exportCHATTranscript(bt,
"UTF-8");
89 cio.write(data, targeturl);
90 stats.
addCorrect(EXB2CHAT, cod,
"Conversion of file was successfully saved at " + targeturl);
91 }
catch (JexmaraldaException je) {
92 stats.
addException(je, EXB2CHAT, cod,
"Input Output Exception");
93 }
catch (FSMException fe) {
94 stats.
addException(fe, EXB2CHAT, cod,
"Input Output Exception");
95 }
catch (SAXException se) {
96 stats.
addException(se, EXB2CHAT, cod,
"Input Output Exception");
97 }
catch (FileNotFoundException fnfe) {
98 stats.
addException(fnfe, EXB2CHAT, cod,
"Input Output Exception");
99 }
catch (IOException ioe) {
100 stats.
addException(ioe, EXB2CHAT, cod,
"Input Output Exception");
101 }
catch (XPathException xe) {
102 stats.
addException(xe, EXB2CHAT, cod,
"Input Output Exception");
103 }
catch (XPathExpressionException xee) {
104 stats.
addException(xee, EXB2CHAT, cod,
"Input Output Exception");
105 }
catch (ParserConfigurationException pe) {
106 stats.
addException(pe, EXB2CHAT, cod,
"Input Output Exception");
107 }
catch (TransformerException te) {
108 stats.
addException(te, EXB2CHAT, cod,
"Input Output Exception");
121 Class cl = Class.forName(
"de.uni_hamburg.corpora.BasicTranscriptionData");
123 }
catch (ClassNotFoundException ex) {
133 String exportCHATTranscript(BasicTranscription bt, String encoding)
134 throws JexmaraldaException, FSMException, SAXException,
135 FileNotFoundException, IOException {
137 CHATSegmentation segmenter =
new org.exmaralda.partitureditor.jexmaralda.segment.CHATSegmentation();
138 ListTranscription lt = segmenter.BasicToUtteranceList(bt);
139 String text = CHATSegmentation.toText(lt);
145 String description =
"This class takes an exb as input and converts it into CHAT format. ";
String getFilenameWithoutFileEnding()
String toSaveableString()
Collection< Class<?extends CorpusData > > getIsUsableFor()
Report convert(CorpusData cod)
static BasicTranscription String2BasicTranscription(String btAsString)
void addCorrect(String statId, String description)
static final String EXB2CHAT
void addException(Throwable e, String description)