Révision 3044
tmp/org.txm.groovy.core/src/java/org/txm/groovy/core/GSERunner.java (revision 3044) | ||
---|---|---|
168 | 168 |
if (b == null) continue; |
169 | 169 |
String name = b.getSymbolicName(); |
170 | 170 |
if (!name.startsWith("org.txm")) continue; // only keep txm plugins (they contains the necessary plugins deps) |
171 |
if (!name.endsWith(".rcp")) continue; // usually TXM *.rcp plugins depends on the *.core plugins
|
|
171 |
if (name.endsWith(".core")) continue; // usually TXM *.rcp plugins depends on the *.core plugins
|
|
172 | 172 |
if (defaultPlugins.contains(name)) continue; |
173 | 173 |
|
174 | 174 |
BundleWiring bundleWiring = b.adapt(BundleWiring.class); |
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImport.groovy (revision 3044) | ||
---|---|---|
78 | 78 |
} |
79 | 79 |
} |
80 | 80 |
|
81 |
println "Sorting texts using the 'textorder' metadata values: "+textorder |
|
81 |
println "Sorting texts using the 'text-order' metadata values: "+textorder
|
|
82 | 82 |
def texts = project.getTextsID(); |
83 | 83 |
Collections.sort(texts, new Comparator<String>() { |
84 | 84 |
public int compare(String f1, String f2) { |
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy (revision 3044) | ||
---|---|---|
233 | 233 |
pagedWriter.writeEndElement() // </head> |
234 | 234 |
pagedWriter.writeCharacters("\n") |
235 | 235 |
pagedWriter.writeStartElement("body") //<body> |
236 |
pagedWriter.writeStartElement("div", ["class": pager.getImportModule().getProject().getName()]) //<div> of the corpus |
|
236 | 237 |
pagedWriter.writeStartElement("div", ["class": "txmeditionpage"]) //<div> |
237 | 238 |
// println "OPENING: $tags" |
238 | 239 |
pagedWriter.writeStartElements(tags) |
... | ... | |
302 | 303 |
def anaResp = "" |
303 | 304 |
def anaValue = new StringBuilder() |
304 | 305 |
|
305 |
boolean flagNote = false; |
|
306 |
String noteContent = ""; |
|
306 |
boolean flagNote = false |
|
307 |
boolean flagW = false |
|
308 |
boolean allTags = true |
|
309 |
String noteContent = "" |
|
310 |
String noteType = "" |
|
307 | 311 |
String rend = "" |
308 | 312 |
goToText(); |
309 | 313 |
|
310 |
String localname = "";
|
|
314 |
String localname = "" |
|
311 | 315 |
if (!createNextOutput()) { |
312 | 316 |
return false; |
313 | 317 |
} |
... | ... | |
334 | 338 |
} |
335 | 339 |
|
336 | 340 |
rend = getAttributeValue(parser, null, "rend") |
337 |
if (rend == null) rend = ""; |
|
341 |
if (rend == null) rend = "none";
|
|
338 | 342 |
|
339 | 343 |
switch (localname) { |
340 | 344 |
case "text": |
... | ... | |
354 | 358 |
pagedWriter.writeStartElement("button", ["class":"collapsible", "onclick":"onCollapsibleClicked(this)"]) |
355 | 359 |
pagedWriter.writeCharacters("➕"); |
356 | 360 |
pagedWriter.writeEndElement() |
361 |
|
|
362 |
pagedWriter.writeStartElement("div", ["class":"collapsiblecontent"]) |
|
357 | 363 |
} |
358 | 364 |
|
359 |
pagedWriter.writeStartElement("table"); |
|
360 |
if (enableCollapsibles && attributes.keySet().size() > 2) pagedWriter.writeAttribute("class", "collapsiblecontent") |
|
365 |
pagedWriter.writeStartElement("table", ["class":"metadata"]);
|
|
366 |
|
|
361 | 367 |
for (String k : attributes.keySet()) { |
362 | 368 |
if (k == "id") continue; |
363 | 369 |
if (k == "rend") continue; |
364 | 370 |
|
371 |
println "open tr" |
|
365 | 372 |
pagedWriter.writeStartElement("tr") |
366 |
pagedWriter.writeElement("td", k) |
|
367 |
pagedWriter.writeElement("td", attributes[k]) |
|
373 |
pagedWriter.writeAttribute("class", "metadata-line") |
|
374 |
pagedWriter.writeElement("td", ["class": "metadata-cell"], k) |
|
375 |
pagedWriter.writeElement("td", ["class": "metadata-cell"], attributes[k]) |
|
368 | 376 |
pagedWriter.writeEndElement() //tr |
369 | 377 |
} |
370 | 378 |
pagedWriter.writeEndElement() // table |
379 |
if (enableCollapsibles && attributes.keySet().size() > 2) { |
|
380 |
pagedWriter.writeEndElement() // div@class=collapsiblecontent |
|
381 |
} |
|
371 | 382 |
pagedWriter.writeEndElement() // p |
372 | 383 |
pagedWriter.writeCharacters("\n") |
373 | 384 |
break; |
... | ... | |
458 | 469 |
case "div4": |
459 | 470 |
case "div5": |
460 | 471 |
pagedWriter.writeStartElement("div", ["class":rend, "type":localname]) |
472 |
pagedWriter.write("\n"); |
|
461 | 473 |
break; |
462 | 474 |
case "lb": |
463 | 475 |
//case "l": |
464 |
pagedWriter.writeEmptyElement("br", ["class":rend]) |
|
476 |
pagedWriter.writeStartElement("br", ["class":rend]) |
|
477 |
pagedWriter.writeEndElement() |
|
465 | 478 |
break; |
466 | 479 |
case wordTag: |
467 | 480 |
wordid = getAttributeValue(parser, null,"id"); |
... | ... | |
475 | 488 |
firstWord = false; |
476 | 489 |
this.idxstart.add(wordid); |
477 | 490 |
} |
478 |
|
|
491 |
flagW = true |
|
479 | 492 |
break; |
480 | 493 |
case "ana": |
481 | 494 |
flaginterp=true; |
... | ... | |
491 | 504 |
if (noteElements.contains(localname)) { |
492 | 505 |
flagNote = true; |
493 | 506 |
noteContent = "" |
507 |
noteType = getAttributeValue(parser, null, "type") |
|
508 |
} else if (allTags && !flagW) { |
|
509 |
pagedWriter.writeStartElement("span", ["class":localname]) |
|
494 | 510 |
} |
495 |
// else { |
|
496 |
// pagedWriter.writeStartElement("span", ["class":localname]) |
|
497 |
// } |
|
498 | 511 |
break; |
499 | 512 |
} |
500 | 513 |
break; |
... | ... | |
515 | 528 |
pagedWriter.writeEndElement() // </p> |
516 | 529 |
pagedWriter.write("\n") |
517 | 530 |
break; |
531 |
case "lb": |
|
532 |
break; |
|
518 | 533 |
case "div": |
519 | 534 |
case "div1": |
520 | 535 |
case "div2": |
... | ... | |
528 | 543 |
pagedWriter.writeEndElement() // </h2> |
529 | 544 |
pagedWriter.write("\n") |
530 | 545 |
break; |
546 |
case "graphic": |
|
547 |
break; |
|
531 | 548 |
case "list": |
532 | 549 |
pagedWriter.writeEndElement() // ul or ol |
533 | 550 |
pagedWriter.write("\n") |
... | ... | |
587 | 604 |
pagedWriter.writeEndElement() |
588 | 605 |
//pagedWriter.writeComment("\n") |
589 | 606 |
lastword=wordvalue; |
607 |
flagW = false |
|
590 | 608 |
break; |
591 | 609 |
default: |
592 | 610 |
if (noteElements.contains(localname)) { |
593 | 611 |
flagNote = false; |
594 | 612 |
if (noteContent.length() > 0) { |
595 | 613 |
notes << noteContent; |
596 |
pagedWriter.writeStartElement("a", ["href":"#note_"+notes.size(), "name":"noteref_"+notes.size(), "title":noteContent]);
|
|
614 |
pagedWriter.writeStartElement("a", ["class": "note", "href":"#note_"+notes.size(), "name":"noteref_"+notes.size(), "title":noteContent, "type":noteType]);
|
|
597 | 615 |
pagedWriter.writeStartElement("sup") |
598 | 616 |
pagedWriter.writeCharacters(""+notes.size()) |
599 | 617 |
pagedWriter.writeEndElement() // </sub> |
600 | 618 |
pagedWriter.writeEndElement() // </a> |
601 | 619 |
} |
620 |
} else if (allTags && !flagW) { |
|
621 |
pagedWriter.writeEndElement() // </span@class=localname> |
|
602 | 622 |
} |
603 | 623 |
// else { |
604 | 624 |
// pagedWriter.writeEndElement() // the element |
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/xmlLoader.groovy (revision 3044) | ||
---|---|---|
91 | 91 |
String ignoredElements = null |
92 | 92 |
boolean stopIfMalformed = false |
93 | 93 |
|
94 |
println "Trying to read import properties file: "+propertyFile
|
|
94 |
println "Reading metadata values from:"+propertyFile
|
|
95 | 95 |
if (propertyFile.exists() && propertyFile.canRead()) { |
96 | 96 |
InputStreamReader input = new InputStreamReader(new FileInputStream(propertyFile) , "UTF-8") |
97 | 97 |
props.load(input) |
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/factiva/factivaLoader.groovy (revision 3044) | ||
---|---|---|
91 | 91 |
String ignoredElements = null; |
92 | 92 |
boolean stopIfMalformed = false; |
93 | 93 |
|
94 |
println "Trying to read import properties file: "+propertyFile
|
|
94 |
println "Reading metadata values from:"+propertyFile
|
|
95 | 95 |
if (propertyFile.exists() && propertyFile.canRead()) { |
96 | 96 |
InputStreamReader input = new InputStreamReader(new FileInputStream(propertyFile) , "UTF-8"); |
97 | 97 |
props.load(input); |
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/pager.groovy (revision 3044) | ||
---|---|---|
351 | 351 |
writer.writeEndElement(); // td |
352 | 352 |
} |
353 | 353 |
//get enqueteur to style their names |
354 |
if (name.equals("out-of-text-to-edit-locutor")) {
|
|
354 |
if (name.equals("interviewer-id-regex")) {
|
|
355 | 355 |
interviewers = /$value/ |
356 | 356 |
} |
357 | 357 |
writer.writeEndElement(); // tr |
... | ... | |
419 | 419 |
break; |
420 | 420 |
case "div": |
421 | 421 |
|
422 |
nbBreak++ |
|
423 |
writer.writeEmptyElement("pb"); |
|
424 |
writer.writeAttribute("id", ""+nbBreak); |
|
425 |
writer.writeCharacters("\n"); |
|
426 | 422 |
|
423 |
|
|
427 | 424 |
if (paginate && paginateSections) { |
425 |
nbBreak++ |
|
426 |
writer.writeEmptyElement("pb"); |
|
427 |
writer.writeAttribute("id", ""+nbBreak); |
|
428 |
writer.writeCharacters("\n"); |
|
429 |
|
|
428 | 430 |
pages << new File(defaultDir, "${txtname}_${nbBreak}.html") |
429 | 431 |
indexes << wordid |
430 | 432 |
} |
... | ... | |
808 | 810 |
|
809 | 811 |
if (interpvalue.contains("rapp1")) { |
810 | 812 |
writer.writeCharacters(" «"); |
811 |
}
|
|
813 |
} |
|
812 | 814 |
|
813 | 815 |
writer.writeStartElement("span"); |
814 | 816 |
writer.writeAttribute("class", "word"); |
... | ... | |
855 | 857 |
} |
856 | 858 |
writer.writeEndElement(); // body |
857 | 859 |
|
858 |
writer.writeEmptyElement("pb"); |
|
859 |
nbBreak++ |
|
860 |
writer.writeAttribute("id", ""+nbBreak); |
|
860 |
if (paginate) { |
|
861 |
writer.writeEmptyElement("pb"); |
|
862 |
nbBreak++ |
|
863 |
writer.writeAttribute("id", ""+nbBreak); |
|
864 |
} |
|
861 | 865 |
|
862 | 866 |
writer.writeEndElement(); // html |
863 | 867 |
writer.close(); |
... | ... | |
876 | 880 |
// println "pages: "+pages |
877 | 881 |
// println "words: "+indexes |
878 | 882 |
|
879 |
|
|
880 | 883 |
if (pages.size() > 1) { |
884 |
|
|
881 | 885 |
for (int i = 1 ; i < nbBreak ; i++) { |
882 | 886 |
ApplyXsl2 a = new ApplyXsl2(xslfile.getAbsolutePath()); |
883 | 887 |
String[] params = ["pbval1", i, "pbval2", i+1]; |
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/transcriberLoader.groovy (revision 3044) | ||
---|---|---|
102 | 102 |
//get metadata values from CSV |
103 | 103 |
Metadatas metadatas; // text metadata |
104 | 104 |
File allMetadataFile = Metadatas.findMetadataFile(srcDir); |
105 |
println "Trying to read metadata values from: "+allMetadataFile
|
|
105 |
println "Reading metadata values from: "+allMetadataFile
|
|
106 | 106 |
if (allMetadataFile.exists()) { |
107 | 107 |
File copy = new File(binDir, allMetadataFile.getName()) |
108 | 108 |
if (!FileCopy.copy(allMetadataFile, copy)) { |
... | ... | |
155 | 155 |
} |
156 | 156 |
for (int i = 0 ; i < trsfiles.size() ; i++) { |
157 | 157 |
File f = trsfiles.get(i); |
158 |
if (!f.getName().endsWith(ext) || !f.canRead() || f.isHidden()) { |
|
158 |
if (!f.getName().endsWith(ext) || !f.canRead() || f.isHidden() || f.isDirectory()) {
|
|
159 | 159 |
trsfiles.remove(i) |
160 | 160 |
i--; |
161 | 161 |
} |
... | ... | |
185 | 185 |
} |
186 | 186 |
} |
187 | 187 |
|
188 |
if (MONITOR != null) MONITOR.worked(5) |
|
189 | 188 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
190 |
println "-- Remove interviewer: "+(!indexInterviewer) |
|
191 |
if (!indexInterviewer) { |
|
192 |
if (metadatas == null || !metadatas.headersList.contains("interviewer-id-regex")) { |
|
193 |
println "Can't remove interviewer without a metadata.csv file defining who are the interviewers. Add the 'interviewer-id-regex' column" |
|
194 |
} else { |
|
195 |
println "Removing some speakers in "+txmDir.listFiles().length+" file(s)" |
|
196 |
for (File infile : txmDir.listFiles()) { |
|
197 |
String filename = FileUtils.stripExtension(infile); |
|
198 |
|
|
199 |
ArrayList<Pair<String, String>> metas = metadatas.get(filename) |
|
200 |
//println "filename=$filename metas= $metas" |
|
201 |
for (Pair p : metas) { |
|
202 |
if (p.getFirst().startsWith("interviewer-id-regex")) { |
|
203 |
new RemoveSpeaker(infile, infile, p.getSecond()) |
|
204 |
} |
|
205 |
} |
|
206 |
} |
|
207 |
} |
|
208 |
} |
|
209 |
|
|
210 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
211 | 189 |
if (MONITOR != null) MONITOR.worked(20, "ANNOTATE") |
212 | 190 |
|
213 | 191 |
boolean annotationSuccess = false; |
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/TranscriberTokenizer.groovy (revision 3044) | ||
---|---|---|
184 | 184 |
/* (non-Javadoc) |
185 | 185 |
* @see filters.Tokeniser.SimpleTokenizerXml#writeWordAttributes() |
186 | 186 |
*/ |
187 |
protected writeWordAttributes() |
|
188 |
{
|
|
189 |
writer.writeAttribute("id","w_"+txtname+"_"+wordcount); |
|
190 |
writer.writeAttribute("audio", audio); |
|
191 |
writer.writeAttribute("event", event); |
|
192 |
writer.writeAttribute("notation", notation); |
|
187 |
protected writeWordAttributes() {
|
|
188 |
super.writeWordAttributes()
|
|
189 |
|
|
190 |
if (!retokenizedWordProperties.containsKey("audio")) writer.writeAttribute("audio", audio);
|
|
191 |
if (!retokenizedWordProperties.containsKey("event")) writer.writeAttribute("event", event);
|
|
192 |
if (!retokenizedWordProperties.containsKey("notation")) writer.writeAttribute("notation", notation);
|
|
193 | 193 |
} |
194 | 194 |
} |
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/compiler.groovy (revision 3044) | ||
---|---|---|
91 | 91 |
|
92 | 92 |
/** The interviewers regex */ |
93 | 93 |
def interviewers = null |
94 |
static HashSet<String> sectionAttrs; |
|
94 |
static LinkedHashSet<String> sectionAttrs; |
|
95 |
static LinkedHashSet<String> spAttrs; |
|
96 |
static LinkedHashSet<String> uAttrs; |
|
95 | 97 |
|
96 | 98 |
/** The anatypes. */ |
97 | 99 |
private static anatypes = [] |
... | ... | |
127 | 129 |
anatypes = ["event"] // reset |
128 | 130 |
anavalues = [:] // reset |
129 | 131 |
|
130 |
sectionAttrs = new HashSet<String>() // reset section attributs set |
|
132 |
sectionAttrs = new LinkedHashSet<String>() // reset section attributs set |
|
133 |
spAttrs = new LinkedHashSet<String>() // reset section attributs set |
|
134 |
uAttrs = new LinkedHashSet<String>() // reset section attributs set |
|
131 | 135 |
|
132 | 136 |
CorpusBuild corpus = project.getCorpusBuild(project.getName(), MainCorpus.class); |
133 | 137 |
if (corpus != null) { |
... | ... | |
192 | 196 |
cwbEn.setDebug(debug); |
193 | 197 |
cwbMa.setDebug(debug); |
194 | 198 |
|
195 |
String uAttr = "u:0+n+spkid+who+scope+accent+start+time+check+dialect+type"; |
|
199 |
String uAttr = "u:0"; |
|
200 |
for (String attr : uAttrs) { |
|
201 |
uAttr += "+"+attr |
|
202 |
} |
|
203 |
|
|
204 |
String spAttr = "sp:0"; |
|
205 |
for (String attr : spAttrs) { |
|
206 |
spAttr += "+"+attr |
|
207 |
} |
|
208 |
|
|
209 |
String sectionAttr = "div:0" // "div:0+id+topic+endtime+starttime+type" |
|
210 |
for (String attr : sectionAttrs) { |
|
211 |
sectionAttr += "+"+attr |
|
212 |
} |
|
213 |
|
|
196 | 214 |
String textAttr ="text:0+base+project" |
197 | 215 |
if (trans != null) { |
198 | 216 |
for (String key : trans.keySet()) { |
199 | 217 |
for (Pair p : trans.get(key)) { |
200 | 218 |
if (ignoreTranscriberMetadata) { |
201 | 219 |
String meta =p.getFirst(); |
202 |
if ( meta != "scribe" && meta != "audio_filename" &&
|
|
203 |
meta != "version" && meta != "version_date") |
|
220 |
if (meta != "scribe" && meta != "audio_filename" && |
|
221 |
meta != "version" && meta != "version_date")
|
|
204 | 222 |
textAttr+="+"+meta |
205 | 223 |
} else { |
206 | 224 |
textAttr+="+"+p.getFirst() |
... | ... | |
210 | 228 |
} |
211 | 229 |
} |
212 | 230 |
|
213 |
String sectionAttr = "div:0" // "div:0+id+topic+endtime+starttime+type" |
|
214 |
for (String attr : sectionAttrs) { |
|
215 |
sectionAttr += "+"+attr |
|
216 |
} |
|
217 |
|
|
218 | 231 |
List<String> pargs = ["spk", "ref", "id", "entitytype", "entityid"] |
219 |
for (String ana : anatypes) pargs.add(ana) |
|
232 |
for (String ana : anatypes) if (!pargs.contains(ana)) pargs.add(ana)
|
|
220 | 233 |
|
221 | 234 |
String[] pAttributes = pargs |
222 | 235 |
|
223 |
String[] sAttributes = ["txmcorpus:0+lang", uAttr , textAttr, "event:0+id+desc+type+extent", sectionAttr, "sp:0+n+who+end+start+overlap+time"];
|
|
236 |
String[] sAttributes = ["txmcorpus:0+lang", uAttr , textAttr, "event:0+id+desc+type+extent", sectionAttr, spAttr];
|
|
224 | 237 |
|
225 | 238 |
println "pAttributes: $pAttributes" |
226 | 239 |
println "sAttributes: $sAttributes" |
... | ... | |
365 | 378 |
break; |
366 | 379 |
case "sp": |
367 | 380 |
output.write("<sp"); |
368 |
writeAttributes(); |
|
381 |
for (int i = 0 ; i < parser.getAttributeCount() ; i ++) { |
|
382 |
String name = parser.getAttributeLocalName(i).replace("_","").toLowerCase() |
|
383 |
output.write(" "+name+"=\""+parser.getAttributeValue(i).replace("\"", """)+"\""); |
|
384 |
spAttrs << name |
|
385 |
} |
|
369 | 386 |
output.write ">\n" |
370 | 387 |
break; |
371 | 388 |
case "u": |
... | ... | |
373 | 390 |
for (int i = 0 ; i < parser.getAttributeCount() ; i ++) { |
374 | 391 |
String name = parser.getAttributeLocalName(i).replace("_","").toLowerCase() |
375 | 392 |
output.write(" "+name+"=\""+parser.getAttributeValue(i).replace("\"", """)+"\""); |
376 |
if (name == "time") formatedTime = parser.getAttributeValue(i) |
|
377 |
else if (name == "who") u_name = parser.getAttributeValue(i) |
|
393 |
if (name == "time") { |
|
394 |
formatedTime = parser.getAttributeValue(i) |
|
395 |
} else if (name == "who") { |
|
396 |
u_name = parser.getAttributeValue(i) |
|
397 |
} |
|
398 |
|
|
399 |
spAttrs << name |
|
378 | 400 |
} |
379 | 401 |
output.write ">\n" |
380 | 402 |
break; |
... | ... | |
510 | 532 |
|
511 | 533 |
vForm = vForm.replaceAll("\n", "").replaceAll("&", "&").replaceAll("<", "<"); |
512 | 534 |
|
513 |
if (!indexInterviewer) {
|
|
514 |
if (!interviewers.matches(u_name)) { |
|
535 |
if (interviewers != null && !indexInterviewer) { // we must remove some words
|
|
536 |
if (!interviewers.matches(u_name)) { // keep what is now an interviewer
|
|
515 | 537 |
output.write(vForm+"\t"+wordid+vAna+"\n"); |
516 | 538 |
} |
517 | 539 |
} else { |
... | ... | |
660 | 682 |
|
661 | 683 |
for (int i = 0 ; i < parser.getAttributeCount() ; i ++) { |
662 | 684 |
list.add(new Pair(parser.getAttributeLocalName(i).replace("_","").toLowerCase(), parser.getAttributeValue(i))); |
663 |
if (parser.getAttributeLocalName(i).equals("out-of-text-to-edit-locutor"))
|
|
685 |
if (parser.getAttributeLocalName(i).equals("interviewer-id-regex"))
|
|
664 | 686 |
interviewers = /${parser.getAttributeValue(i)}/; |
665 | 687 |
} |
666 | 688 |
return |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/TXT2TRS.groovy (revision 3044) | ||
---|---|---|
179 | 179 |
for (String line : lines) { |
180 | 180 |
if (line.indexOf("\t") > 0) { // start of Turn |
181 | 181 |
def split = line.split("\t", 2) |
182 |
def loc = split[0] |
|
182 |
def loc = split[0].replace(" ", "_")
|
|
183 | 183 |
def content = split[1] |
184 | 184 |
|
185 | 185 |
if (currentGroup.size() > 0) {groups << currentGroup} // store previous group |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/RecodeSpeakers.groovy (revision 3044) | ||
---|---|---|
113 | 113 |
} |
114 | 114 |
} |
115 | 115 |
|
116 |
if (debug) println "$nReplace replacements" |
|
116 |
if (debug) println "id=$idRegex or name=$nameRegex -> $nReplace replacements" |
|
117 |
if (nReplace == 0) println "Warning found no replacement for id=$idRegex or name=$nameRegex" |
|
117 | 118 |
|
118 | 119 |
// Création de la source DOM |
119 | 120 |
Source source = new DOMSource(doc); |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/SegmentTRSInSectionFromMarkerMacro.groovy (revision 3044) | ||
---|---|---|
86 | 86 |
def previousSection = trsSection |
87 | 87 |
def currentSection = trsSection |
88 | 88 |
|
89 |
def nFound = 0 |
|
90 |
|
|
89 | 91 |
for (int iTurn = 0 ; iTurn < turns.size() ; iTurn++) { |
90 | 92 |
def turn = turns[iTurn] |
91 | 93 |
def previousTurn = turn |
... | ... | |
125 | 127 |
newTurn.attributes()["startTime"] = start |
126 | 128 |
turn.attributes()["endTime"] = start |
127 | 129 |
|
130 |
nFound++ |
|
131 |
|
|
128 | 132 |
} |
129 | 133 |
|
130 | 134 |
children.remove(i) // remove the mark |
... | ... | |
142 | 146 |
currentSection.append(turn) |
143 | 147 |
} |
144 | 148 |
|
149 |
if (nFound == 0) { |
|
150 |
println "** $trsFile : aucun marqueur '$newSectionMarker' trouvé." |
|
151 |
} |
|
152 |
|
|
145 | 153 |
resultDirectory.mkdir() |
146 | 154 |
File outfile = new File(resultDirectory, trsFile.getName()) |
147 | 155 |
outfile.withWriter("UTF-8") { writer -> |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/importer/XTZImporterMacro.groovy (revision 3044) | ||
---|---|---|
143 | 143 |
String ignoredElements = null; |
144 | 144 |
boolean stopIfMalformed = false; |
145 | 145 |
|
146 |
println "Trying to read import properties file: "+propertyFile
|
|
146 |
println "Reading metadata values from:"+propertyFile
|
|
147 | 147 |
if (propertyFile.exists() && propertyFile.canRead()) { |
148 | 148 |
InputStreamReader input = new InputStreamReader(new FileInputStream(propertyFile) , "UTF-8"); |
149 | 149 |
props.load(input); |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/CreateTheOtherTurns.groovy (revision 3044) | ||
---|---|---|
143 | 143 |
|
144 | 144 |
if (m1.matches()) { |
145 | 145 |
if (other) { |
146 |
println "Warning at "+getLocation()+" with $word: Found a starting * when one 'other' have been started at "+previousOtherStarting |
|
146 |
println "Warning at "+getLocation(true, false, false)+" with $word: Found a starting * when one 'other' have been started at "+previousOtherStarting
|
|
147 | 147 |
} else { |
148 |
if (debug) println "- ligne "+parser.getLocation().getLine()+" : ouverture de other avec '$word' -> tours '$turnInfos'" |
|
148 |
if (debug) println "- ligne "+parser.getLocation().getLineNumber()+" : ouverture de other avec '$word' -> tours '$turnInfos'"
|
|
149 | 149 |
//close current Turn and start a 'other' Turn |
150 |
previousOtherStarting = ["word="+word+ " location="+getLocation()] |
|
150 |
previousOtherStarting = ["word="+word+ " location="+getLocation(true, false, false)]
|
|
151 | 151 |
String group1 = m1.group(1) |
152 | 152 |
if (group1.length() > 0) { |
153 | 153 |
writeWord(group1) |
... | ... | |
173 | 173 |
} |
174 | 174 |
writer.writeCharacters("\n") |
175 | 175 |
|
176 |
writer.writeStartElement("Sync") |
|
177 |
writer.writeAttribute("time", tmpInfos["startTime"]) |
|
178 |
writer.writeCharacters("\n") |
|
179 |
writer.writeEndElement() |
|
180 |
|
|
176 | 181 |
other = true |
177 | 182 |
word = m1.group(2) |
178 | 183 |
} |
... | ... | |
181 | 186 |
boolean shouldCloseOtherTurn = false; |
182 | 187 |
def m2 = word =~ endOtherReg |
183 | 188 |
if (m2.matches()) { |
184 |
if (debug) println "- ligne "+parser.getLocation().getLine()+" : fermeture de other avec '$word' -> tours '$turnInfos'" |
|
185 |
previousOtherStarting = ["word="+word+ " location="+getLocation()] |
|
189 |
if (debug) println "- ligne "+parser.getLocation().getLineNumber()+" : fermeture de other avec '$word' -> tours '$turnInfos'"
|
|
190 |
previousOtherStarting = ["word="+word+ " location="+getLocation(true, false, false)]
|
|
186 | 191 |
if (other) { |
187 | 192 |
shouldCloseOtherTurn = true; |
188 | 193 |
|
189 | 194 |
word = m2.group(1) |
190 | 195 |
other = false |
191 | 196 |
} else { |
192 |
println "Warning at "+getLocation()+" with $word: Found a closing * when one 'other' have been closed at "+previousOtherStarting |
|
197 |
println "Warning at "+getLocation(true, false, false)+" with $word: Found a closing * when one 'other' have been closed at "+previousOtherStarting
|
|
193 | 198 |
} |
194 | 199 |
} |
195 | 200 |
|
... | ... | |
212 | 217 |
} |
213 | 218 |
writer.writeCharacters("\n") |
214 | 219 |
|
220 |
writer.writeStartElement("Sync") |
|
221 |
writer.writeAttribute("time", turnInfos["startTime"]) |
|
222 |
writer.writeCharacters("\n") |
|
223 |
writer.writeEndElement() |
|
224 |
|
|
215 | 225 |
if (m2.group(2).length() > 0) { |
216 | 226 |
writeWord(m2.group(2)) |
217 | 227 |
} |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/PrepareTranscriptionsMacro.groovy (revision 3044) | ||
---|---|---|
72 | 72 |
for (File file : trsFiles) { |
73 | 73 |
|
74 | 74 |
if (debug) println "== $file ==" |
75 |
else cpb.tick() |
|
75 |
//else cpb.tick()
|
|
76 | 76 |
|
77 | 77 |
CreateTheOtherTurns fixer = new CreateTheOtherTurns(file, primarySpeakerIdRegex, otherNonPrimarySpeakerId, debug) |
78 | 78 |
String name = FileUtils.stripExtension(file) |
... | ... | |
85 | 85 |
} |
86 | 86 |
cpb.done() |
87 | 87 |
|
88 |
println "CONVERTIGN WORD MARKERS TO EVENTS..."
|
|
88 |
println "CONVERTING WORD MARKERS TO EVENTS..."
|
|
89 | 89 |
|
90 | 90 |
trsFiles = otherDirectory.listFiles().findAll(){it.getName().toLowerCase().endsWith(".trs")} |
91 | 91 |
if (trsFiles.size() == 0) { |
Formats disponibles : Unified diff