Révision 4024
| TXM/trunk/bundles/org.txm.conllu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImporter.groovy (revision 4024) | ||
|---|---|---|
| 438 | 438 |
for (def word : words) {
|
| 439 | 439 |
|
| 440 | 440 |
String id = null |
| 441 |
String cqpWordValue = word["form"] |
|
| 442 |
int idx = word["form"].indexOf(".", 1);
|
|
| 443 |
if (word["id"].contains("-") && idx > 0) {
|
|
| 444 |
cqpWordValue = word["form"].substring(0, idx) |
|
| 445 |
word["form"] = word["form"].substring(idx+1) |
|
| 446 |
} |
|
| 441 | 447 |
wordCounter++ |
| 442 | 448 |
writer.writeStartElement ("w")
|
| 443 | 449 |
for (String p : word.keySet()) {
|
| ... | ... | |
| 458 | 464 |
writer.writeAttribute("id", "w_"+text_id+"_"+wordCounter)
|
| 459 | 465 |
} |
| 460 | 466 |
|
| 461 |
int idx = word["form"].indexOf(".", 1);
|
|
| 462 |
if (word["id"].contains("-") && idx > 0) {
|
|
| 463 |
writer.writeCharacters(word["form"].substring(0, idx)) |
|
| 464 |
} else {
|
|
| 465 |
writer.writeCharacters(word["form"]) |
|
| 466 |
} |
|
| 467 |
writer.writeCharacters(cqpWordValue) |
|
| 467 | 468 |
writer.writeEndElement() // w |
| 468 | 469 |
writer.writeCharacters(" ")
|
| 469 | 470 |
} |
Formats disponibles : Unified diff