Révision 2230
| tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy (revision 2230) | ||
|---|---|---|
| 49 | 49 |
|
| 50 | 50 |
def xmlFiles = [] // the TIGER XML files |
| 51 | 51 |
if (!master.exists() ) {
|
| 52 |
master = new File(sourceDirectory, "master.xml") |
|
| 53 |
} |
|
| 54 |
if (!master.exists() ) {
|
|
| 52 |
println "No main.xml ($master) file found, trying to find a proper TIGER XML file." |
|
| 55 | 53 |
// master = new File(sourceDirectory, "main.xml") |
| 56 | 54 |
// String subcorpora = ""; |
| 57 | 55 |
xmlFiles = sourceDirectory.listFiles(new FileFilter() {
|
| ... | ... | |
| 76 | 74 |
isSuccessFul = false; |
| 77 | 75 |
return; |
| 78 | 76 |
} |
| 79 |
println "No TIGER XML 'main.xml' file found. Using $xmlFiles as TIGER XML source file "
|
|
| 77 |
println "Using ${xmlFiles.get(0)} as TIGER XML source file ".
|
|
| 80 | 78 |
|
| 81 | 79 |
} else { // parse the master file
|
| 82 | 80 |
for (def s : new XmlSlurper().parse(master).body.subcorpus) {
|
| 83 | 81 |
String name = ""+s.@external |
| 84 | 82 |
if (name.startsWith("file:")) {
|
| 85 |
xmlFiles << new File(sourceDirectory, name.substring(5)) |
|
| 83 |
File f = new File(sourceDirectory, name.substring(5)); |
|
| 84 |
if (f.exists()) {
|
|
| 85 |
xmlFiles << f |
|
| 86 |
} else {
|
|
| 87 |
println "Warning: $name referenced file was nto found: $f" |
|
| 88 |
} |
|
| 86 | 89 |
} |
| 87 | 90 |
} |
| 88 | 91 |
|
| ... | ... | |
| 99 | 102 |
|
| 100 | 103 |
File xmltxmSrcDir = new File(binaryDirectory, "src"); // output directory of the TS XSL transformation |
| 101 | 104 |
xmltxmSrcDir.mkdirs(); |
| 102 |
println "Main.xml files: "+xmlFiles
|
|
| 103 |
println "N="+xmlFiles.size()
|
|
| 105 |
if (master.exists()) println "TIGER MAIN file: $master"
|
|
| 106 |
println "TIGER XML files: $xmlFiles"
|
|
| 104 | 107 |
for (File xmlTigerFile : xmlFiles) {
|
| 105 | 108 |
FileCopy.copy(xmlTigerFile, new File(xmltxmSrcDir, xmlTigerFile.getName())); |
| 106 | 109 |
} |
| ... | ... | |
| 127 | 130 |
for (def f : xmlFiles) module.orderedFiles.add(new File(outputDirectory, f.getName())) |
| 128 | 131 |
|
| 129 | 132 |
isSuccessFul = outputDirectory.listFiles(IOUtils.HIDDENFILE_FILTER).size() > 0 |
| 133 |
|
|
| 134 |
String cleanDirectories = project.getCleanAfterBuild(); |
|
| 135 |
if ("true".equals(cleanDirectories)) {
|
|
| 136 |
new File(module.getBinaryDirectory(), "tokenized").deleteDir() |
|
| 137 |
new File(module.getBinaryDirectory(), "src").deleteDir() |
|
| 138 |
new File(module.getBinaryDirectory(), "split").deleteDir() |
|
| 139 |
} |
|
| 130 | 140 |
} |
| 131 | 141 |
} |
| tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImport.groovy (revision 2230) | ||
|---|---|---|
| 99 | 99 |
} |
| 100 | 100 |
} |
| 101 | 101 |
|
| 102 |
ArrayList<File> orderedFiles= null;
|
|
| 103 |
protected ArrayList<File> getTXMFilesOrder() {
|
|
| 102 |
ArrayList<String> orderedFiles= null;
|
|
| 103 |
protected ArrayList<String> getTXMFilesOrder() {
|
|
| 104 | 104 |
orderedFiles; |
| 105 | 105 |
} |
| 106 | 106 |
} |
| tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TIGERSearchEditor.java (revision 2230) | ||
|---|---|---|
| 253 | 253 |
} |
| 254 | 254 |
} |
| 255 | 255 |
|
| 256 |
/** |
|
| 257 |
* |
|
| 258 |
* @return 1..N sentences |
|
| 259 |
*/ |
|
| 256 | 260 |
public int getNSent() {
|
| 257 | 261 |
return this.sentSpinner.getSelection(); |
| 258 | 262 |
} |
| ... | ... | |
| 328 | 332 |
|
| 329 | 333 |
String T = TCombo.getText(); |
| 330 | 334 |
String NT = NTCombo.getText(); |
| 331 |
int sent = sentSpinner.getSelection(); |
|
| 332 |
int sub = subSpinner.getSelection(); |
|
| 335 |
int sent = sentSpinner.getSelection() -1;
|
|
| 336 |
int sub = subSpinner.getSelection() -1;
|
|
| 333 | 337 |
|
| 334 | 338 |
if (ts == null) return false; // no result |
| 335 | 339 |
if (!ts.isComputed()) return false; |
| tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 2230) | ||
|---|---|---|
| 95 | 95 |
try {
|
| 96 | 96 |
// iterate to the sub th subgraph |
| 97 | 97 |
TSMatch match = tsresult.getMatch(sent); |
| 98 |
match.setSubGraph(sub-1);
|
|
| 98 |
match.setSubGraph(sub); |
|
| 99 | 99 |
svgFile.delete(); |
| 100 | 100 |
match.toSVGFile(svgFile); |
| 101 | 101 |
if (!svgFile.exists()) {
|
Formats disponibles : Unified diff