Revision 141

tmp/org.txm.index.core/.settings/org.eclipse.jdt.core.prefs (revision 141)
1
eclipse.preferences.version=1
2
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
4
org.eclipse.jdt.core.compiler.compliance=1.6
5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7
org.eclipse.jdt.core.compiler.source=1.6
0 8

  
tmp/org.txm.index.core/.classpath (revision 141)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="src" path="groovy"/>
7
	<classpathentry kind="output" path="bin"/>
8
</classpath>
0 9

  
tmp/org.txm.index.core/META-INF/MANIFEST.MF (revision 141)
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: Index core
4
Bundle-SymbolicName: org.txm.index.core
5
Bundle-Version: 1.0.0.qualifier
6
Bundle-Activator: org.txm.index.core.Activator
7
Require-Bundle: org.eclipse.ui,
8
 org.eclipse.core.runtime,
9
 org.txm.r;bundle-version="1.0.0",
10
 org.txm.core;bundle-version="0.7.0",
11
 org.txm.utils;bundle-version="1.0.0"
12
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
13
Bundle-ActivationPolicy: lazy
14
Export-Package: org.txm.functions.index,
15
 org.txm.index.core,
16
 org.txm.macro.r,
17
 org.txm.test
0 18

  
tmp/org.txm.index.core/.project (revision 141)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.txm.index.core</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.jdt.core.javanature</nature>
27
	</natures>
28
</projectDescription>
0 29

  
tmp/org.txm.index.core/groovy/org/txm/test/TestIndex.java (revision 141)
1
package org.txm.test;
2

  
3
import java.io.File;
4
import java.util.ArrayList;
5
import java.util.Arrays;
6
import java.util.List;
7

  
8
import org.txm.functions.index.Index;
9
import org.txm.functions.index.LineComparator.SortMode;
10
import org.txm.searchengine.cqp.corpus.Corpus;
11
import org.txm.searchengine.cqp.corpus.CorpusManager;
12
import org.txm.searchengine.cqp.corpus.Partition;
13
import org.txm.searchengine.cqp.corpus.Property;
14
import org.txm.searchengine.cqp.corpus.query.Query;
15

  
16
/**
17
 * Test class for the concordances
18
 * 
19
 * @author mdecorde
20
 *
21
 */
