Révision 3487

TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/PrepareTranscriptionsMacro.groovy (revision 3487)
151 151
	if (!fixer.process()) {
152 152
		println "WARNING: ERROR WHILE PROCESSING: "+file
153 153
		if (debug) {println "DEBUG ACTIVATED -> STOP"; return;}
154
		continue;
154 155
	}
155 156
	
157
	File tmpFile2 = new File(resultDirectory, "tmp2.xml")
158
	def spks = new groovy.util.XmlSlurper().parse(tmpFile).Speakers.Speaker.collect(){it.attributes()["id"]}
156 159
	
157
	File tmpFile2 = new File(resultDirectory, "tmp2.xml")
158 160
	for (def replacement : replacements) {
161
	
162
		if (!spks.contains(replacement[0])) continue;
159 163
		
160 164
		RecodeSpeakers fixer2 = new RecodeSpeakers(tmpFile, tmpFile2, replacement[0], null, replacement[1], replacement[1])
161 165
		fixer2.debug = debug
......
163 167
		if (!fixer2.process()) {
164 168
			println "WARNING: ERROR WHILE PROCESSING: "+file
165 169
			if (debug) {println "DEBUG ACTIVATED -> STOP"; return;}
170
			continue
166 171
		}
167 172
		tmpFile.delete(); // This tmp file must be removed for the next operation
168 173
		tmpFile2.renameTo(tmpFile)
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/TextTranscription2TRS.groovy (revision 3487)
56 56
import java.text.ParseException;
57 57
import java.text.SimpleDateFormat;
58 58
import java.util.Date;
59

  
59
/**
60
 * BUGS:
61
 * - n'a pas repéré les timings autour des commentaires
62
 * - a loupé du coup le timing du premier tour du prof : startTime="35.333332" au lieu de (0:00:48.5)
63
 * - a ajouté des sauts de ligne dans les contenus de tour, dommage.
64
 * @author mdecorde
65
 *
66
 */
60 67
class TextTranscription2TRS {
61 68
	boolean debug = false;
62 69
	boolean isDirectory = false;
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/Vocapia2Transcriber.groovy (revision 3487)
81 81
								break;
82 82
							case "Speaker": // <Speaker ch="1" dur="531.38" gender="X" spkid="Enquêtrice" lang="fre" lconf="1.00" nw="1586" tconf="0.95"/> -> <Speaker id="spk1" name="enq4" check="no" dialect="native" accent="" scope="local"/>
83 83
							
84
								String spkid = parser.getAttributeValue(null, "spkid").trim().replaceAll("[\\s\\uFEFF]", "")
84
								String spkid = parser.getAttributeValue(null, "spkid").trim().replaceAll("[\\uFEFF]", "")
85 85
								
86 86
								writer.writeStartElement("Speaker")
87 87
								writer.writeAttribute("id", spkid)
......
122 122
								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
123 123
									String name = parser.getAttributeLocalName(i)
124 124
									String value = parser.getAttributeValue(i)
125
									
125 126
									if (name == "stime") name = "startTime"
126 127
									else if (name == "etime") name = "endTime"
127 128
									else if (name == "spkid") {
128 129
										name = "speaker"
129
										value = value.trim().replaceAll("[\\s()]", "")
130
										value = value.trim().replaceAll("[\\uFEFF]", "")
130 131
									}
131 132
									writer.writeAttribute(name, value)
132 133
								}
......
173 174
							
174 175
							case "SpeakerList": // <SpeakerList> -> <Speakers>
175 176
							
176
								// write additional speakers 
177
								// write additional speakers
177 178
								for (String spkid : additionalSpeakers.keySet()) {
178 179
									writer.writeStartElement("Speaker")
179 180
									writer.writeAttribute("id", spkid)

Formats disponibles : Unified diff