Révision 2718
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/CQLList2WordPropertiesMacro.groovy (revision 2718) | ||
---|---|---|
22 | 22 |
CQPCorpus corpus = corpusViewSelection |
23 | 23 |
MainCorpus mcorpus = corpus.getMainCorpus(); |
24 | 24 |
|
25 |
@Field @Option(name="queries_file", usage="The CQL query to select tokens", widget="File", required=true, def="queries.tsv")
|
|
25 |
@Field @Option(name="queries_file", usage="The CQL query file to select tokens to annotate", widget="File", required=true, def="queries.tsv")
|
|
26 | 26 |
File queries_file |
27 | 27 |
|
28 |
@Field @Option(name="property", usage="The annotation type", widget="String", required=true, def="type")
|
|
29 |
String property |
|
28 |
@Field @Option(name="word_property", usage="The word property to annotate", widget="String", required=true, def="type")
|
|
29 |
String word_property
|
|
30 | 30 |
|
31 | 31 |
// Open the parameters input dialog box |
32 | 32 |
if (!ParametersDialog.open(this)) return |
... | ... | |
34 | 34 |
int total = 0; |
35 | 35 |
|
36 | 36 |
|
37 |
def hash = ["args": ["queries_file":queries_file, "property":property],
|
|
37 |
def hash = ["args": ["queries_file":queries_file, "word_property":word_property],
|
|
38 | 38 |
"corpusViewSelection":corpusViewSelection, "gse":gse |
39 | 39 |
] |
40 | 40 |
int n = gse.run(CQLList2WordAnnotationsMacro, hash) |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/CQLList2WordAnnotationsMacro.groovy (revision 2718) | ||
---|---|---|
15 | 15 |
return 0 |
16 | 16 |
} |
17 | 17 |
|
18 |
@Field @Option(name="queries_file", usage="The CQL query to select tokens", widget="File", required=true, def="queries.tsv") |
|
18 |
@Field @Option(name="queries_file", usage="The CQL query to select tokens to annotate", widget="File", required=true, def="queries.tsv")
|
|
19 | 19 |
File queries_file |
20 | 20 |
|
21 |
@Field @Option(name="property", usage="The annotation type", widget="String", required=true, def="type")
|
|
22 |
String property |
|
21 |
@Field @Option(name="word_property", usage="The word property to annotate", widget="String", required=true, def="type")
|
|
22 |
String word_property
|
|
23 | 23 |
|
24 | 24 |
// Open the parameters input dialog box |
25 | 25 |
if (!ParametersDialog.open(this)) return |
... | ... | |
31 | 31 |
if (!line.startsWith("#") && split.length == 2 && split[0].length() > 0 && split[1].length() >= 0) { |
32 | 32 |
|
33 | 33 |
def hash = ["args": |
34 |
["query":split[1], "property":property, "annotation_value":split[0]],
|
|
34 |
["query":split[1], "word_property":word_property, "annotation_value":split[0]],
|
|
35 | 35 |
"corpusViewSelection":corpusViewSelection |
36 | 36 |
] |
37 | 37 |
int n = gse.run(CQL2WordAnnotationsMacro, hash) |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/CQL2WordAnnotationsMacro.groovy (revision 2718) | ||
---|---|---|
21 | 21 |
MainCorpus mcorpus = corpus.getMainCorpus(); |
22 | 22 |
KnowledgeRepository kr = KnowledgeRepositoryManager.createSimpleKnowledgeRepository(mcorpus.getName()); |
23 | 23 |
|
24 |
@Field @Option(name="query", usage="The CQL query to select tokens", widget="String", required=true, def="") |
|
24 |
@Field @Option(name="query", usage="The CQL query to select tokens to annotate", widget="String", required=true, def="")
|
|
25 | 25 |
String query |
26 | 26 |
|
27 |
@Field @Option(name="property", usage="The property to annotate", widget="String", required=true, def="property")
|
|
28 |
String property |
|
27 |
@Field @Option(name="word_property", usage="The word_property to annotate", widget="String", required=true, def="type")
|
|
28 |
String word_property
|
|
29 | 29 |
|
30 | 30 |
@Field @Option(name="value", usage="the annotation value", widget="String", required=true, def="value") |
31 | 31 |
String value |
... | ... | |
40 | 40 |
|
41 | 41 |
annotManager = KRAnnotationEngine.getAnnotationManager(corpus); |
42 | 42 |
|
43 |
AnnotationType type = kr.getType(property); |
|
43 |
AnnotationType type = kr.getType(word_property);
|
|
44 | 44 |
if (type == null) { |
45 |
AnnotationType t = kr.addType(property, property);
|
|
45 |
AnnotationType t = kr.addType(word_property, word_property);
|
|
46 | 46 |
t.setEffect(AnnotationEffect.TOKEN); |
47 | 47 |
type = t |
48 | 48 |
} else { |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/WordProperty2WordMacro.groovy (revision 2718) | ||
---|---|---|
28 | 28 |
Project project = mcorpus.getProject() |
29 | 29 |
File txmDir = new File(project.getProjectDirectory(), "txm/"+mcorpus.getName()) |
30 | 30 |
|
31 |
@Field @Option(name="outputDirectory", usage="The CQL query to select tokens", widget="Folder", required=true, def="result_directory")
|
|
31 |
@Field @Option(name="outputDirectory", usage="Directory of resulting XML-TXM files", widget="Folder", required=true, def="result_directory")
|
|
32 | 32 |
File outputDirectory |
33 | 33 |
|
34 |
@Field @Option(name="property", usage="The property to move", widget="String", required=true, def="type")
|
|
35 |
String property |
|
34 |
@Field @Option(name="word_property", usage="The word property to move", widget="String", required=true, def="type")
|
|
35 |
String word_property
|
|
36 | 36 |
|
37 |
//@Field @Option(name="property_value_to_ignore", usage="The annotation type", widget="String", required=true, def="__undef__") |
|
38 |
//String property_value_to_ignore |
|
37 |
//@Field @Option(name="word_property_value_to_ignore", usage="The annotation type", widget="String", required=true, def="__undef__")
|
|
38 |
//String word_property_value_to_ignore
|
|
39 | 39 |
|
40 | 40 |
// Open the parameters input dialog box |
41 | 41 |
if (!ParametersDialog.open(this)) return |
... | ... | |
69 | 69 |
//println dom |
70 | 70 |
use(groovy.xml.dom.DOMCategory) { |
71 | 71 |
def form = dom.form[0] |
72 |
def anatype = dom.ana.findAll(){ a -> a['@type'] == "#$property"} |
|
72 |
def anatype = dom.ana.findAll(){ a -> a['@type'] == "#$word_property"}
|
|
73 | 73 |
println form.text()+" -> $anatype" |
74 | 74 |
if (anatype.size() > 0) { // keep the word |
75 | 75 |
anatype = anatype[0] |
Formats disponibles : Unified diff