22
public class TestIndex {
23
	/**
24
	 * the corpus name to use
25
	 */
26
	static String CORPUS = "DISCOURS"; //$NON-NLS-1$
27
	
28
	public static boolean allTests(File outdir) {
29
		TestIndex tester = new TestIndex();
30
		return tester.test1(outdir) && tester.test2(outdir);
31
	}
32
	
33
	/**
34
	 * First test
35
	 * @param outdir : the out folder
36
	 */
37
	public boolean test1(File outdir) {
38
		return testCorpus(new File(outdir, TestIndex.class.getName()+"_test1.csv"), CORPUS, null, "je", //$NON-NLS-1$ //$NON-NLS-2$
39
				Arrays.asList("word"), null); //$NON-NLS-1$
40
	}
41
	
42
	/**
43
	 * First test
44
	 * @param outdir : the out folder
45
	 */
46
	public boolean test2(File outdir) {
47
		return testPartition(new File(outdir, TestIndex.class.getName()+"_test2.csv"), CORPUS, "texts", "je", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
48
				Arrays.asList("word"), null); //$NON-NLS-1$
49
	}
50
	
51
	private boolean testCorpus(File outfile, String corpusname, String subcorpusname, String queryString,
52
			List<String> propertiesString, String sortBy) {
53
		try {
54
			Corpus corpus = CorpusManager.getCorpusManager().getCorpus(corpusname);
55
			if (subcorpusname != null) {
56
				corpus = corpus.getSubcorpusByName(subcorpusname);
57
			}
58
			Query query = new Query(Query.fixQuery(queryString));
59
			
60
			List<Property> properties = new ArrayList<Property>();
61
			for (String p : propertiesString) properties.add(corpus.getProperty(p));
62

  
63
			Index index = new Index(corpus, query, properties);
64
			index.getAllLines();
65
			
66
			if (sortBy != null) {
67
				if ("frequnit".equals(sortBy)) index.sortLines(SortMode.FREQUNIT, false); //$NON-NLS-1$
68
				else if ("unitfreq".equals(sortBy)) index.sortLines(SortMode.UNITFREQ, false); //$NON-NLS-1$
69
			}
70
			index.toTxt(outfile, "UTF-8", "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
71
		} catch (Exception e) {
72
			org.txm.utils.logger.Log.printStackTrace(e);
73
			return false;
74
		}
75
		return true;
76
	}
77
	
78
	private boolean testPartition(File outfile, String corpusname, String partitionname, String queryString,
79
			List<String> propertiesString, String sortBy) {
80
		try {
81
			Corpus corpus = CorpusManager.getCorpusManager().getCorpus(corpusname);
82
			Partition partition = corpus.getPartition(partitionname);
83
			
84
			Query query = new Query(Query.fixQuery(queryString));
85
			
86
			List<Property> properties = new ArrayList<Property>();
87
			for (String p : propertiesString) properties.add(corpus.getProperty(p));
88

  
89
			Index index = new Index(partition, query, properties);
90
			index.getAllLines();
91
			
92
			if (sortBy != null) {
93
				if ("frequnit".equals(sortBy)) index.sortLines(SortMode.FREQUNIT, false); //$NON-NLS-1$
94
				else if ("unitfreq".equals(sortBy)) index.sortLines(SortMode.UNITFREQ, false); //$NON-NLS-1$
95
			}
96
			index.toTxt(outfile, "UTF-8", "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
97
		} catch (Exception e) {
98
			org.txm.utils.logger.Log.printStackTrace(e);
99
			return false;
100
		}
101
		return true;
102
	}
103
}
0 104

  
tmp/org.txm.index.core/groovy/org/txm/test/IndexSample.groovy (revision 141)
1
/**
2
 * Main.
3
 *
4
 * @param args the args
5
 */
6
// Copyright © 2010-2013 ENS de Lyon.
7
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
8
// Lyon 2, University of Franche-Comté, University of Nice
9
// Sophia Antipolis, University of Paris 3.
10
//
11
// The TXM platform is free software: you can redistribute it
12
// and/or modify it under the terms of the GNU General Public
13
// License as published by the Free Software Foundation,
14
// either version 2 of the License, or (at your option) any
15
// later version.
16
//
17
// The TXM platform is distributed in the hope that it will be
18
// useful, but WITHOUT ANY WARRANTY; without even the implied
19
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20
// PURPOSE. See the GNU General Public License for more
21
// details.
22
//
23
// You should have received a copy of the GNU General
24
// Public License along with the TXM platform. If not, see
25
// http://www.gnu.org/licenses.
26
//
27
//
28
//
29
// $LastChangedDate: 2016-08-30 09:45:56 +0200 (Tue, 30 Aug 2016) $
30
// $LastChangedRevision: 3283 $
31
// $LastChangedBy: mdecorde $
32
//
33

  
34
package org.txm.test
35

  
36
// imports des fonctions que l'on va utiliser
37
import org.txm.functions.index.Index
38
import org.txm.searchengine.cqp.corpus.*
39
import org.txm.searchengine.cqp.corpus.query.*
40

  
41
// on récupère le corpus DISCOURS
42
MainCorpus discours = CorpusManager.getCorpusManager().getCorpus("BFM")
43
println discours
44

  
45
// on récupère ses propriétés
46
Property pos = discours.getProperty("ttpos")
47
Property word = discours.getProperty("word")
48

  
49
// on créé une Query, ici "[]"
50
Query query = new Query(Query.fixQuery("[word=\"je\"]"))
51

  
52
List<Property> props = [pos,word]
53

  
54
// on exécute la commande
55
def time = System.currentTimeMillis()
56
println(""+discours+"\t"+query+"\t"+props)
57
Index index = new Index(discours, query, props )
58
println("execution time : "+(System.currentTimeMillis()-time)+" ms")
59

  
60
//sort
61
//index.sortLines(LineComparator.SortMode.FREQUNIT)
62

  
63
//get some infos
64
println("V : "+index.getV())
65
println("T : "+index.getT())
66

  
67
//filter
68
index.filterLines(2,3000)
69
println("V after: "+index.getV())
70
println("T after: "+index.getT())
71

  
72
//on écrit tout dans un fichier
73
File file = new File("voc.txt")
74
index.toTxt(file, "'", "\t", "UTF-8")
75
println("index file : "+ file.getAbsolutePath())
tmp/org.txm.index.core/groovy/org/txm/test/IndexPartition.groovy (revision 141)
1
/**
2
 * Main.
3
 *
4
 * @param args the args
5
 */
6
// Copyright © 2010-2013 ENS de Lyon.
7
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
8
// Lyon 2, University of Franche-Comté, University of Nice
9
// Sophia Antipolis, University of Paris 3.
10
// 
11
// The TXM platform is free software: you can redistribute it
12
// and/or modify it under the terms of the GNU General Public
13
// License as published by the Free Software Foundation,
14
// either version 2 of the License, or (at your option) any
15
// later version.
16
// 
17
// The TXM platform is distributed in the hope that it will be
18
// useful, but WITHOUT ANY WARRANTY; without even the implied
19
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20
// PURPOSE. See the GNU General Public License for more
21
// details.
22
// 
23
// You should have received a copy of the GNU General
24
// Public License along with the TXM platform. If not, see
25
// http://www.gnu.org/licenses.
26
// 
27
// 
28
// 
29
// $LastChangedDate: 2016-08-30 09:45:56 +0200 (Tue, 30 Aug 2016) $
30
// $LastChangedRevision: 3283 $
31
// $LastChangedBy: mdecorde $ 
32
//
33
package org.txm.test
34

  
35
// imports des fonctions que l'on va utiliser
36
import org.txm.Toolbox
37
import org.txm.functions.index.*
38
import org.txm.searchengine.cqp.corpus.*
39
import org.txm.searchengine.cqp.corpus.query.*
40
// TODO: Auto-generated Javadoc
41

  
42
/* (non-Javadoc)
43
 * @see groovy.lang.Script#run()
44
 */
45
boolean manualInit = false
46
if(!org.txm.Toolbox.isInitialized())
47
{
48
	manualInit = true
49
	org.txm.Toolbox.initialize(new File(System.getProperty("user.home")+"/TXM/install.prefs"))
50
}
51
	// on récupère le corpus DISCOURS
52
	MainCorpus discours = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
53
	Partition discours_dates = discours.createPartition( discours.getStructuralUnit("text"), discours.getStructuralUnit("text").getProperty("date"))
54
	println discours
55
	
56
	// on récupère ses propriétés
57
	Property pos = discours.getProperty("pos")
58
	Property word = discours.getProperty("word")
59
	
60
	// on créé une Query, ici "[]"
61
	Query query = new Query(Query.fixQuery("[word=\"j.*\"]"))
62
	
63
	List<Property> props = [pos,word]
64
	
65
	// on exécute la commande
66
	def time = System.currentTimeMillis()
67
	println(""+discours+"\t"+query+"\t"+props)
68
	Index index = new Index(discours_dates, query, props )
69
	println("execution time : "+(System.currentTimeMillis()-time)+" ms")
70
	
71
	//sort
72
	//index.sortLines(LineComparator.SortMode.FREQUNIT)
73
	
74
	//get some infos
75
	println("V : "+index.getV())
76
	println("T : "+index.getT())
77
	
78
	//filter
79
	index.filterLines(2,3000)
80
	println("V after: "+index.getV())
81
	println("T after: "+index.getT())
82
	
83
	//on écrit tout dans un fichier
84
	File file = new File("voc.txt")
85
	index.toTxt(file)
86
	println("index file : "+ file.getAbsolutePath())
87

  
88
	
89
if(manualInit)
90
	org.txm.Toolbox.shutdown()
tmp/org.txm.index.core/groovy/org/txm/macro/r/ExecRMacro.groovy (revision 141)
1
package org.txm.macro.r;
2
// STANDARD DECLARATIONS
3

  
4
import org.kohsuke.args4j.*
5
import org.txm.Toolbox
6
import org.txm.functions.index.Index
7
import org.txm.rcpapplication.commands.*
8
import org.txm.rcpapplication.swt.widget.parameters.*
9
import org.txm.stat.engine.r.RWorkspace
10

  
11

  
12
def sel = corpusViewSelection
13

  
14
String symbol = null;
15
String prop = "none"
16
if (sel instanceof Index) {
17
	println "Sending Index data to R..."
18
	((Index)sel).asRMatrix()
19
	symbol = "t("+((Index)sel).getSymbol()+'$data)'
20
	prop = ((Index)sel).getProperties().toString()
21
}
22

  
23
if (symbol == null) {
24
	println "Selection is not an Index. Aborting."
25
	return
26
}
27

  
28
def r = RWorkspace.getRWorkspaceInstance()
29
def file = File.createTempFile("IndexHist", ".svg", new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "results"))
30

  
31
/// BEGIN SCRIPTS
32
def script ="""
33
par(las=2)
34
barplot($symbol, xlab="$prop", ylab="f")
35
"""
36
/// END SCRIPTS
37
r.plot(file, script)
38
println "Result saved in: "+file.getAbsolutePath()
39

  
40
//display the graphic
41
monitor.syncExec(new Runnable() {
42
	@Override
43
	public void run() {	OpenSVGGraph.OpenSVGFile(file.getAbsolutePath(), "Specificity distribution") }
44
});
tmp/org.txm.index.core/src/org/txm/index/core/Activator.java (revision 141)
1
package org.txm.index.core;
2

  
3
import org.eclipse.ui.plugin.AbstractUIPlugin;
4
import org.osgi.framework.BundleContext;
5

  
6
/**
7
 * The activator class controls the plug-in life cycle
8
 */
9
public class Activator extends AbstractUIPlugin {
10

  
11
	// The plug-in ID
12
	public static final String PLUGIN_ID = "org.txm.index.core"; //$NON-NLS-1$
13

  
14
	// The shared instance
15
	private static Activator plugin;
16
	
17
	/**
18
	 * The constructor
19
	 */
20
	public Activator() {
21
	}
22

  
23
	/*
24
	 * (non-Javadoc)
25
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
26
	 */
27
	public void start(BundleContext context) throws Exception {
28
		super.start(context);
29
		plugin = this;
30
	}
31

  
32
	/*
33
	 * (non-Javadoc)
34
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
35
	 */
36
	public void stop(BundleContext context) throws Exception {
37
		plugin = null;
38
		super.stop(context);
39
	}
40

  
41
	/**
42
	 * Returns the shared instance
43
	 *
44
	 * @return the shared instance
45
	 */
46
	public static Activator getDefault() {
47
		return plugin;
48
	}
49

  
50
}
0 51

  
tmp/org.txm.index.core/src/org/txm/functions/index/package.html (revision 141)
1
<html>
2
<body>
3
<p>Index function</p>
4
</body>
5
</html>
0 6

  
tmp/org.txm.index.core/src/org/txm/functions/index/LineComparator.java (revision 141)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate: 2015-11-19 14:29:08 +0100 (Thu, 19 Nov 2015) $
25
// $LastChangedRevision: 3056 $
26
// $LastChangedBy: mdecorde $ 
27
//
28
package org.txm.functions.index;
29

  
30
import java.text.Collator;
31
import java.util.Comparator;
32

  
33
import org.txm.searchengine.cqp.corpus.Corpus;
34

  
35
// TODO: Auto-generated Javadoc
36
/**
37
 * The Class LineComparator.
38
 */
39
public class LineComparator implements Comparator<Line> {
40

  
41
	/** The collator. */
42
	protected Collator collator;
43

  
44
	/**
45
	 * The Enum SortMode.
46
	 */
47
	public enum SortMode { // the sort methods
48
		/** The FREQ. */
49
 FREQ, // compare only frequency
50
		/** The UNIT. */
51
 UNIT, // compare only units
52
		/** The FREQUNIT. */
53
 FREQUNIT, // compare frequency then units
54
		/** The UNITFREQ. */
55
 UNITFREQ
56
		// compare units then frequency
57
	}
58

  
59
	/** The currentsortmode. */
60
	SortMode currentsortmode = SortMode.FREQUNIT;
61
	
62
	/** The reverse. */
63
	boolean reverse;
64

  
65
	/**
66
	 * Instantiates a new line comparator.
67
	 *
68
	 * @param mode the mode
69
	 * @param reverse the reverse
70
	 */
71
	public LineComparator(SortMode mode, boolean reverse) {
72
		setSortByFrequence(mode);
73
		setReverse(reverse);
74
	}
75

  
76
	/**
77
	 * set if the sort must be reverted.
78
	 *
79
	 * @param reverse the new reverse
80
	 */
81
	private void setReverse(boolean reverse) {
82
		this.reverse = reverse;
83
	}
84

  
85
	/* (non-Javadoc)
86
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
87
	 */
88
	@Override
89
	public int compare(Line arg0, Line arg1) {
90
		int sort = 0;
91
		switch (currentsortmode) {
92
		case FREQUNIT:
93
			sort = arg0.getFrequency() - arg1.getFrequency();
94
			
95
			if (sort == 0)
96
				sort = -collator.compare(arg0.toString(), arg1.toString());
97
			
98
			break;
99

  
100
		case UNITFREQ:
101
			sort = collator.compare(arg0.toString(), arg1.toString());
102
			if (sort == 0)
103
				sort = arg0.getFrequency() - arg1.getFrequency();
104
			break;
105

  
106
		case FREQ:
107
			sort = arg0.getFrequency() - arg1.getFrequency();
108
			break;
109

  
110
		case UNIT:
111
			sort = collator.compare(arg0.toString(), arg1.toString());
112
			break;
113
		}
114
		if (reverse)
115
			sort = -sort;
116
		return sort;
117
	}
118

  
119
	/**
120
	 * set the sort method.
121
	 *
122
	 * @param mode the new sort by frequence
123
	 */
124
	public void setSortByFrequence(SortMode mode) {
125
		currentsortmode = mode;
126
	}
127

  
128
	/**
129
	 * Initialize.
130
	 *
131
	 * @param corpus the corpus
132
	 */
133
	public void initialize(Corpus corpus) {
134
		collator = Collator.getInstance(corpus.getLocale());
135
		collator.setStrength(Collator.TERTIARY);
136
	}
137
}
0 138

  
tmp/org.txm.index.core/src/org/txm/functions/index/Index.java (revision 141)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate: 2016-10-21 11:09:43 +0200 (Fri, 21 Oct 2016) $
25
// $LastChangedRevision: 3323 $
26
// $LastChangedBy: mdecorde $ 
27
//
28
package org.txm.functions.index;
29

  
30
import java.io.BufferedWriter;
31
import java.io.File;
32
import java.io.FileOutputStream;
33
import java.io.IOException;
34
import java.io.OutputStreamWriter;
35
import java.util.ArrayList;
36
import java.util.Arrays;
37
import java.util.Collections;
38
import java.util.HashMap;
39
import java.util.HashSet;
40
import java.util.LinkedHashMap;
41
import java.util.List;
42

  
43
import org.apache.commons.lang.StringUtils;
44
import org.txm.HasResults;
45
import org.txm.Messages;
46
import org.txm.Toolbox;
47
import org.txm.functions.Function;
48
import org.txm.functions.TXMResult;
49
import org.txm.searchengine.cqp.ICqiClient;
50
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
51
import org.txm.searchengine.cqp.corpus.Corpus;
52
import org.txm.searchengine.cqp.corpus.CorpusManager;
53
import org.txm.searchengine.cqp.corpus.Lexicon;
54
import org.txm.searchengine.cqp.corpus.Part;
55
import org.txm.searchengine.cqp.corpus.Partition;
56
import org.txm.searchengine.cqp.corpus.Property;
57
import org.txm.searchengine.cqp.corpus.QueryResult;
58
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
59
import org.txm.searchengine.cqp.corpus.query.Match;
60
import org.txm.searchengine.cqp.corpus.query.Query;
61
import org.txm.searchengine.cqp.serverException.CqiServerError;
62
import org.txm.stat.engine.r.RWorkspace;
63
import org.txm.stat.engine.r.RWorkspaceException;
64
import org.txm.utils.logger.Log;
65

  
66
// TODO: Auto-generated Javadoc
67
/**
68
 * compute an index of a corpus or a partition 
69
 * 
70
 * may contains LexicalTable built from its values
71
 * @author mdecorde.
72
 */
73
public class Index extends Function implements TXMResult, HasResults  {
74

  
75
	/** The partition. */
76
	protected Partition partition;
77

  
78
	/** The corpus. */
79
	protected Corpus corpus;
80

  
81
	/** The query. */
82
	protected Query query;
83

  
84
	/** The props. */
85
	protected List<Property> props;
86

  
87
	/** The partnames. */
88
	protected List<String> partnames = new ArrayList<String>();
89

  
90
	/** The currentpartid. */
91
	protected int currentpartid = 0;
92

  
93
	/** The altered. */
94
	boolean altered = false;
95

  
96
	/** The n lines. */
97
	protected int nLines = 0;
98

  
99
	/** The Fmax. */
100
	protected int Fmax = 0;
101

  
102
	/** The Fmin. */
103
	protected int Fmin = 9999999;
104

  
105
	/** The Filter vmax. */
106
	protected int FilterVmax = 999999999;
107

  
108
	/** The Filter fmin. */
109
	protected int FilterFmin = 1;
110

  
111
	/** The Filter fmax. */
112
	protected int FilterFmax = 999999999;
113

  
114
	/** The prop separator. */
115
	protected String propSeparator = "_"; // the separator of properties values //$NON-NLS-1$
116

  
117
	/** The counts. */
118
	protected LinkedHashMap<String, ArrayList<Integer>> counts = new LinkedHashMap<String, ArrayList<Integer>>();
119

  
120
	/** The lines. */
121
	protected List<Line> lines = new ArrayList<Line>();
122

  
123
	/** proxy to get the string values of cqp tokens. */
124
	//private Map<Property, CqpDataProxy> cache;
125

  
126
	/** The symbol. */
127
	private String symbol;
128

  
129
	/**
130
	 * compute the index with a lexicon.
131
	 *
132
	 * @param corpus the corpus
133
	 * @param property the property
134
	 */
135
	public Index(Corpus corpus, Property property) {
136
		init(corpus, property);
137
		altered = false;
138
	}
139
	
140
	/** The lexicon. */
141
	protected Lexicon lexicon;
142
	
143
	/** The writer. */
144
	private BufferedWriter writer;
145

  
146
	/**
147
	 * Inits the Index using a lexicon.
148
	 *
149
	 * @param corpus the corpus
150
	 * @param property the property
151
	 */
152
	private void init(Corpus corpus, Property property) {
153
		try {
154
			partnames.add(corpus.getName());
155
			this.query = new Query("[]"); //$NON-NLS-1$
156
			this.corpus = corpus;
157
			this.props = new ArrayList<Property>();
158
			this.props.add(property);
159

  
160
			lexicon = corpus.getLexicon(property);
161
			this.nLines = lexicon.nbrOfToken();
162
			String[] forms = lexicon.getForms();
163
			int[] freqs = lexicon.getFreq();
164
			int[] ids = lexicon.getIds();
165
			this.lines = new ArrayList<Line>();
166
			int nbOfToken = lexicon.nbrOfToken();
167
			if (nbOfToken > 0) // no lines
168
				for (int i = 0; i < forms.length && i < freqs.length; i++) {
169
					Line l = new Line();
170
					List<String> values = new ArrayList<String>(1);
171
					values.add(forms[i]);
172
					l.put(property, values);
173
					int[] c = new int[1];
174
					c[0] = freqs[i];
175
					l.setCounts(c, freqs[i] / lexicon.nbrOfToken());
176
					l.putIds(property, new int[] { ids[i] });
177

  
178
					lines.add(l);
179

  
180
					if (Fmin > freqs[i])
181
						Fmin = freqs[i];
182
					if (Fmax < freqs[i])
183
						Fmax = freqs[i];
184

  
185
					// getAllLines();
186
				}
187
		} catch (Exception e) {
188
			// TODO Auto-generated catch block
189
			org.txm.utils.logger.Log.printStackTrace(e);
190
		}
191
	}
192

  
193
	/**
194
	 * compute a index, given a corpus, a query and analysis properties.
195
	 *
196
	 * @param corpus the corpus
197
	 * @param query the query
198
	 * @param props the props
199
	 * @throws CqiClientException 
200
	 * @throws CqiServerError 
201
	 * @throws IOException 
202
	 */
203
	public Index(Corpus corpus, Query query, List<Property> props) throws CqiClientException, IOException, CqiServerError {
204
		//		if (props.size() == 1 && query.getQueryString().equals("[]")) //$NON-NLS-1$
205
		//		{
206
		//			init(corpus, props.get(0));
207
		//			return;
208
		//		}
209
		partnames.add(corpus.getName());
210
		this.corpus = corpus; // the corpus which we compute on
211
		this.query = query; // the query of the selection
212
		if (query.getQueryString() == "") //$NON-NLS-1$
213
			query = new Query("[]"); //$NON-NLS-1$
214
		this.props = new ArrayList<Property>(props);
215

  
216
		if (!scanCorpus(corpus)) {
217
			lines = new ArrayList<Line>();
218
			return;
219
		}
220

  
221
		for (Line line : lines)// for each Line set its count
222
		{
223
			int[] c = new int[partnames.size()];
224
			for (int i = 0; i < partnames.size(); i++)
225
				c[i] = counts.get(line.getSignature()).get(i);
226
			line.setCounts(c, -1);
227
		}
228

  
229
		getAllLines();
230
		setLineCounts();
231
		altered = false;
232
	}
233

  
234
	/**
235
	 * compute a index per Part.
236
	 *
237
	 * @param partition the partition
238
	 * @param query the query
239
	 * @param props the props
240
	 * @throws CqiClientException 
241
	 * @throws CqiServerError 
242
	 * @throws IOException 
243
	 */
244
	public Index(Partition partition, Query query, List<Property> props) throws CqiClientException, IOException, CqiServerError {
245

  
246
		this.partition = partition;
247
		this.corpus = partition.getCorpus(); // the corpus which we compute on
248
		this.query = query; // the query of the selection
249
		if (query.getQueryString() == "") //$NON-NLS-1$
250
			query = new Query("[]"); //$NON-NLS-1$
251
		this.props = new ArrayList<Property>(props);
252

  
253
		for (Part part : partition.getParts()) {
254
			scanCorpus(part);
255
			currentpartid++;
256
			partnames.add(part.getName());
257
		}
258

  
259
		setLineCounts();
260
		getAllLines();
261
		// this.sortLines(LineComparator.SortMode.FREQUNIT);
262
		altered = false;
263
	}
264

  
265
	/**
266
	 * tell if the index has been computed with a partition or not.
267
	 *
268
	 * @return true, if is computed with partition
269
	 */
270
	public boolean isComputedWithPartition() {
271
		return partition != null;
272
	}
273

  
274
	/**
275
	 * update the lines counts.
276
	 */
277
	protected void setLineCounts() {
278
		for (Line line : lines)// for each Line set its count
279
		{
280
			int[] c = new int[partnames.size()];
281
			for (int i = 0; i < partnames.size(); i++)
282
				if (counts.get(line.getSignature()).size() <= i)
283
					c[i] = 0;
284
				else
285
					c[i] = counts.get(line.getSignature()).get(i);
286
			line.setCounts(c, -1);
287
		}
288
	}
289

  
290
	/**
291
	 * count tokens.
292
	 *
293
	 * @param corp the corp
294
	 * @return true, if successful
295
	 * @throws CqiClientException 
296
	 * @throws CqiServerError 
297
	 * @throws IOException 
298
	 */
299
	protected boolean scanCorpus(Corpus corp) throws CqiClientException, IOException, CqiServerError {
300
		// get the cqp result of the query
301
		
302
		long time = System.currentTimeMillis();
303
		QueryResult result = corp.query(query, "index", true); //$NON-NLS-1$
304
		boolean isTargetUsed = Toolbox.getCqiClient().subCorpusHasField(result.getQualifiedCqpId(), ICqiClient.CQI_CONST_FIELD_TARGET);
305
		int nbresults = result.getNMatch();
306
		this.nLines += nbresults; // get number of tokens
307

  
308
		// System.out.println("nLines : "+nLines);
309
		List<Match> matches = null;
310
		if (nbresults > 0)
311
			matches = result.getMatches(0, nbresults - 1); // get the
312
		// indexes
313
		// sequences of
314
		// result's
315
		// tokens
316
		else
317
			matches = new ArrayList<Match>();
318
		// List<Integer> beginingOfKeywordsPositions = new
319
		// ArrayList<Integer>();
320
		// List<Integer> lengthOfKeywords = new ArrayList<Integer>();
321
		// Map<Property, List<List<String>>> keywordsViewPropValues = new
322
		// HashMap<Property, List<List<String>>>();
323

  
324
		// count matches
325
		// time = System.currentTimeMillis();
326
		List<Integer> allpositions = new ArrayList<Integer>();
327
		for (int j = 0; j < nbresults; j++) {
328
			Match match = matches.get(j);
329
			// beginingOfKeywordsPositions.add(match.getStart()); // get the
330
			// first index
331
			// lengthOfKeywords.add(match.size());// get the last index
332
			if (isTargetUsed) {
333
				allpositions.add(match.getTarget());
334
			} else {
335
				for (int i = match.getStart(); i <= match.getEnd(); i++)
336
					allpositions.add(i);
337
			}
338
		}
339
		// System.out.println("get string data");
340
		// time = System.currentTimeMillis();
341
		// for (Property property : props) {// for each property get the
342
		// string values of the tokens
343
		// keywordsViewPropValues.put(property,
344
		// cache.get(property).getData(beginingOfKeywordsPositions,
345
		// lengthOfKeywords));
346
		// }
347
		// System.out.println("took "+(System.currentTimeMillis()-time));
348

  
349
		// System.out.println("get count data");
350

  
351
		int[] allpositionsarray = new int[allpositions.size()];
352
		int pcount = 0;
353
		for (int p : allpositions)
354
			allpositionsarray[pcount++] = p;
355

  
356
		// time = System.currentTimeMillis();
357
		HashMap<Property, int[]> propsId = new HashMap<Property, int[]>();
358
		for (Property property : props) {
359
			try {
360
				if (property instanceof StructuralUnitProperty) {
361
					int[] structs = CorpusManager.getCorpusManager()
362
							.getCqiClient().cpos2Struc(
363
									property.getQualifiedName(),
364
									allpositionsarray);
365
					propsId.put(property, structs);
366
				} else {
367
					int[] indices = CorpusManager.getCorpusManager()
368
							.getCqiClient().cpos2Id(
369
									property.getQualifiedName(),
370
									allpositionsarray);
371
					propsId.put(property, indices);
372
				}
373
			} catch (Exception e) {
374
				org.txm.utils.logger.Log.printStackTrace(e);
375
				result.drop();
376
				return false;
377
			}
378
		}
379
		// System.out.println("Time recup indices "+(System.currentTimeMillis()-time));
380
		int currentIndex = 0;
381
		// time = System.currentTimeMillis();
382
		for (int i = 0; i < nbresults; i++) {
383
			Line line = new Line();
384
			Match match = matches.get(i);
385
			int size = match.size();
386
			if (isTargetUsed) size = 1;
387
			for (int p = 0; p < props.size(); p++) {
388
				Property property = props.get(p);
389
				int[] allprosids = propsId.get(property);
390
				int[] ids = new int[size];
391
				System.arraycopy(allprosids, currentIndex, ids, 0, size);
392
				line.putIds(property, ids);
393
			}
394
			currentIndex += size;
395

  
396
			String signature = line.getSignature();
397

  
398
			if (counts.containsKey(signature)) // if the counts contains the
399
				// signature, increment its
400
				// corresponding value
401
			{
402
				while (counts.get(signature).size() <= currentpartid)
403
					counts.get(signature).add(0);
404
				int c = counts.get(signature).get(currentpartid) + 1;
405
				counts.get(signature).set(currentpartid, c);
406
			} else // else initialize count of the signature to 1
407
			{
408
				// System.out.println("add new sign "+signature+" of line "+line.toString());
409
				ArrayList<Integer> tmp = new ArrayList<Integer>();
410
				for (int j = 0; j < currentpartid + 1; j++)
411
					tmp.add(0);
412
				counts.put(signature, tmp);
413
				counts.get(signature).set(currentpartid, 1);
414

  
415
				lines.add(line);
416
			}
417
		}
418
		result.drop();
419
		// System.out.println("Time count lines "+(System.currentTimeMillis()-time));
420
		// System.out.println("took "+(System.currentTimeMillis()-time));
421
		return true;
422

  
423
	}
424

  
425
	/**
426
	 * return the lines from le "start"th one to the "end"th one.
427
	 *
428
	 * @param start the start
429
	 * @param end the end
430
	 * @return the lines
431
	 */
432
	public List<Line> getLines(int start, int end) {
433
		long time = System.currentTimeMillis();
434
		List<Line> selectedLines = new ArrayList<Line>();
435
		if (lines.size() > 0) {
436
			start = Math.max(0, start);
437
			end = Math.min(end, lines.size());
438
			selectedLines = lines.subList(start, end);
439

  
440
			int p = 0;
441
			for (Property property : props) {// for each property get the string values
442
				// values of the tokens
443

  
444
				int len = 0;
445
				for (Line l : selectedLines) {
446
					len += l.UnitsIds.get(p).length;
447
				}
448

  
449
				int[] indices = new int[len]; // build the array of indices
450
				len = 0;
451
				for (Line l : selectedLines) {
452
					int[] ids = l.UnitsIds.get(p);
453
					System.arraycopy(ids, 0, indices, len, ids.length);
454
					len += ids.length;
455
				}
456
				String[] strs = null;
457
				try {
458
					if (property instanceof StructuralUnitProperty) {
459
						strs = CorpusManager.getCorpusManager().getCqiClient()
460
								.struc2Str(property.getQualifiedName(), indices);
461
					} else {
462
						strs = CorpusManager.getCorpusManager().getCqiClient()
463
								.id2Str(property.getQualifiedName(), indices);
464
					}
465
				} catch (Exception e) {
466
					org.txm.utils.logger.Log.printStackTrace(e);
467
					return null;
468
				}
469
				len = 0;
470
				for (Line l : selectedLines) {
471
					int[] ids = l.UnitsIds.get(p);
472
					String[] lstr = new String[ids.length];
473
					System.arraycopy(strs, len, lstr, 0, ids.length);
474
					if (l.UnitsProperty.size() == props.size()) continue; // the line is already initialized
475
						l.put(property, Arrays.asList(lstr));
476
					len += ids.length;
477
				}
478
				p++;
479
			}
480
		}
481
		// System.out.println("Time get lines "+(System.currentTimeMillis()-time));
482
		return selectedLines;
483
	}
484

  
485
	/**
486
	 * return all the lines of the index.
487
	 *
488
	 * @return the all lines
489
	 */
490
	public List<Line> getAllLines() {
491
		return getLines(0, lines.size());
492
	}
493

  
494
	/**
495
	 * return the cqp expression build with the lines between "from" and "to"
496
	 * TODO: finish implementation.
497
	 *
498
	 * @param from the from
499
	 * @param to the to
500
	 * @return the query
501
	 */
502
	public Query buildQuery(int from, int to) {
503
		return new Query(""); //$NON-NLS-1$
504
	}
505

  
506
	/**
507
	 * Gets the query.
508
	 *
509
	 * @return the query used
510
	 */
511
	public Query getQuery() {
512
		return query;
513
	}
514

  
515
	/**
516
	 * Gets the v.
517
	 *
518
	 * @return the number of entrie in the index
519
	 */
520
	public int getV() {
521
		return lines.size();
522
	}
523

  
524
	/**
525
	 * Gets the t.
526
	 *
527
	 * @return the number of tokens returned by the selection
528
	 */
529
	public int getT() {
530
		return nLines;
531
	}
532

  
533
	/**
534
	 * Sort lines.
535
	 *
536
	 * @param mode the mode
537
	 * @param reverse the reverse
538
	 */
539
	public void sortLines(LineComparator.SortMode mode, boolean reverse) {
540
		this.altered = true;
541
		LineComparator lc = new LineComparator(mode, reverse);
542
		lc.initialize(corpus);
543
		Collections.sort(lines, lc);
544
	}
545

  
546
	/**
547
	 * remove line which frenquency is not in the inverval [Fmin,Fmax].
548
	 *
549
	 * @param Fmin the fmin
550
	 * @param Fmax the fmax
551
	 */
552
	public void filterLines(int Fmin, int Fmax) {
553
		int before = lines.size();
554
		for (int i = 0; i < lines.size(); i++)// for each line
555
		{
556
			Line line = lines.get(i);
557
			int f = line.getFrequency();
558
			if (f < Fmin || f > Fmax) // if its frequency is not in the
559
				// interval, remove it
560
			{
561
				nLines -= line.getFrequency();
562
				lines.remove(i);
563
				i--;
564
			}
565
		}
566
		this.FilterFmin = Fmin;
567
		this.FilterFmax = Fmax;
568
		this.updateFminFmax();
569

  
570
		altered = true;
571
	}
572

  
573
	/**
574
	 * keep the vmax lines more frequents.
575
	 *
576
	 * @param vmax the vmax
577
	 */
578
	public void cut(int vmax) {
579
		this.acquireSemaphore();
580
		// assume the lines are sorted
581
		int before = lines.size();
582
		this.lines = this.lines.subList(0, Math.min(lines.size(), vmax));
583
		this.FilterVmax = vmax;
584
		updateFminFmax();
585

  
586
		altered = true;
587
		this.releaseSemaphore();
588
	}
589

  
590
	/**
591
	 * checks all lines to update Fmin and Fmax.
592
	 */
593
	private void updateFminFmax() {
594
		Fmin = 9999;
595
		Fmax = 1;
596
		for (int i = 0; i < lines.size(); i++) {
597
			Line line = lines.get(i);
598
			int f = line.getFrequency();
599
			if (f < Fmin)
600
				Fmin = f;
601
			if (f > Fmax)
602
				Fmax = f;
603
		}
604
	}
605

  
606
	/**
607
	 * Write all the lines on a writer.
608
	 *
609
	 * @param outfile the outfile
610
	 * @param encoding the encoding
611
	 * @param colseparator the colseparator
612
	 * @param txtseparator the txtseparator
613
	 * @return true, if successful
614
	 */
615
	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) {
616
		try {
617
			toTxt(outfile, 0, lines.size(), encoding, colseparator, txtseparator);
618
		} catch (Exception e) {
619
			System.err.println(Messages.Index_7 + Log.toString(e));
620
			return false;
621
		}
622
		return true;
623
	}
624

  
625
	/**
626
	 * Write the lines between from and to on a writer.
627
	 *
628
	 * @param outfile the outfile
629
	 * @param from The first line to be written
630
	 * @param to The last line to be writen
631
	 * @param encoding the encoding
632
	 * @param colseparator the colseparator
633
	 * @param txtseparator the txtseparator
634
	 * @throws CqiClientException the cqi client exception
635
	 * @throws IOException Signals that an I/O exception has occurred.
636
	 */
637
	public void toTxt(File outfile, int from, int to, String encoding, String colseparator, String txtseparator)
638
			throws CqiClientException, IOException {
639
		// NK: writer declared as class attribute to perform a clean if the operation is interrupted
640
		this.writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile),
641
				encoding)); 
