Révision 3421
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/AddSectionsFromTableMacro.groovy (revision 3421) | ||
---|---|---|
223 | 223 |
trsSection = trsSections[0] |
224 | 224 |
|
225 | 225 |
turns = trsSection.Turn |
226 |
newSections = [] |
|
227 | 226 |
iSection = 0; |
228 | 227 |
currentSection = null |
229 | 228 |
currentNode = null |
... | ... | |
234 | 233 |
|
235 | 234 |
// boucle sur les tours dans l'ordre |
236 | 235 |
for (iTurn = 0 ; iTurn < turns.size() ; iTurn++) { |
237 |
if (debug) println "iTurn=$iTurn turn="+turns[iTurn].attributes() |
|
236 |
if (debug) println "iTurn=$iTurn turn="+turns[iTurn].attributes()+" iSection=$iSection ("+sections[iSection][0]+", "+sections[iSection][1]+")"
|
|
238 | 237 |
turn = turns[iTurn] |
239 | 238 |
start = Float.parseFloat(turn.@startTime) |
240 | 239 |
end = Float.parseFloat(turn.@endTime) |
... | ... | |
277 | 276 |
// (on ne gère qu'un seul tour et un seul noeud à chaque itération de la boucle tour, |
278 | 277 |
// puisqu'on a retaillé le tour pour qu'il ne concerne pas plusieurs noeuds) |
279 | 278 |
if (foundSection != null) { // on complète ou on ajoute une div. |
280 |
|
|
279 |
if (debug) println "found iSection=$iSection ("+sections[iSection][0]+", "+sections[iSection][1]+")" |
|
281 | 280 |
if (foundSection != currentSection || currentSection == null) { |
282 | 281 |
if (currentNode != null && currentNode.@synchronized == "false") { |
283 | 282 |
def tmp = currentNode.Turn |
... | ... | |
287 | 286 |
currentSection = foundSection |
288 | 287 |
currentNode = new Node(trsEpisode, "Section", currentSection[2]) |
289 | 288 |
if (debug) println " create synchronized turn at start="+foundSection[0] |
290 |
} |
|
289 |
}
|
|
291 | 290 |
} else { // on complète ou on ajoute un noeud (div) non synchronisé. |
291 |
if (debug) println "not synchronized with current iSection=$iSection ("+sections[iSection][0]+", "+sections[iSection][1]+")" |
|
292 | 292 |
if (currentSection != null || currentNode == null) { // create a new unsynchronized section if there is no opened synchronized section or no un-synchronized section |
293 | 293 |
currentNode = new Node(trsEpisode, "Section", ["type":"Sujet non synchronisé", "startTime":turn.@startTime, "endTime":"", "synchronized":"false"] ) |
294 | 294 |
currentSection = null; |
... | ... | |
298 | 298 |
|
299 | 299 |
// Etape 3 : on coupe le tour s'il y a besoin |
300 | 300 |
if (cutCheck && fixTurnsLimits) { |
301 |
if (debug) println " fixing turn in turns ("+turns.size()+") section ("+trsSection.children().size()+")"
|
|
301 |
if (debug) println " fixing current turn iTurn=$iTurn ($start, $end) )in turns ("+turns.size()+") section ("+trsSection.children().size()+")"
|
|
302 | 302 |
if (isTurnSynchronized) { |
303 | 303 |
cutTurn(true) // iSection++ et test avec le **end** de la section quand on coupe |
304 | 304 |
} else { |
... | ... | |
308 | 308 |
} |
309 | 309 |
} |
310 | 310 |
|
311 |
if (debug) println " remove turn in turns ("+turns.size()+") section ("+trsSection.children().size()+")"
|
|
312 |
turns.remove(turn) |
|
311 |
if (debug) println " remove turn in initial section ("+trsSection.children().size()+" remaining turns before removing this one)"
|
|
312 |
//turns.remove(turn)
|
|
313 | 313 |
trsSection.remove(turn) |
314 | 314 |
currentNode.append(turn) |
315 |
if (debug) println " removed turn in turns ("+turns.size()+") section ("+trsSection.children().size()+")" |
|
315 |
//if (debug) println " removed turn in turns ("+turns.size()+") section ("+trsSection.children().size()+")"
|
|
316 | 316 |
} |
317 | 317 |
|
318 | 318 |
trsEpisode.remove(trsSection) |
... | ... | |
346 | 346 |
if (endSection instanceof String) endSection = Float.parseFloat(sections[iSection][1]) //currentNode.@endTime) |
347 | 347 |
//println "Cut the last turn if necessary" |
348 | 348 |
|
349 |
if (debug) println " cut turn and test with end ? $testWithSectionEndTime of iSection=$iSection at iTurn=$iTurn start=${turn.@startTime} end=${turn.@endTime} children="+turn.children().size()
|
|
349 |
if (debug) println " cut turn and test with end ? $testWithSectionEndTime of iSection=$iSection ($startSection, $endSection) at iTurn=$iTurn (${turn.@startTime}, ${turn.@endTime}) children="+turn.children().size()
|
|
350 | 350 |
for (int iChildren = 0 ; iChildren < children.size() ; iChildren++) { |
351 | 351 |
|
352 | 352 |
def c = children[iChildren] |
... | ... | |
374 | 374 |
newTurnKaNode = new Node(trsSection, "Turn", ["startTime":""+start2, "endTime":""+turn.@endTime, "speaker":turn.@speaker]) |
375 | 375 |
new Node(newTurnKaNode, "Sync", ["time":""+start2]) // TRS |
376 | 376 |
|
377 |
turns.add(iTurn, newTurnKaNode) // set as next turn to process |
|
377 |
turns.add(iTurn+1, newTurnKaNode) // set as next turn to process
|
|
378 | 378 |
iTurn-- |
379 | 379 |
if (debug) newTurnKaNode.@created = "yes" |
380 | 380 |
turn.@endTime = ""+start2; |
... | ... | |
399 | 399 |
if (test) { // && Math.abs(start2 - endSection) > turnsCutActivationThreashold |
400 | 400 |
if (debug) println " cut with a Sync at ($start2, $end2) for section ("+startSection+", "+endSection+")" |
401 | 401 |
newTurnKaNode = new Node(trsSection, "Turn", ["startTime":""+start2, "endTime":""+turn.@endTime, "speaker":turn.@speaker]) |
402 |
turns.add(iTurn, newTurnKaNode) |
|
402 |
turns.add(iTurn+1, newTurnKaNode)
|
|
403 | 403 |
iTurn-- |
404 | 404 |
if (debug) newTurnKaNode.@created = "yes" |
405 | 405 |
turn.@endTime = ""+start2; |
Formats disponibles : Unified diff