Statistics
| Revision:

root / tmp / org.txm.analec.rcp / src / org / txm / macro / urs / democrat / ComputeDemocratMeasureMetadataMacro.groovy @ 2027

History | View | Annotate | Download (863 Bytes)

1
package org.txm.macro.urs.democrat
2

    
3
import org.txm.searchengine.cqp.corpus.MainCorpus
4
import org.txm.searchengine.cqp.corpus.query.CQLQuery
5
import visuAnalec.donnees.Corpus
6

    
7
class ComputeDemocratMeasureMetadataMacro {
8
        def getStats(MainCorpus corpus) {
9
                def data = [:]
10
                
11
                data["number of words"] = corpus.query(new CQLQuery("[]"), "TMP", false).getNMatch();
12
                
13
                Corpus analecCorpus = URSCorpora.getCorpus(corpus);
14
                def chaines = analecCorpus.getSchemas("CHAINE");
15
                def refchaines = [];
16
                for (def chaine : chaines) {
17
                        if (chaine.getUnitesSousjacentes().length >= 3) {
18
                                refchaines << chaine
19
                        }
20
                }
21
                data["number of coreference chains"] = chaines.size()
22
                data["number of referring chains"] = refchaines.size()
23
                data["number of referring expressions"] = analecCorpus.getUnites("MENTION").size()
24
        }
25
        
26
        def updateTeiHeader(MainCorpus corpus) {
27
                
28
        }
29
}