642
		// if ("UTF-8".equals(encoding)) writer.write('\ufeff'); // UTF-8 BOM
643
		String header = ""; //$NON-NLS-1$
644
		for (Property p : props)
645
			header += (p + propSeparator);
646
		header = txtseparator+ header.substring(0, header.length() - 1) +txtseparator;
647
		header += colseparator+ txtseparator+ "F" + txtseparator; //$NON-NLS-1$
648
		if (partnames.size() > 1)
649
			for (int j = 0; j < partnames.size(); j++)
650
				header += colseparator + txtseparator+ partnames.get(j).replace(txtseparator, txtseparator+txtseparator)+txtseparator; 
651
		header += "\n"; //$NON-NLS-1$
652
		writer.write(header);
653

  
654
		// for(Line ligne: lines)
655
		for (int i = from; i < to; i++) {
656
			Line ligne = lines.get(i);
657
			writer.write(txtseparator+ ligne.toString().replace(txtseparator, txtseparator+txtseparator)+ txtseparator + colseparator + ligne.getFrequency()); 
658
			if (partnames.size() > 1)
659
				for (int j = 0; j < partnames.size(); j++)
660
					writer.write(colseparator + ligne.getFrequency(j)); 
661
			writer.write("\n"); //$NON-NLS-1$
662
		}
