Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/FixTranscription.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/FixTranscription.groovy	(revision 0)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/FixTranscription.groovy	(revision 3016)
@@ -0,0 +1,170 @@
+package org.txm.macro.projects.nov13
+
+import javax.xml.stream.*
+
+import org.txm.importer.PersonalNamespaceContext
+import org.txm.xml.IdentityHook
+import org.txm.xml.*
+
+import java.io.BufferedOutputStream
+import java.io.FileOutputStream
+import java.io.IOException
+import java.net.URL
+import java.util.*
+import java.util.Map.Entry
+import java.util.regex.Pattern
+
+class FixTranscription extends XMLProcessor {
+	
+	LocalNamesHookActivator activator;
+	IdentityHook hook;
+	
+	public FixTranscription(File xmlfile) {
+		super(xmlfile)
+		
+		activator = new LocalNamesHookActivator<>(hook, ["w", "Turn", "Sync"]);
+		
+		hook = new IdentityHook("word_hook", activator, this) {
+					
+					boolean inTurn = false;
+					
+					boolean inW = false;
+					StringBuilder wordBuffer = new StringBuilder();
+					
+					String currentTime;
+					LinkedHashMap turnInfos = new LinkedHashMap()
+					LinkedHashMap wInfos = new LinkedHashMap()
+					boolean other
+					
+					@Override
+					public boolean deactivate() {
+						return true;
+					}
+					
+					@Override
+					public boolean _activate() {
+						return true;
+					}
+					
+					@Override
+					protected void processStartElement() throws XMLStreamException, IOException {
+						if (localname.equals("Turn")) {
+							// store values
+							inTurn = true;
+							turnInfos.clear()
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+								turnInfos[parser.getAttributeLocalName(i)] = parser.getAttributeValue(i)
+							}
+							currentTime = turnInfos["startTime"]
+							super.processStartElement();
+						} else if (localname.equals("Sync")) {
+							currentTime = parser.getAttributeValue(null, "time")
+							super.processStartElement();
+						} else if (localname.equals("w")) {
+							// store values
+							inW = true;
+							wInfos.clear()
+							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+								wInfos[parser.getAttributeLocalName(i)] = parser.getAttributeValue(i)
+							}
+							String time = parser.getAttributeValue(null, "time")
+							if (time != null && time.length() > 0) {
+								currentTime = time
+							}
+							wordBuffer.setLength(0);
+							return; // write w later
+						}
+						else {
+							super.processStartElement();
+						}
+					}
+					
+					@Override
+					protected void processCharacters() throws XMLStreamException {
+						if (inW) {
+							wordBuffer.append(parser.getText())
+						}
+						else {
+							super.processCharacters();
+						}
+					}
+					
+					@Override
+					protected void processEndElement() throws XMLStreamException {
+						if (localname.equals("w")) {
+							
+							inW = false
+							String word = wordBuffer.toString().trim()
+							if (!other && word.startsWith("*")) {
+								//close current Turn and start a 'other' Turn
+								writer.writeEndElement() // current Turn
+								writer.writeCharacters("\n")
+								
+								def tmpInfos = new LinkedHashMap()
+								for (String attr : turnInfos.keySet()) tmpInfos[attr] = turnInfos[attr]
+								tmpInfos["orig-speaker"] = turnInfos["speaker"]
+								tmpInfos["speaker"] = "other"
+								tmpInfos["startTime"] = currentTime
+								writer.writeStartElement("Turn")
+								for (String attr : tmpInfos.keySet()) {
+									writer.writeAttribute(attr, tmpInfos[attr])
+								}
+								
+								other = true
+								word = word.substring(1)
+							}
+							
+							boolean shouldCloseOtherTurn = false;
+							if (other && word.endsWith("*")) {
+								shouldCloseOtherTurn = true;
+								
+								word = word.substring(0, word.length()-1)
+								other = false
+							}
+							
+							if ("XXX".equals(word)) { // <Event desc="XXX" type="unknown" extent="next"/>
+								writer.writeStartElement("event") // start the initial word
+								writer.writeAttribute("desc", "XXX from "+wInfos["start"] + " to "+wInfos["end"])
+								writer.writeAttribute("type", "unknown")
+								writer.writeAttribute("extent", "instantaneous")
+								writer.writeEndElement() // event
+								word = "" // don't write the word
+							}
+														
+							if (word.length() > 0) {
+								
+								writer.writeStartElement("w") // start the initial word
+								for (String attr : wInfos.keySet() ) {
+									writer.writeAttribute(attr, wInfos[attr])
+								}
+								writer.writeCharacters(word)
+								writer.writeEndElement() // w
+							}
+						
+							if (shouldCloseOtherTurn) {
+								shouldCloseOtherTurn = false;
+								//close the current 'other' Turn and restart the actual Turn
+								writer.writeEndElement() // current 'other' Turn
+								
+								writer.writeStartElement("Turn") // rebuild the orig Turn and fix its start-end infos
+								turnInfos["startTime"] = wInfos["end"] // fix the startTime using the current word end time
+								for (String attr : turnInfos.keySet()) {
+									writer.writeAttribute(attr, turnInfos[attr])
+								}
+								
+								other = false
+							}
+						} else {
+							super.processEndElement();
+						}
+					}
+				}
+	}
+	
+	public static void main(String[] args) {
+		File infile = new File("/home/mdecorde/xml/vocapia","test.trs")
+		File outfile = new File("/home/mdecorde/xml/vocapia","test-fixed.trs")
+		def processor = new FixTranscription(infile, true)
+		println processor.process(outfile)
+	}
+}
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/FixTranscriptionsMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/FixTranscriptionsMacro.groovy	(revision 0)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/FixTranscriptionsMacro.groovy	(revision 3016)
@@ -0,0 +1,59 @@
+package org.txm.macro.projects.nov13
+
+import java.time.LocalTime
+import java.time.format.DateTimeFormatter
+import org.txm.utils.*
+import org.txm.utils.logger.*
+
+@Field @Option(name="trsFile", usage="A single vocapia XML file", widget="FileOpen", required=false, def="")
+		File trsFile;
+
+@Field @Option(name="trsDirectory", usage="A Vocapia XML files directory to process", widget="Folder", required=false, def="")
+		File trsDirectory;
+
+@Field @Option(name="resultDirectory", usage="The result directory", widget="Folder", required=false, def="")
+		File resultDirectory;
+
+if (!ParametersDialog.open(this)) return;
+
+if (resultDirectory.equals(trsDirectory) || (trsFile != null && trsFile.getParentFile().equals(resultDirectory))) {
+	return false;
+}
+
+resultDirectory.mkdirs();
+
+def trsFiles = []
+if (trsDirectory != null && trsDirectory.exists()) {
+	
+	println "Processing TRS directory: $trsDirectory"
+	for (File file : trsDirectory.listFiles()) {
+		if (file.getName().toLowerCase().endsWith(".trs")) {
+			trsFiles << file
+		}
+	}
+} else if (trsFile != null && trsFile.exists()) {
+	println "Processing TRS file: $trsFile"
+	trsFiles << trsFile
+}
+
+if (trsFiles.size() == 0) {
+	println "No XML file found for parameters trsFile=$trsFile and trsDirectory=$trsDirectory"
+	return false
+}
+
+ConsoleProgressBar cpb = new ConsoleProgressBar(trsFiles.size())
+for (File file : trsFiles) {
+	cpb.tick()
+	FixTranscription fixer = new FixTranscription(file)
+	String name = FileUtils.stripExtension(file)
+	File outFile = new File(resultDirectory, name+".trs")
+	
+	if (!fixer.process(outFile)) {
+		println "WARNING: ERROR WHILE PROCESSING: "+file
+		return false
+	}
+}
+cpb.done()
+
+println "Done: "+trsFiles.size()+" files processed. Result files in $resultDirectory"
+
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/Vocapia2Transcriber.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/Vocapia2Transcriber.groovy	(revision 3015)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/Vocapia2Transcriber.groovy	(revision 3016)
@@ -20,7 +20,7 @@
 		this.xmlfile = xmlfile;
 	}
 	
