Révision 3256
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/antract/ImporterCorpusOkapiMacro.groovy (revision 3256) | ||
---|---|---|
79 | 79 |
// println "Erreur : la liste des corpus n'a pas pu être récupérée." |
80 | 80 |
//} |
81 | 81 |
|
82 |
liste_identifiants_sujets = liste_identifiants_sujets.replace("\n", "|").replace("\t", "|").replace(" ", "|").replaceAll("(\\|)+", "|").trim() |
|
82 |
liste_identifiants_sujets = liste_identifiants_sujets.replace("\n", "|").replace("\t", "|").replace(" ", "|").replaceAll("(\\|)++", "|").trim()
|
|
83 | 83 |
println "Création du sous-corpus avec la liste: $liste_identifiants_sujets" |
84 | 84 |
String prop = "div_id" |
85 |
if (parentCorpusName.startsWith("AFNOTICES") || parentCorpusName.startsWith("AF-NOTICES")) { |
|
86 |
prop = "notice_identifiantdelanotice" |
|
87 |
} |
|
88 | 85 |
|
89 | 86 |
liste_identifiants_sujets = (liste_identifiants_sujets.split("\\|") as List) |
90 | 87 |
liste_identifiants_sujets.remove("") |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/antract/ListerIdentifiantsSujetsMacro.groovy (revision 3256) | ||
---|---|---|
24 | 24 |
def finalValues = [] |
25 | 25 |
def ids = null |
26 | 26 |
|
27 |
if (parentCorpusName.startsWith("AF-VOIX-OFF-")) { |
|
27 |
if (parentCorpusName.startsWith("AF-VOIX-OFF-") || parentCorpusName.startsWith("AF-NOTICES")) {
|
|
28 | 28 |
|
29 | 29 |
struct_prop = corpus.getStructuralUnit("div").getProperty("id") |
30 | 30 |
values = struct_prop.getValues(corpus) |
... | ... | |
34 | 34 |
} |
35 | 35 |
} |
36 | 36 |
|
37 |
} else if (parentCorpusName.startsWith("AFNOTICES") || parentCorpusName.startsWith("AF-NOTICES")) { |
|
38 |
|
|
39 |
struct_prop = corpus.getStructuralUnit("notice").getProperty("identifiantdelanotice") |
|
40 |
def values = struct_prop.getValues(corpus) |
|
41 |
|
|
42 |
def struct_prop2 = corpus.getStructuralUnit("notice").getProperty("typedenotice") |
|
43 |
def qr = corpus.query(new CQLQuery("<notice_typedenotice=\"Notice sujet\">[]"), "TMP", false) |
|
44 |
int[] positions = qr.getStarts() |
|
45 |
int[] strucs = CQPSearchEngine.getCqiClient().cpos2Struc(struct_prop2.getQualifiedName(), positions) |
|
46 |
String sujetsIDS = CQPSearchEngine.getCqiClient().struc2Str(struct_prop.getQualifiedName(), strucs) |
|
47 |
for (String id : values) { |
|
48 |
int idx = sujetsIDS.indexOf(id) |
|
49 |
if (idx > 0) { |
|
50 |
finalValues << id // this id is actually in the sujetsIDS |
|
51 |
} |
|
52 |
} |
|
53 |
|
|
54 | 37 |
} else { |
55 | 38 |
monitorShowError("Erreur: le corpus n'est pas un corpus d'AF-VOIX-OFF ni AFNOTICE") |
56 | 39 |
return false |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/antract/ExporterSousCorpusSujetsDansOkapiMacro.groovy (revision 3256) | ||
---|---|---|
37 | 37 |
} else if (parentCorpusName.startsWith("AFNOTICES") || parentCorpusName.startsWith("AF-NOTICES")) { |
38 | 38 |
ids = gse.run(ListerIdentifiantsSujetsMacro, ["args":[:], "corpusViewSelection":corpusViewSelection, "monitor":monitor]) |
39 | 39 |
} else { |
40 |
monitorShowError("Erreur : le corpus n'est pas un corpus d'AF-VOIX-OFF ni AFNOTICE")
|
|
40 |
monitorShowError("Erreur : le corpus n'est pas un corpus d'AF-VOIX-OFF ni AF-NOTICES")
|
|
41 | 41 |
return false |
42 | 42 |
} |
43 | 43 |
|
Formats disponibles : Unified diff