663
		writer.flush();
664
		writer.close();
665
	}
666

  
667

  
668
	/**
669
	 * Write the lines between from and to on a writer.
670
	 *
671
	 * @param outfile the outfile
672
	 * @param from The first line to be written
673
	 * @param to The last line to be writen
674
	 * @param encoding the encoding
675
	 * @param colseparator the colseparator
676
	 * @param txtseparator the txtseparator
677
	 * @throws CqiClientException the cqi client exception
678
	 * @throws IOException Signals that an I/O exception has occurred.
679
	 */
680
	public void toTSVDictionnary(File outfile, String colseparator, String encoding) throws CqiClientException, IOException {
681
		
682
		//String colseparator = "\t";
683

  
684
		this.writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), encoding)); 
685

  
686
		String header = ""; //$NON-NLS-1$
687
		for (Property p : props) {
688
			header += (p + colseparator);
689
		}
690
		
691
		//header = header.substring(0, header.length() - 1);
692
		header += "F"; //$NON-NLS-1$
693
		if (partnames.size() > 1) {
694
			for (int j = 0; j < partnames.size(); j++) {
695
				header += colseparator + partnames.get(j);
696
			}
697
		}
698
		header += "\n"; //$NON-NLS-1$
699
		writer.write(header);
700

  
701
		for (Line ligne : lines) {
702
			
703
			for (int i = 0 ; i < props.size() ; i++) {
704
				writer.write(StringUtils.join(ligne.getUnitsProperties().get(i), " ") + colseparator);
705
			}
706
			
707
			writer.write(Integer.toString(ligne.getFrequency()));
708
			
709
			if (partnames.size() > 1) {
710
				for (int j = 0; j < partnames.size(); j++) {
711
					writer.write(colseparator + ligne.getFrequency(j));
712
				}
713
			}
714
			writer.write("\n"); //$NON-NLS-1$
715
		}
