Revision 1868 tmp/org.txm.treetagger.core/src/org/txm/importer/xmltxm/Annotate.groovy
Annotate.groovy (revision 1868) | ||
---|---|---|
544 | 544 |
public boolean run(File f, String lang, File binDir, File txmDir, boolean replace, String[] properties, String[] options, File annotDir, File ptreetaggerDir, File treetaggerDir) { |
545 | 545 |
|
546 | 546 |
File modelfile = new File(modelsDirectory, lang+".par"); |
547 |
if (!modelfile.exists()) { |
|
547 |
if (!"??".equals(lang) && !modelfile.exists()) {
|
|
548 | 548 |
println "Error: No Modelfile available for lang "+modelfile+". Continue import process "; |
549 | 549 |
return false; |
550 | 550 |
} |
... | ... | |
557 | 557 |
def builder = new BuildTTSrc(f.toURL()); |
558 | 558 |
builder.process(ttsrcfile, null); |
559 | 559 |
|
560 |
String tmpModelFileName = modelfile.getName() |
|
561 |
if (tmpModelFileName.startsWith("??")) { |
|
562 |
if (f.length() > LangDetector.MINIMALSIZE) { |
|
563 |
String dlang = new LangDetector(f).getLang(); |
|
564 |
//println "$f detected lang is $dlang" |
|
565 |
tmpModelFileName = dlang+".par" |
|
566 |
} |
|
567 |
} |
|
568 |
modelfile = new File(modelsDirectory, tmpModelFileName); |
|
569 |
|
|
560 | 570 |
//Apply TT |
561 | 571 |
applyTT(ttsrcfile, ttrezfile, modelfile, options); |
562 | 572 |
|
Also available in: Unified diff