root / tmp / org.txm.groovy.core / src / groovy / org / txm / scripts / prototypes / mesuresBP.groovy @ 1000
History | View | Annotate | Download (2.5 kB)
1 | 1000 | mdecorde | package org.txm.scripts.test;
|
---|---|---|---|
2 | 321 | mdecorde | import org.txm.functions.mesures.*; |
3 | 321 | mdecorde | import org.txm.searchengine.cqp.corpus.Corpus; |
4 | 321 | mdecorde | import org.txm.Toolbox |
5 | 321 | mdecorde | import org.txm.searchengine.cqp.corpus.* |
6 | 321 | mdecorde | import org.txm.searchengine.cqp.corpus.query.* |
7 | 321 | mdecorde | |
8 | 321 | mdecorde | def corpus1 = CorpusManager.getCorpusManager().getCorpus("MESURES") |
9 | 321 | mdecorde | |
10 | 321 | mdecorde | Mesures mesures = new Mesures([corpus1]);
|
11 | 321 | mdecorde | // Taille en mot des textes
|
12 | 321 | mdecorde | mesures.add(new Magnitude('<text> [] expand to text', "word", false, Synthese.SUM)); |
13 | 321 | mdecorde | // Qurtiles des discours direct
|
14 | 321 | mdecorde | mesures.add(new Magnitude('<q> [_.q_type="DD"] expand to q', "word", true, Synthese.QUARTILE)); |
15 | 321 | mdecorde | // Quartiles des paragraphes (ici div1, j'ai pas de paragraphes -_-)
|
16 | 321 | mdecorde | mesures.add(new Magnitude('<div1> [] expand to div1', "word", true, Synthese.QUARTILE)); |
17 | 321 | mdecorde | // moyenne de la taille en mot des paragraphes
|
18 | 321 | mdecorde | //mesures.add(new Magnitude('<p> [] expand to p', "word", true, Synthese.MOYENNE));
|
19 | 321 | mdecorde | |
20 | 321 | mdecorde | // proportion des ! et ? dans le discours direct
|
21 | 321 | mdecorde | mesures.add(new Proportion('[_.q_type="DD"]', "word", true, Synthese.COUNTMATCHES, '[word=".*[.!?].*"]', ['[word=".*\\?*"]', '[word=".*!.*"]'])); |
22 | 321 | mdecorde | // proportion de discours direct avec tiret ou guillemet
|
23 | 321 | mdecorde | mesures.add(new Proportion(null, "word", true, Synthese.COUNTMATCHES, '[_.q_type="DD"] expand to q', ['[_.q_type="DD" & _.q_rend="tiret"] expand to q', '[_.q_type="DD" & _.q_rend="guillemet"] expand to q'])); |
24 | 321 | mdecorde | // Proportion de discours direct avec incise de dire / verbe introducteur
|
25 | 321 | mdecorde | mesures.add(new Proportion(null, "word", true, Synthese.COUNTMATCHES, '[_.q_type="DD"] expand to q', ['[_.q_type="DD" & _.seg_ana="incise_di"] expand to q', '[_.seg_ana="int_DD"] </seg> []{0,10} <q> [_.q_type="DD"]'])); |
26 | 321 | mdecorde | //mesures.add(new Proportion('"j.*"%c expand to text', "word", true, Synthese.SUM, '"j.*" expand to text', ['"j.....*"%c expand to text', '"j........*"%c expand to text']));
|
27 | 321 | mdecorde | |
28 | 321 | mdecorde | // Taux de présence linéaire de ponctuation forte dans le DD
|
29 | 321 | mdecorde | mesures.add(new PresenceRate('[_.q_type="DD"] expand to q', "word", true, Synthese.SUM, '[word=".*[;!?].*"]')); |
30 | 321 | mdecorde | // Taux de présence linéaire de DD
|
31 | 321 | mdecorde | mesures.add(new PresenceRate(null, "word", true, Synthese.SUM, '[_.q_type="DD"]')); |
32 | 321 | mdecorde | // Taux de présence Linéaire de PR
|
33 | 321 | mdecorde | mesures.add(new PresenceRate(null, "word", true, Synthese.SUM, '<pr> [] expand to pr')); |
34 | 321 | mdecorde | |
35 | 321 | mdecorde | // Diversité (en lemmes) des verbes introducteurs
|
36 | 321 | mdecorde | mesures.add(new Diversity(null, "word", true, Synthese.SUM, '[_.seg_ana="int.*" & frpos="V.*"]', "frlemma")); |
37 | 321 | mdecorde | //mesures.add(new Diversity('[_.q_type="DD"] expand to q', "word", true, Synthese.SUM, '"j.*"', "frpos"));
|
38 | 321 | mdecorde | |
39 | 321 | mdecorde | mesures.prettyPrint(); |