Révision 2395
| tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/compiler.groovy (revision 2395) | ||
|---|---|---|
| 220 | 220 |
|
| 221 | 221 |
String[] pAttributes = pargs |
| 222 | 222 |
|
| 223 |
String[] sAttributes = ["txmcorpus:0+lang", uAttr , textAttr, "event:0+id+desc+type+extent", sectionAttr, "sp:0+id+speaker+endtime+starttime+overlap+time"];
|
|
| 223 |
String[] sAttributes = ["txmcorpus:0+lang", uAttr , textAttr, "event:0+id+desc+type+extent", sectionAttr, "sp:0+id+speaker+end+start+overlap+time"];
|
|
| 224 | 224 |
|
| 225 | 225 |
println "pAttributes: $pAttributes" |
| 226 | 226 |
println "sAttributes: $sAttributes" |
| ... | ... | |
| 393 | 393 |
else if (parser.getAttributeValue(null, "extent") == "end") |
| 394 | 394 |
events.remove(parser.getAttributeValue(null, "desc")) |
| 395 | 395 |
vEvents = ""; |
| 396 |
for (String s : events) |
|
| 396 |
for (String s : events) {
|
|
| 397 | 397 |
vEvents += s+"#"; |
| 398 |
if (vEvents.length() > 0) |
|
| 398 |
} |
|
| 399 |
if (vEvents.length() > 0) {
|
|
| 399 | 400 |
vEvents = vEvents.substring(0, vEvents.length()-1); |
| 400 |
else
|
|
| 401 |
} else {
|
|
| 401 | 402 |
vEvents = "" |
| 403 |
} |
|
| 402 | 404 |
} |
| 403 | 405 |
break; |
| 404 | 406 |
case "w": |
| ... | ... | |
| 602 | 604 |
this.ignoreTranscriberMetadata = state; |
| 603 | 605 |
} |
| 604 | 606 |
|
| 607 |
public static int MAXATTRIBUTEVALUELENGTH = 8191; |
|
| 605 | 608 |
/** |
| 606 | 609 |
* Parses the infos. |
| 607 | 610 |
*/ |
| ... | ... | |
| 615 | 618 |
case "text": |
| 616 | 619 |
output.write("<text project=\""+projectname+"\" base=\""+corpusname+"\"")
|
| 617 | 620 |
for (int i = 0 ; i < parser.getAttributeCount() ; i ++) {
|
| 621 |
|
|
| 622 |
String value = parser.getAttributeValue(i).replace("\"", """);
|
|
| 623 |
if (value.length() > MAXATTRIBUTEVALUELENGTH) {
|
|
| 624 |
// value = value.substring(0, MAXATTRIBUTEVALUELENGTH-1) |
|
| 625 |
println "WARNING: attribute value is too long ( > $MAXATTRIBUTEVALUELENGTH). The value will be truncated to: $value" |
|
| 626 |
} |
|
| 627 |
|
|
| 618 | 628 |
if (ignoreTranscriberMetadata) {
|
| 619 | 629 |
if (parser.getAttributeLocalName(i) != "scribe" && |
| 620 | 630 |
parser.getAttributeLocalName(i) != "audio_filename" && |
| 621 | 631 |
parser.getAttributeLocalName(i) != "version" && |
| 622 |
parser.getAttributeLocalName(i) != "version_date") |
|
| 623 |
output.write(" "+parser.getAttributeLocalName(i).replace("_","").toLowerCase()+"=\""+parser.getAttributeValue(i)+"\"");
|
|
| 632 |
parser.getAttributeLocalName(i) != "version_date") {
|
|
| 633 |
output.write(" "+parser.getAttributeLocalName(i).replace("_","").toLowerCase()+"=\""+value+"\"");
|
|
| 634 |
} |
|
| 624 | 635 |
} else {
|
| 625 |
output.write(" "+parser.getAttributeLocalName(i).replace("_","").toLowerCase()+"=\""+parser.getAttributeValue(i)+"\"");
|
|
| 636 |
output.write(" "+parser.getAttributeLocalName(i).replace("_","").toLowerCase()+"=\""+value+"\"");
|
|
| 626 | 637 |
} |
| 627 | 638 |
} |
| 628 | 639 |
|
Formats disponibles : Unified diff