716
		writer.flush();
717
		writer.close();
718
	}
719

  
720
	/**
721
	 * dump the index in the console.
722
	 *
723
	 * @throws CqiClientException the cqi client exception
724
	 * @throws IOException Signals that an I/O exception has occurred.
725
	 */
726
	public void toConsole() throws CqiClientException, IOException {
727
		System.out.println(Messages.Index_1 + (lines.size()));
728
		toConsole(0, lines.size());
729
	}
730

  
731
	/**
732
	 * dump a part of the index.
733
	 *
734
	 * @param from the from
735
	 * @param to the to
736
	 * @throws CqiClientException the cqi client exception
737
	 * @throws IOException Signals that an I/O exception has occurred.
738
	 */
739
	public void toConsole(int from, int to) throws CqiClientException,
740
	IOException {
741

  
742
		String header = ""; //$NON-NLS-1$
743
		for (Property p : props)
744
			header += (p + propSeparator);
745
		header = header.substring(0, header.length() - 1);
746
		header += "\tF"; //$NON-NLS-1$
747
		if (partnames.size() > 1)
748
			for (int j = 0; j < partnames.size(); j++)
749
				header += "\t" + partnames.get(j); //$NON-NLS-1$
750

  
751
		System.out.println(header);
752
		for (int i = from; i < to; i++) {
753
			Line ligne = lines.get(i);
754
			System.out.print(ligne + "\t" + ligne.getFrequency()); //$NON-NLS-1$ 
755
			if (partnames.size() > 1)
756
				for (int j = 0; j < partnames.size(); j++)
757
					System.out.print("\t" + ligne.getFrequency(j)); //$NON-NLS-1$
758
			System.out.print("\n"); //$NON-NLS-1$
759
		}
760
		System.out.flush();
761
	}
