Révision 2932
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 2932) | ||
---|---|---|
2374 | 2374 |
|
2375 | 2375 |
|
2376 | 2376 |
try { |
2377 |
|
|
2378 | 2377 |
// compute the parent if needed |
2379 | 2378 |
if (this.parent != null && !(this.parent instanceof Project) && !(this.parent instanceof Workspace) |
2380 | 2379 |
&& !this.parent.isComputing()) { |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/transcription/FixINATRS.groovy (revision 2932) | ||
---|---|---|
1 |
import org.txm.utils.ConsoleProgressBar |
|
2 |
import org.kohsuke.args4j.* |
|
3 |
import groovy.transform.Field |
|
4 |
import org.txm.rcp.swt.widget.parameters.* |
|
5 |
|
|
6 |
@Field @Option(name="trsDirectory", usage="Dossier qui contient les fichiers TRS à corriger", widget="Folder", required=true, def="AF") |
|
7 |
def trsDirectory |
|
8 |
|
|
9 |
if (!ParametersDialog.open(this)) return; |
|
10 |
|
|
11 |
println "Fixing $trsDirectory" |
|
12 |
def files = trsDirectory.listFiles() |
|
13 |
ConsoleProgressBar cpb = new ConsoleProgressBar(files.size()) |
|
14 |
for (File trsFile : files) { |
|
15 |
//File trsFile = new File(directory, "AFE86004868.trs") |
|
16 |
cpb.tick() |
|
17 |
if (!trsFile.getName().endsWith(".trs")) { |
|
18 |
continue; |
|
19 |
} |
|
20 |
String content = trsFile.getText("UTF-8") |
|
21 |
content = content.replaceAll("punct=\"([^\"]+)\"\">", "punct=\"\$1\">") |
|
22 |
content = content.replaceAll("<unk>", "???") |
|
23 |
content = content.replaceAll(" Time=\"", " time=\"") |
|
24 |
trsFile.setText(content, "UTF-8") |
|
25 |
} |
|
26 |
cpb.done() |
|
27 |
println "Done" |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/transcription/BuildAFMetadataMacro.groovy (revision 2932) | ||
---|---|---|
46 | 46 |
columnsToCopy.put("Notes du titre", "subtitle"); |
47 | 47 |
columnsToCopy.put("Titre propre", "title"); |
48 | 48 |
columnsToCopy.put("Date de diffusion", "textorder"); |
49 |
columnsToCopy.put("Date de diffusion", "annee"); |
|
49 |
//columnsToCopy.put("Date de diffusion", "annee");
|
|
50 | 50 |
|
51 | 51 |
searchAndReplaceRules.put("textorder", ["([0-9][0-9])/([0-9][0-9])/([0-9][0-9][0-9][0-9])", '$3$2$1'] as String[]); // not working yet |
52 | 52 |
searchAndReplaceRules.put("annee", ["([0-9][0-9])/([0-9][0-9])/([0-9][0-9][0-9][0-9])", '$3'] as String[]); // not working yet |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/transcription/FixINATRSMacro.groovy (revision 2932) | ||
---|---|---|
1 |
import org.txm.utils.ConsoleProgressBar |
|
2 |
import org.kohsuke.args4j.* |
|
3 |
import groovy.transform.Field |
|
4 |
import org.txm.rcp.swt.widget.parameters.* |
|
5 |
|
|
6 |
@Field @Option(name="trsDirectory", usage="Dossier qui contient les fichiers TRS à corriger", widget="Folder", required=true, def="AF") |
|
7 |
def trsDirectory |
|
8 |
|
|
9 |
if (!ParametersDialog.open(this)) return; |
|
10 |
|
|
11 |
println "Fixing $trsDirectory" |
|
12 |
def files = trsDirectory.listFiles() |
|
13 |
ConsoleProgressBar cpb = new ConsoleProgressBar(files.size()) |
|
14 |
for (File trsFile : files) { |
|
15 |
//File trsFile = new File(directory, "AFE86004868.trs") |
|
16 |
cpb.tick() |
|
17 |
if (!trsFile.getName().endsWith(".trs")) { |
|
18 |
continue; |
|
19 |
} |
|
20 |
String content = trsFile.getText("UTF-8") |
|
21 |
content = content.replaceAll("punct=\"([^\"]+)\"\">", "punct=\"\$1\">") |
|
22 |
content = content.replaceAll("<unk>", "???") |
|
23 |
content = content.replaceAll(" Time=\"", " time=\"") |
|
24 |
trsFile.setText(content, "UTF-8") |
|
25 |
} |
|
26 |
cpb.done() |
|
27 |
println "Done" |
Formats disponibles : Unified diff