-	public boolean process(File outfile, boolean retokenizeWords) {
+	public boolean process(File outfile) {
 		
 		if (!xmlfile.exists()) return false;
 		
@@ -172,23 +172,7 @@
 							
 							// split before the word
 								def puncts = []
-								if (retokenizeWords) {
-									
-									while (word.length() > 0 && word.matches("\\p{Punct}.+")) {
-										puncts << word.substring(0 ,1)
-										word = word.substring(1)
-									}
-									
-									// fix "d'abord" like words
-									Pattern reg = Pattern.compile("([^']+')(.+)")
-									def m = reg.matcher(word)
-									while (word.length() > 0 && m.matches()) {
-										puncts << m.group(1)
-										word = m.group(2)
-										m = reg.matcher(word)
-									}
-								}
-							
+															
 								for (def punct : puncts) { // pre-retokenize if any
 									writer.writeStartElement("w")
 									for (String attr : winfos.keySet()) {
@@ -198,15 +182,7 @@
 									writer.writeEndElement() // w
 									writer.writeCharacters("\n")
 								}
-							
-								puncts = []
-								if (retokenizeWords) {
-									while (word.length() > 0 && word.matches(".+\\p{Punct}")) {
-										puncts.add(0, word.substring(word.length()-1, word.length()))
-										word = word.substring(0, word.length()-1)
-									}
-								}
-							
+														
 								if (word.length() > 0) {
 									writer.writeStartElement("w") // start the initial word
 									for (String attr : winfos.keySet()) {
@@ -216,16 +192,7 @@
 									writer.writeEndElement() // w
 									writer.writeCharacters("\n")
 								}
-							
-								for (String punct : puncts) {  // write post-retokenize if any
-									writer.writeStartElement("w")
-									for (String attr : winfos.keySet()) {
-										writer.writeAttribute(attr, winfos[attr])
-									}
-									writer.writeCharacters(punct)
-									writer.writeEndElement() // w
-									writer.writeCharacters("\n")
-								}
+
 								break
 						}
 						break
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/Vocapia2TranscriberMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/Vocapia2TranscriberMacro.groovy	(revision 3015)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/Vocapia2TranscriberMacro.groovy	(revision 3016)
@@ -13,10 +13,8 @@
 
 @Field @Option(name="resultDirectory", usage="The result directory", widget="Folder", required=false, def="")
 		File resultDirectory;
-		
-@Field @Option(name="retokenize_words", usage="retokenize words prefixed or postfixed with puunctuations", widget="Boolean", required=true, def="true")
-		Boolean retokenize_words;
 
+
 if (!ParametersDialog.open(this)) return;
 
 resultDirectory.mkdirs();
@@ -47,7 +45,7 @@
 	String name = FileUtils.stripExtension(xmlFile)
 	File outFile = new File(resultDirectory, name+".trs")
 	
-	if (!v2t.process(outFile, retokenize_words)) {
+	if (!v2t.process(outFile)) {
 		println "WARNING: ERROR WHILE PROCESSING: "+xmlFile
 		return false
 	}
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZFacsPagerStep.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZFacsPagerStep.groovy	(revision 3015)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZFacsPagerStep.groovy	(revision 3016)
@@ -244,6 +244,7 @@
 		closeMultiWriter()
 		if (parser != null) parser.close();
 		if (inputData != null) inputData.close();
+		
 		pages << [htmlFile, wordid] // add the last page (no pb encountered
 
 		return pages.size() > 1
@@ -303,9 +304,9 @@
 			}
 		}
 		closeMultiWriter()
-		pages << [htmlFile, wordid] // add the last page (no pb encountered
+		pages << [htmlFile, wordid] // add the last page (no pb encountered)
 
-		return pages.size() > 1
+		return pages.size() >= 1
 	}
 
 	public void printStartPage() {
@@ -338,7 +339,7 @@
 	}
 	
 	public static void main(String[] args) {
-		File txmFile = new File("/home/mdecorde/TXM/corpora/BVHEPISTEMON2016/txm/BVHEPISTEMON2016/1546_RabelaisTL.xml")
+		File txmFile = new File(System.getProperty("user.home"), "TXM/corpora/BVHEPISTEMON2016/txm/BVHEPISTEMON2016/1546_RabelaisTL.xml")
 		String txtname = "1532_RabelaisPrnstctn"
 		String corpusname = "BVH"
 		File newEditionDirectory = new File("/tmp/xtzpagertest/")