762

  
763
	/**
764
	 * Gets the name.
765
	 *
766
	 * @return the name of this index
767
	 */
768
	public String getName() {
769
		String name = query.getQueryString() + ":"; //$NON-NLS-1$
770
		for (Property s : props)
771
			name += s + propSeparator;
772
		if (props.size() > 0)
773
			name = name.substring(0, name.length() - 1);
774
		return name;
775
	}
776

  
777
	/**
778
	 * Gets the corpus.
779
	 *
780
	 * @return the corpus
781
	 */
782
	public Corpus getCorpus() {
783
		return this.corpus;
784
	}
785

  
786
	/**
787
	 * Gets the properties.
788
	 *
789
	 * @return the properties
790
	 */
791
	public List<Property> getProperties() {
792
		return this.props;
793
	}
794

  
795
	/**
796
	 * Gets the fmax.
797
	 *
798
	 * @return the fmax
799
	 */
800
	public int getFmax() {
801
		return Fmax;
802
	}
803

  
804
	/**
805
	 * Gets the fmin.
806
	 *
807
	 * @return the fmin
808
	 */
809
	public int getFmin() {
810
		return Fmin;
811
	}
812

  
813
	/**
814
	 * Gets the filter fmin.
815
	 *
816
	 * @return the filter fmin
817
	 */
818
	public int getFilterFmin() {
819
		return FilterFmin;
820
	}
821

  
822
	/**
823
	 * Gets the filter fmax.
824
	 *
825
	 * @return the filter fmax
826
	 */
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff