Révision 345
tmp/org.txm.synopticeditor.rcp/src/org/txm/rcp/synoptic/commands/BackToText.java (revision 345) | ||
---|---|---|
43 | 43 |
import org.eclipse.ui.IWorkbenchWindow; |
44 | 44 |
import org.eclipse.ui.handlers.HandlerUtil; |
45 | 45 |
import org.txm.Toolbox; |
46 |
import org.txm.functions.concordances.Concordance;
|
|
47 |
import org.txm.functions.concordances.Line;
|
|
46 |
import org.txm.concordances.functions.Concordance;
|
|
47 |
import org.txm.concordances.functions.Line;
|
|
48 | 48 |
import org.txm.objects.Text; |
49 | 49 |
import org.txm.rcp.synoptic.editor.EditionPanel.RGBA; |
50 | 50 |
import org.txm.rcp.synoptic.editor.SynopticEditionEditor; |
tmp/org.txm.groovy.core/.classpath (revision 345) | ||
---|---|---|
4 | 4 |
<classpathentry kind="src" path="src/groovy"/> |
5 | 5 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> |
6 | 6 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> |
7 |
<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/> |
|
8 |
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/> |
|
7 |
<classpathentry kind="con" path="GROOVY_DSL_SUPPORT"/> |
|
9 | 8 |
<classpathentry kind="output" path="bin"/> |
10 | 9 |
</classpath> |
tmp/org.txm.groovy.core/src/groovy/org/txm/test/CQPBenchmark.groovy (revision 345) | ||
---|---|---|
4 | 4 |
//import org.txm.functions.* |
5 | 5 |
////import org.txm.functions.ca.* |
6 | 6 |
////import org.txm.functions.classification.CAH |
7 |
//import org.txm.functions.concordances.*
|
|
8 |
//import org.txm.functions.concordances.comparators.*
|
|
7 |
//import org.txm.concordances.functions.*
|
|
8 |
//import org.txm.concordances.functions.comparators.*
|
|
9 | 9 |
//import org.txm.functions.cooccurrences.* |
10 | 10 |
//import org.txm.functions.diagnostic.* |
11 | 11 |
//import org.txm.functions.index.* |
tmp/org.txm.groovy.core/src/groovy/org/txm/test/Concordances.groovy (revision 345) | ||
---|---|---|
37 | 37 |
import org.txm.Toolbox |
38 | 38 |
import org.txm.searchengine.cqp.corpus.* |
39 | 39 |
import org.txm.searchengine.cqp.corpus.query.* |
40 |
import org.txm.functions.concordances.*
|
|
41 |
import org.txm.functions.concordances.comparators.*
|
|
40 |
import org.txm.concordances.functions.*
|
|
41 |
import org.txm.concordances.functions.comparators.*
|
|
42 | 42 |
import org.txm.functions.ReferencePattern |
43 | 43 |
|
44 | 44 |
// get the DISCOURS corpus |
tmp/org.txm.groovy.core/src/groovy/org/txm/test/ReleaseFunctionsValidation.groovy (revision 345) | ||
---|---|---|
3 | 3 |
//import org.txm.functions.* |
4 | 4 |
//import org.txm.functions.ca.* |
5 | 5 |
//import org.txm.functions.classification.* |
6 |
//import org.txm.functions.concordances.*
|
|
7 |
//import org.txm.functions.concordances.comparators.*
|
|
6 |
//import org.txm.concordances.functions.*
|
|
7 |
//import org.txm.concordances.functions.comparators.*
|
|
8 | 8 |
//import org.txm.functions.cooccurrences.Cooccurrence |
9 | 9 |
//import org.txm.functions.diagnostic.* |
10 | 10 |
//import org.txm.functions.index.* |
tmp/org.txm.groovy.core/src/groovy/org/txm/export/ConcordancesExport.groovy (revision 345) | ||
---|---|---|
36 | 36 |
import org.txm.Toolbox |
37 | 37 |
import org.txm.searchengine.cqp.corpus.* |
38 | 38 |
import org.txm.searchengine.cqp.corpus.query.* |
39 |
import org.txm.functions.concordances.*
|
|
40 |
import org.txm.functions.concordances.comparators.*
|
|
39 |
import org.txm.concordances.functions.*
|
|
40 |
import org.txm.concordances.functions.comparators.*
|
|
41 | 41 |
import org.txm.functions.ReferencePattern |
42 | 42 |
|
43 | 43 |
// TODO: Auto-generated Javadoc |
tmp/org.txm.groovy.core/src/groovy/org/txm/export/ParaConc.groovy (revision 345) | ||
---|---|---|
30 | 30 |
import org.txm.Toolbox |
31 | 31 |
import org.txm.searchengine.cqp.corpus.* |
32 | 32 |
import org.txm.searchengine.cqp.corpus.query.* |
33 |
import org.txm.functions.concordances.*
|
|
34 |
import org.txm.functions.concordances.comparators.*
|
|
33 |
import org.txm.concordances.functions.*
|
|
34 |
import org.txm.concordances.functions.comparators.*
|
|
35 | 35 |
import org.txm.functions.ReferencePattern |
36 | 36 |
|
37 | 37 |
////// PARAMETERS ////// |
tmp/org.txm.groovy.core/src/groovy/org/txm/export/MultipleConcordances.groovy (revision 345) | ||
---|---|---|
53 | 53 |
import org.txm.Toolbox |
54 | 54 |
import org.txm.searchengine.cqp.corpus.* |
55 | 55 |
import org.txm.searchengine.cqp.corpus.query.* |
56 |
import org.txm.functions.concordances.*
|
|
57 |
import org.txm.functions.concordances.comparators.*
|
|
56 |
import org.txm.concordances.functions.*
|
|
57 |
import org.txm.concordances.functions.comparators.*
|
|
58 | 58 |
import org.txm.functions.ReferencePattern |
59 | 59 |
|
60 | 60 |
//PARAMETRES |
tmp/org.txm.groovy.core/src/groovy/org/txm/export/ConcordancesExport_discours.groovy (revision 345) | ||
---|---|---|
43 | 43 |
import org.txm.Toolbox |
44 | 44 |
import org.txm.searchengine.cqp.corpus.* |
45 | 45 |
import org.txm.searchengine.cqp.corpus.query.* |
46 |
import org.txm.functions.concordances.*
|
|
47 |
import org.txm.functions.concordances.comparators.*
|
|
46 |
import org.txm.concordances.functions.*
|
|
47 |
import org.txm.concordances.functions.comparators.*
|
|
48 | 48 |
import org.txm.functions.ReferencePattern |
49 | 49 |
|
50 | 50 |
// TODO: Auto-generated Javadoc |
tmp/org.txm.groovy.core/src/groovy/org/txm/importer/hyperprince/AnalyzeAlignement.groovy (revision 345) | ||
---|---|---|
48 | 48 |
import java.util.ArrayList; |
49 | 49 |
import javax.xml.stream.*; |
50 | 50 |
|
51 |
import org.txm.functions.concordances.comparators.NullComparator;
|
|
51 |
import org.txm.concordances.functions.comparators.NullComparator;
|
|
52 | 52 |
|
53 | 53 |
|
54 | 54 |
// TODO: Auto-generated Javadoc |
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/BuildWordPropTableMacro.groovy (revision 345) | ||
---|---|---|
29 | 29 |
import org.txm.Toolbox |
30 | 30 |
import org.txm.searchengine.cqp.corpus.* |
31 | 31 |
import org.txm.searchengine.cqp.corpus.query.* |
32 |
import org.txm.functions.concordances.*
|
|
33 |
import org.txm.functions.concordances.comparators.*
|
|
32 |
import org.txm.concordances.functions.*
|
|
33 |
import org.txm.concordances.functions.comparators.*
|
|
34 | 34 |
import org.txm.functions.ReferencePattern |
35 | 35 |
import org.kohsuke.args4j.* |
36 | 36 |
import groovy.transform.Field |
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/i18n/GetStringsFromPropertiesFile.groovy (revision 345) | ||
---|---|---|
1 |
package org.txm.scripts.i18n; |
|
2 |
|
|
3 |
import java.io.BufferedReader; |
|
4 |
import java.io.File; |
|
5 |
import java.io.FileInputStream; |
|
6 |
import java.io.InputStreamReader; |
|
7 |
import java.util.LinkedList; |
|
8 |
|
|
9 |
import org.txm.utils.io.IOUtils; |
|
10 |
|
|
11 |
File newProjectMessagesPackage= new File(System.getProperty("user.home"), "workspace079/org.txm.concordance.core/src/org/txm/concordances/messages"); |
|
12 |
File oldProjectMessagesPackage= new File(System.getProperty("user.home"), "workspace079/org.txm.core/src/java/org/txm/core/messages") |
|
13 |
File newNLSClassFile = new File(newProjectMessagesPackage, "ConcordanceMessages.java"); |
|
14 |
File oldNLSClassFile = new File(oldProjectMessagesPackage, "TBXMessages.java"); |
|
15 |
def langs = ["_fr", "", "_ru"] |
|
16 |
for (def lang : langs) { |
|
17 |
println "LANG=$lang" |
|
18 |
Properties oldProperties = new Properties(); |
|
19 |
File oldMessageFile = new File(oldProjectMessagesPackage, "messages${lang}.properties") |
|
20 |
oldProperties.load(IOUtils.getReader(oldMessageFile, "UTF-8")); |
|
21 |
Properties newProperties = new Properties(); |
|
22 |
File newMessageFile = new File(newProjectMessagesPackage, "messages${lang}.properties") |
|
23 |
if (newMessageFile.exists()) |
|
24 |
newProperties.load(IOUtils.getReader(newMessageFile, "UTF-8")); |
|
25 |
|
|
26 |
newNLSClassFile.getText("UTF-8").findAll("public static String [^;]+;") { key -> |
|
27 |
key = key.substring(21, key.length()-1) |
|
28 |
|
|
29 |
if (oldProperties.get(key) == null) { |
|
30 |
println "Key $key is missing from old messages file: "+oldMessageFile.getName() |
|
31 |
newProperties.put(key, "MISSING") |
|
32 |
} else { |
|
33 |
if (newProperties.get(key) != null) { |
|
34 |
println "update $key = "+oldProperties.get(key) |
|
35 |
} else { |
|
36 |
println "add $key = "+oldProperties.get(key) |
|
37 |
} |
|
38 |
newProperties.put(key, oldProperties.get(key)) |
|
39 |
} |
|
40 |
} |
|
41 |
newProperties.store(IOUtils.getWriter(newMessageFile, "UTF-8"), "created/updated with GetStringsFromPropertiesFile.groovy") |
|
42 |
println "Done" |
|
43 |
} |
tmp/org.txm.groovy.core/.settings/org.eclipse.jdt.groovy.core.prefs (revision 345) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
groovy.compiler.level=23 |
|
0 | 3 |
tmp/org.txm.groovy.core/.settings/org.eclipse.ltk.core.refactoring.prefs (revision 345) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false |
|
0 | 3 |
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/handlers/ComputeCooccurrences.java (revision 345) | ||
---|---|---|
35 | 35 |
import org.eclipse.ui.IWorkbenchPage; |
36 | 36 |
import org.eclipse.ui.IWorkbenchWindow; |
37 | 37 |
import org.txm.Toolbox; |
38 |
import org.txm.concordances.functions.Concordance; |
|
38 | 39 |
import org.txm.cooccurrence.core.functions.Cooccurrence; |
39 | 40 |
import org.txm.cooccurrence.core.preferences.CooccurrencePreferences; |
40 | 41 |
import org.txm.cooccurrence.rcp.editors.CooccurrenceEditorInput; |
41 | 42 |
import org.txm.cooccurrence.rcp.editors.CooccurrencesEditor; |
42 | 43 |
import org.txm.core.preferences.TXMPreferences; |
43 |
import org.txm.functions.concordances.Concordance; |
|
44 | 44 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
45 | 45 |
import org.txm.rcp.Messages; |
46 | 46 |
import org.txm.rcp.StatusLine; |
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 345) | ||
---|---|---|
42 | 42 |
import java.util.Set; |
43 | 43 |
|
44 | 44 |
import org.rosuda.REngine.REXPMismatchException; |
45 |
import org.txm.concordances.functions.Concordance; |
|
46 |
import org.txm.concordances.functions.Line; |
|
45 | 47 |
import org.txm.cooccurrence.core.functions.comparators.CLineComparator; |
46 | 48 |
import org.txm.cooccurrence.core.messages.CooccurrenceCoreMessages; |
47 | 49 |
import org.txm.functions.Function; |
48 |
import org.txm.functions.concordances.Concordance; |
|
49 |
import org.txm.functions.concordances.Line; |
|
50 | 50 |
import org.txm.index.core.functions.Index; |
51 | 51 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
52 | 52 |
import org.txm.lexicaltable.core.functions.LexicalTableFactory; |
... | ... | |
89 | 89 |
String referenceCorpus; |
90 | 90 |
|
91 | 91 |
/** The conclines. */ |
92 |
List<org.txm.functions.concordances.Line> conclines;
|
|
92 |
List<org.txm.concordances.functions.Line> conclines;
|
|
93 | 93 |
|
94 | 94 |
/** The corpus. */ |
95 | 95 |
Corpus corpus; |
tmp/org.txm.core/src/java/org/txm/core/messages/TXMCoreMessages.java (revision 345) | ||
---|---|---|
47 | 47 |
public static String CatalogManager_0; |
48 | 48 |
public static String CatalogManager_1; |
49 | 49 |
public static String Catalog_0; |
50 |
public static String CompositeComparator_0; |
|
51 |
public static String Concordance_0; |
|
52 |
public static String Concordance_1; |
|
53 |
public static String Concordance_12; |
|
54 |
public static String Concordance_13; |
|
55 |
public static String Concordance_14; |
|
56 |
public static String Concordance_15; |
|
57 |
public static String Concordance_16; |
|
58 |
public static String Concordance_17; |
|
59 |
public static String Concordance_18; |
|
60 |
public static String Concordance_19; |
|
61 |
public static String Concordance_2; |
|
62 |
public static String Concordance_3; |
|
63 |
public static String Concordance_4; |
|
64 |
public static String Concordance_5; |
|
65 |
public static String Concordance_6; |
|
66 |
public static String Concordance_7; |
|
67 |
public static String Concordance_8; |
|
68 | 50 |
public static String Contrasts_0; |
69 | 51 |
public static String Convert5To6_1; |
70 | 52 |
public static String Convert5To6_10; |
... | ... | |
158 | 140 |
public static String InternalView_7; |
159 | 141 |
public static String LEXICON; |
160 | 142 |
public static String LEXICON_ADDED; |
161 |
public static String LexicographicKeywordComparator_0; |
|
162 |
public static String LexicographicLeftContextComparator_0; |
|
163 |
public static String LexicographicRightContextComparator_0; |
|
164 | 143 |
public static String MATRIX_ADDED_TO_WORKSPACE; |
165 | 144 |
public static String MainCorpus_0; |
166 | 145 |
public static String MainCorpus_1; |
... | ... | |
181 | 160 |
public static String NetCqiClient_97; |
182 | 161 |
public static String NetCqiServer_0; |
183 | 162 |
public static String NetCqiServer_1; |
184 |
public static String NullComparator_0; |
|
185 | 163 |
public static String PACKAGE_LOADED; |
186 | 164 |
public static String PARTITION_CREATED; |
187 | 165 |
public static String PART_CREATED; |
... | ... | |
234 | 212 |
public static String Project_7; |
235 | 213 |
public static String Project_8; |
236 | 214 |
public static String Project_9; |
237 |
public static String PropertiesReferenceComparator_0; |
|
238 | 215 |
public static String QUERY; |
239 | 216 |
public static String QUERYING_PARTITION; |
240 | 217 |
public static String QueryIndex_2; |
tmp/org.txm.core/META-INF/MANIFEST.MF (revision 345) | ||
---|---|---|
13 | 13 |
org.eclipse.persistence.jpa;bundle-version="2.6.0", |
14 | 14 |
javax.persistence;bundle-version="2.1.0", |
15 | 15 |
org.eclipse.persistence.jpa.jpql;bundle-version="2.6.0", |
16 |
org.txm.statsengine.r.core;bundle-version="1.0.0" |
|
16 |
org.txm.statsengine.r.core;bundle-version="1.0.0", |
|
17 |
org.txm.annotation.core;bundle-version="1.0.0" |
|
17 | 18 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
18 | 19 |
Export-Package: EDU.oswego.cs.dl.util.concurrent, |
19 | 20 |
EDU.oswego.cs.dl.util.concurrent.misc, |
... | ... | |
229 | 230 |
org.sqlite.jdbc4, |
230 | 231 |
org.sqlite.util, |
231 | 232 |
org.txm, |
232 |
org.txm.annotation, |
|
233 |
org.txm.annotation.conversion, |
|
234 |
org.txm.annotation.repository, |
|
235 |
org.txm.annotation.storage.temporary, |
|
236 | 233 |
org.txm.annotation.temporary, |
237 | 234 |
org.txm.core.messages, |
238 | 235 |
org.txm.core.preferences, |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/events/ProgressionEventCallBack.java (revision 345) | ||
---|---|---|
20 | 20 |
import org.jfree.chart.entity.ChartEntity; |
21 | 21 |
import org.txm.chartsengine.rcp.events.EventCallBack; |
22 | 22 |
import org.txm.chartsengine.rcp.events.ZoomAndPanCallBack; |
23 |
import org.txm.functions.concordances.comparators.LineComparator;
|
|
23 |
import org.txm.concordances.functions.comparators.LineComparator;
|
|
24 | 24 |
import org.txm.objects.Edition; |
25 | 25 |
import org.txm.objects.Page; |
26 | 26 |
import org.txm.objects.Text; |
tmp/org.txm.concordance.core/META-INF/MANIFEST.MF (revision 345) | ||
---|---|---|
4 | 4 |
Bundle-SymbolicName: org.txm.concordance.core |
5 | 5 |
Bundle-Version: 1.0.0.qualifier |
6 | 6 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
7 |
Require-Bundle: org.txm.core |
|
8 |
Export-Package: org.txm.functions.concordances, |
|
9 |
org.txm.functions.concordances.comparators |
|
7 |
Require-Bundle: org.txm.core, |
|
8 |
org.txm.annotation.core;bundle-version="1.0.0" |
|
9 |
Export-Package: org.txm.concordances.functions, |
|
10 |
org.txm.concordances.functions.comparators |
tmp/org.txm.concordance.core/src/TestConcordance.java (revision 345) | ||
---|---|---|
5 | 5 |
import java.util.Arrays; |
6 | 6 |
import java.util.List; |
7 | 7 |
|
8 |
import org.txm.concordances.functions.Concordance; |
|
9 |
import org.txm.concordances.functions.comparators.LexicographicKeywordComparator; |
|
10 |
import org.txm.concordances.functions.comparators.LexicographicLeftContextComparator; |
|
11 |
import org.txm.concordances.functions.comparators.LexicographicRightContextComparator; |
|
12 |
import org.txm.concordances.functions.comparators.LineComparator; |
|
13 |
import org.txm.concordances.functions.comparators.NullComparator; |
|
14 |
import org.txm.concordances.functions.comparators.PropertiesReferenceComparator; |
|
8 | 15 |
import org.txm.functions.ReferencePattern; |
9 |
import org.txm.functions.concordances.Concordance; |
|
10 |
import org.txm.functions.concordances.comparators.LexicographicKeywordComparator; |
|
11 |
import org.txm.functions.concordances.comparators.LexicographicLeftContextComparator; |
|
12 |
import org.txm.functions.concordances.comparators.LexicographicRightContextComparator; |
|
13 |
import org.txm.functions.concordances.comparators.LineComparator; |
|
14 |
import org.txm.functions.concordances.comparators.NullComparator; |
|
15 |
import org.txm.functions.concordances.comparators.PropertiesReferenceComparator; |
|
16 | 16 |
import org.txm.searchengine.cqp.corpus.Corpus; |
17 | 17 |
import org.txm.searchengine.cqp.corpus.CorpusManager; |
18 | 18 |
import org.txm.searchengine.cqp.corpus.Property; |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/comparators/LexicographicLeftContextComparator.java (revision 345) | ||
---|---|---|
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: 2014-07-15 09:42:00 +0200 (mar., 15 juil. 2014) $ |
|
25 |
// $LastChangedRevision: 2820 $ |
|
26 |
// $LastChangedBy: mdecorde $ |
|
27 |
// |
|
28 |
package org.txm.concordances.functions.comparators; |
|
29 |
|
|
30 |
import java.util.HashMap; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import org.txm.concordances.functions.Concordance; |
|
34 |
import org.txm.concordances.functions.Line; |
|
35 |
import org.txm.concordances.messages.ConcordanceMessages; |
|
36 |
import org.txm.searchengine.cqp.corpus.Property; |
|
37 |
|
|
38 |
// TODO: Auto-generated Javadoc |
|
39 |
/** |
|
40 |
* Compare two values of left context of a concordance line @ author mdecorde. |
|
41 |
*/ |
|
42 |
public class LexicographicLeftContextComparator extends |
|
43 |
StringListBasedComparator { |
|
44 |
|
|
45 |
/** The Constant NAME. */ |
|
46 |
private static final String NAME = ConcordanceMessages.LexicographicLeftContextComparator_0; |
|
47 |
private Concordance conc; |
|
48 |
private List<Property> props; |
|
49 |
|
|
50 |
/** |
|
51 |
* Instantiates a new lexicographic left context comparator. |
|
52 |
*/ |
|
53 |
public LexicographicLeftContextComparator() { |
|
54 |
super(NAME); |
|
55 |
} |
|
56 |
|
|
57 |
/* (non-Javadoc) |
|
58 |
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) |
|
59 |
*/ |
|
60 |
@Override |
|
61 |
public int compare(Line l1, Line l2) { |
|
62 |
|
|
63 |
this.conc = l1.getConcordance(); |
|
64 |
this.props = conc.getLeftAnalysisProperties(); |
|
65 |
if (props.size() == 0) |
|
66 |
return 0; |
|
67 |
int rez = 0; |
|
68 |
int i = 0; |
|
69 |
|
|
70 |
HashMap<Property, List<String>> values1 = l1.getLeftAnalysisProperty(); |
|
71 |
HashMap<Property, List<String>> values2 = l2.getLeftAnalysisProperty(); |
|
72 |
int j1 = l1.getLeftAnalysisProperty().get(props.get(0)).size() -1; |
|
73 |
int j2 = l2.getLeftAnalysisProperty().get(props.get(0)).size() -1; |
|
74 |
|
|
75 |
String v1, v2; |
|
76 |
|
|
77 |
while (rez == 0) { |
|
78 |
|
|
79 |
if ((j1 < 0) && (j2 < 0)) |
|
80 |
return 0; |
|
81 |
if (j1 < 0) |
|
82 |
return -1; // end of line 1 |
|
83 |
if (j2 < 0) |
|
84 |
return 1; // end of line 2 |
|
85 |
|
|
86 |
v1 = values1.get(props.get(i)).get(j1); |
|
87 |
v2 = values2.get(props.get(i)).get(j2); |
|
88 |
|
|
89 |
if (v1 == null) return -1; |
|
90 |
if (v2 == null) return 1; |
|
91 |
|
|
92 |
rez = collator.compare(v1, v2); |
|
93 |
if (++i >= props.size()) { // iterates over properties before tokens |
|
94 |
i = 0; |
|
95 |
j1--; |
|
96 |
j2--; |
|
97 |
} |
|
98 |
} |
|
99 |
return rez; |
|
100 |
} |
|
101 |
} |
|
0 | 102 |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/comparators/StringListBasedComparator.java (revision 345) | ||
---|---|---|
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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $ |
|
25 |
// $LastChangedRevision: 2386 $ |
|
26 |
// $LastChangedBy: mdecorde $ |
|
27 |
// |
|
28 |
package org.txm.concordances.functions.comparators; |
|
29 |
|
|
30 |
import java.util.Iterator; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
// TODO: Auto-generated Javadoc |
|
34 |
/** |
|
35 |
* The Class StringListBasedComparator. |
|
36 |
*/ |
|
37 |
public abstract class StringListBasedComparator extends LocalizedLineComparator { |
|
38 |
|
|
39 |
/** |
|
40 |
* Instantiates a new string list based comparator. |
|
41 |
* |
|
42 |
* @param name the name |
|
43 |
*/ |
|
44 |
StringListBasedComparator(String name) { |
|
45 |
super(name); |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* Compare list. |
|
50 |
* |
|
51 |
* @param l1 the l1 |
|
52 |
* @param l2 the l2 |
|
53 |
* @return the int |
|
54 |
*/ |
|
55 |
protected int compareList(List<String> l1, List<String> l2) { |
|
56 |
Iterator<String> it1 = l1.iterator(); |
|
57 |
Iterator<String> it2 = l2.iterator(); |
|
58 |
|
|
59 |
while (it1.hasNext() && it2.hasNext()) { |
|
60 |
int c = collator.compare(it1.next(), it2.next()); |
|
61 |
if (c != 0) |
|
62 |
return c; |
|
63 |
} |
|
64 |
if (it1.hasNext()) |
|
65 |
return 1; // it2 is a prefix of it1 |
|
66 |
if (it2.hasNext()) |
|
67 |
return -1; // it1 is a prefix of it2 |
|
68 |
return 0; |
|
69 |
} |
|
70 |
} |
|
0 | 71 |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/comparators/CompositeComparator.java (revision 345) | ||
---|---|---|
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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $ |
|
25 |
// $LastChangedRevision: 2386 $ |
|
26 |
// $LastChangedBy: mdecorde $ |
|
27 |
// |
|
28 |
package org.txm.concordances.functions.comparators; |
|
29 |
|
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import org.txm.concordances.functions.Line; |
|
33 |
import org.txm.concordances.messages.ConcordanceMessages; |
|
34 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
35 |
|
|
36 |
// TODO: Auto-generated Javadoc |
|
37 |
/** |
|
38 |
* The Class CompositeComparator. |
|
39 |
*/ |
|
40 |
public class CompositeComparator extends LineComparator { |
|
41 |
|
|
42 |
/** The comparators. */ |
|
43 |
private List<LineComparator> comparators; |
|
44 |
|
|
45 |
/** |
|
46 |
* Instantiates a new composite comparator. A composite comparator C is made |
|
47 |
* of a list compartors [C0,...,Cn]. C.compare(l1,l2) == 1 (resp. -1) if and |
|
48 |
* only if their exists k such as Ci.compare(l1,l2)==0 for i<k and |
|
49 |
* Ck.compare(l1,l2)=1 (resp. -1) C.compare(l1,l2) == 0 if and only if |
|
50 |
* Ci.compare(l1,l2)==0 for all i |
|
51 |
* |
|
52 |
* @param name the name |
|
53 |
* @param comparators the comparators |
|
54 |
*/ |
|
55 |
public CompositeComparator(String name, List<LineComparator> comparators) { |
|
56 |
super(name); |
|
57 |
setComparators(comparators); |
|
58 |
} |
|
59 |
|
|
60 |
/*public CompositeComparator addComparator(LineComparator comparator) { |
|
61 |
this.comparators.add(comparator); |
|
62 |
return this; |
|
63 |
}*/ |
|
64 |
|
|
65 |
/* (non-Javadoc) |
|
66 |
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) |
|
67 |
*/ |
|
68 |
@Override |
|
69 |
public int compare(Line l1, Line l2) { |
|
70 |
//System.out.println("compare: "+l1+" "+l2); |
|
71 |
for (LineComparator comparator : comparators) { |
|
72 |
int c = comparator.compare(l1, l2); |
|
73 |
//System.out.println("comparator: "+comparator+" = "+c); |
|
74 |
if (c != 0) |
|
75 |
return c; |
|
76 |
} |
|
77 |
return 0; |
|
78 |
} |
|
79 |
|
|
80 |
/* (non-Javadoc) |
|
81 |
* @see org.txm.functions.concordances.comparators.LineComparator#initialize(org.txm.searchengine.cqp.corpus.Corpus) |
|
82 |
*/ |
|
83 |
@Override |
|
84 |
public void initialize(Corpus corpus) { |
|
85 |
for (LineComparator comparator : comparators) |
|
86 |
comparator.initialize(corpus); |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Gets the comparators. |
|
91 |
* |
|
92 |
* @return the comparators |
|
93 |
*/ |
|
94 |
public List<LineComparator> getComparators() { |
|
95 |
return comparators; |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* Sets the comparators. |
|
100 |
* |
|
101 |
* @param comp the new comparators |
|
102 |
*/ |
|
103 |
public void setComparators(List<LineComparator> comp) { |
|
104 |
this.comparators = comp; |
|
105 |
this.name = ConcordanceMessages.CompositeComparator_0; |
|
106 |
for(LineComparator c: comp) |
|
107 |
this.name += c.getName()+" "; //$NON-NLS-1$ |
|
108 |
} |
|
109 |
} |
|
0 | 110 |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/comparators/LexicographicRightContextComparator.java (revision 345) | ||
---|---|---|
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: 2014-07-15 09:42:00 +0200 (mar., 15 juil. 2014) $ |
|
25 |
// $LastChangedRevision: 2820 $ |
|
26 |
// $LastChangedBy: mdecorde $ |
|
27 |
// |
|
28 |
package org.txm.concordances.functions.comparators; |
|
29 |
|
|
30 |
import java.util.HashMap; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import org.txm.concordances.functions.Concordance; |
|
34 |
import org.txm.concordances.functions.Line; |
|
35 |
import org.txm.concordances.messages.ConcordanceMessages; |
|
36 |
import org.txm.searchengine.cqp.corpus.Property; |
|
37 |
|
|
38 |
// TODO: Auto-generated Javadoc |
|
39 |
/** |
|
40 |
* Compare two values of right context of a concordance line @ author mdecorde. |
|
41 |
*/ |
|
42 |
public class LexicographicRightContextComparator extends |
|
43 |
StringListBasedComparator { |
|
44 |
|
|
45 |
/** The Constant NAME. */ |
|
46 |
private static final String NAME = ConcordanceMessages.LexicographicRightContextComparator_0; |
|
47 |
private Concordance conc; |
|
48 |
private List<Property> props; |
|
49 |
|
|
50 |
/** |
|
51 |
* Instantiates a new lexicographic right context comparator. |
|
52 |
*/ |
|
53 |
public LexicographicRightContextComparator() { |
|
54 |
super(NAME); |
|
55 |
} |
|
56 |
|
|
57 |
/* (non-Javadoc) |
|
58 |
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) |
|
59 |
*/ |
|
60 |
@Override |
|
61 |
public int compare(Line l1, Line l2) { |
|
62 |
int rez = 0; |
|
63 |
int i = 0; // property counter |
|
64 |
int j = 0; // position counter |
|
65 |
HashMap<Property, List<String>> values1 = l1.getRightAnalysisProperty(); |
|
66 |
HashMap<Property, List<String>> values2 = l2.getRightAnalysisProperty(); |
|
67 |
this.conc = l1.getConcordance(); |
|
68 |
this.props = conc.getRightAnalysisProperties(); |
|
69 |
|
|
70 |
List<String> vals1; |
|
71 |
List<String> vals2; |
|
72 |
|
|
73 |
String v1, v2; |
|
74 |
|
|
75 |
int size1 = values1.get(props.get(0)).size(); |
|
76 |
int size2 = values2.get(props.get(0)).size(); |
|
77 |
|
|
78 |
while (rez == 0) { |
|
79 |
// vals1 = values1.get(props.get(i)); |
|
80 |
// vals2 = values2.get(props.get(i)); |
|
81 |
|
|
82 |
//System.out.println("LINE 1: "+vals1); |
|
83 |
//System.out.println("LINE 2: "+vals2); |
|
84 |
if(size1 <= j && size2 <= j) |
|
85 |
return 0; // end of line 1 |
|
86 |
if (size1 <= j) |
|
87 |
return -1; // end of line 1 |
|
88 |
if (size2 <= j) |
|
89 |
return 1; // end of line 2 |
|
90 |
|
|
91 |
v1 = values1.get(props.get(i)).get(j); |
|
92 |
v2 = values2.get(props.get(i)).get(j); |
|
93 |
|
|
94 |
//System.out.println("COMP "+j+" : "+v1+" "+v2); |
|
95 |
if (v1 == null) return -1; |
|
96 |
if (v2 == null) return 1; |
|
97 |
|
|
98 |
rez = collator.compare(v1, v2); |
|
99 |
if (++i >= props.size()) { // iterates over properties before tokens |
|
100 |
i = 0; |
|
101 |
j++; |
|
102 |
} |
|
103 |
} |
|
104 |
return rez; |
|
105 |
} |
|
106 |
} |
|
0 | 107 |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/comparators/LexicographicKeywordComparator.java (revision 345) | ||
---|---|---|
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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $ |
|
25 |
// $LastChangedRevision: 2386 $ |
|
26 |
// $LastChangedBy: mdecorde $ |
|
27 |
// |
|
28 |
package org.txm.concordances.functions.comparators; |
|
29 |
|
|
30 |
import java.util.HashMap; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import org.txm.concordances.functions.Concordance; |
|
34 |
import org.txm.concordances.functions.Line; |
|
35 |
import org.txm.concordances.messages.ConcordanceMessages; |
|
36 |
import org.txm.searchengine.cqp.corpus.Property; |
|
37 |
|
|
38 |
// TODO: Auto-generated Javadoc |
|
39 |
/** |
|
40 |
* Compare two values of keyword of a concordance line |
|
41 |
* @author mdecorde. |
|
42 |
*/ |
|
43 |
public class LexicographicKeywordComparator extends LocalizedLineComparator { |
|
44 |
|
|
45 |
/** The Constant NAME. */ |
|
46 |
private static final String NAME = ConcordanceMessages.LexicographicKeywordComparator_0; |
|
47 |
private Concordance conc; |
|
48 |
private List<Property> props; |
|
49 |
|
|
50 |
/** |
|
51 |
* Instantiates a new lexicographic keyword comparator. |
|
52 |
*/ |
|
53 |
public LexicographicKeywordComparator() { |
|
54 |
super(NAME); |
|
55 |
} |
|
56 |
|
|
57 |
/* (non-Javadoc) |
|
58 |
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) |
|
59 |
*/ |
|
60 |
@Override |
|
61 |
public int compare(Line l1, Line l2) { |
|
62 |
int rez = 0; |
|
63 |
int i = 0; |
|
64 |
int j = 0; |
|
65 |
HashMap<Property, List<String>> values1 = l1.getKeywordsAnalysisProperty(); |
|
66 |
HashMap<Property, List<String>> values2 = l2.getKeywordsAnalysisProperty(); |
|
67 |
this.conc = l1.getConcordance(); |
|
68 |
this.props = conc.getKeywordAnalysisProperties(); |
|
69 |
while(rez == 0) { |
|
70 |
List<String> vals1 = values1.get(props.get(i)); |
|
71 |
List<String> vals2 = values2.get(props.get(i)); |
|
72 |
if(vals1.size() <= j && vals2.size() <= j) |
|
73 |
return 0; // end of line 1 |
|
74 |
if(vals1.size() <= j) |
|
75 |
return -1; // end of line 1 |
|
76 |
if(vals2.size() <= j) |
|
77 |
return 1; // end of line 2 |
|
78 |
rez = collator.compare(vals1.get(j), vals2.get(j)); |
|
79 |
if(++i >= props.size()) { // iterates over properties before tokens |
|
80 |
i = 0; |
|
81 |
j++; |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
85 |
return rez; |
|
86 |
} |
|
87 |
} |
|
0 | 88 |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/comparators/package.html (revision 345) | ||
---|---|---|
1 |
<html> |
|
2 |
<body> |
|
3 |
<p>Sorters for displaying concordance.</p> |
|
4 |
</body> |
|
5 |
</html> |
|
0 | 6 |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/comparators/LineComparator.java (revision 345) | ||
---|---|---|
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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $ |
|
25 |
// $LastChangedRevision: 2386 $ |
|
26 |
// $LastChangedBy: mdecorde $ |
|
27 |
// |
|
28 |
package org.txm.concordances.functions.comparators; |
|
29 |
|
|
30 |
import java.util.Comparator; |
|
31 |
|
|
32 |
import org.txm.concordances.functions.Line; |
|
33 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
34 |
|
|
35 |
// TODO: Auto-generated Javadoc |
|
36 |
/** |
|
37 |
* Abstract comparator of concordance line @ author mdecorde. |
|
38 |
*/ |
|
39 |
public abstract class LineComparator implements Comparator<Line> { |
|
40 |
|
|
41 |
/** The name. */ |
|
42 |
protected String name; |
|
43 |
|
|
44 |
/** The available comparator. */ |
|
45 |
private static String[] availableComparator = new String[] { |
|
46 |
"org.txm.functions.concordances.comparators.LexicographicKeywordComparator", //$NON-NLS-1$ |
|
47 |
"org.txm.functions.concordances.comparators.LexicographicLeftContextComparator", //$NON-NLS-1$ |
|
48 |
"org.txm.functions.concordances.comparators.LexicographicRightContextComparator", //$NON-NLS-1$ |
|
49 |
"org.txm.functions.concordances.comparators.PropertiesReferenceComparator" //$NON-NLS-1$ |
|
50 |
}; |
|
51 |
|
|
52 |
/** |
|
53 |
* Return the list of all the known comparators. Any non-abstract class |
|
54 |
* extending LineComparator should be mentionned in the availableComparator |
|
55 |
* list |
|
56 |
* |
|
57 |
* @return the available comparators |
|
58 |
*/ |
|
59 |
static public String[] getAvailableComparators() { |
|
60 |
return availableComparator; |
|
61 |
} |
|
62 |
|
|
63 |
/** |
|
64 |
* Instantiates a new line comparator. |
|
65 |
* |
|
66 |
* @param name the name |
|
67 |
*/ |
|
68 |
public LineComparator(String name) { |
|
69 |
this.name = name; |
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* Gets the name. |
|
75 |
* |
|
76 |
* @return the name |
|
77 |
*/ |
|
78 |
public String getName() { |
|
79 |
return name; |
|
80 |
} |
|
81 |
|
|
82 |
/* (non-Javadoc) |
|
83 |
* @see java.lang.Object#toString() |
|
84 |
*/ |
|
85 |
@Override |
|
86 |
public String toString() { |
|
87 |
return "C:" + name; //$NON-NLS-1$ |
|
88 |
} |
|
89 |
|
|
90 |
/** |
|
91 |
* Initialize. |
|
92 |
* |
|
93 |
* @param corpus the corpus |
|
94 |
*/ |
|
95 |
public abstract void initialize(Corpus corpus); |
|
96 |
|
|
97 |
} |
|
0 | 98 |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/comparators/NullComparator.java (revision 345) | ||
---|---|---|
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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $ |
|
25 |
// $LastChangedRevision: 2386 $ |
|
26 |
// $LastChangedBy: mdecorde $ |
|
27 |
// |
|
28 |
package org.txm.concordances.functions.comparators; |
|
29 |
|
|
30 |
import org.txm.concordances.functions.Line; |
|
31 |
import org.txm.concordances.messages.ConcordanceMessages; |
|
32 |
|
|
33 |
// TODO: Auto-generated Javadoc |
|
34 |
/** |
|
35 |
* return the order of the text. |
|
36 |
* |
|
37 |
* @author mdecorde |
|
38 |
*/ |
|
39 |
public class NullComparator extends LocalizedLineComparator { |
|
40 |
|
|
41 |
/** The Constant NAME. */ |
|
42 |
private static final String NAME = ConcordanceMessages.NullComparator_0; |
|
43 |
|
|
44 |
/** |
|
45 |
* Instantiates a new null comparator. |
|
46 |
*/ |
|
47 |
public NullComparator() { |
|
48 |
super(NAME); |
|
49 |
} |
|
50 |
|
|
51 |
/* (non-Javadoc) |
|
52 |
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) |
|
53 |
*/ |
|
54 |
@Override |
|
55 |
public int compare(Line l1, Line l2) { |
|
56 |
return l1.getKeywordPosition() - l2.getKeywordPosition(); |
|
57 |
} |
|
58 |
} |
|
0 | 59 |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/comparators/PropertiesReferenceComparator.java (revision 345) | ||
---|---|---|
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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $ |
|
25 |
// $LastChangedRevision: 2386 $ |
|
26 |
// $LastChangedBy: mdecorde $ |
|
27 |
// |
|
28 |
package org.txm.concordances.functions.comparators; |
|
29 |
|
|
30 |
import org.txm.concordances.functions.Line; |
|
31 |
import org.txm.concordances.messages.ConcordanceMessages; |
|
32 |
import org.txm.functions.Reference; |
|
33 |
import org.txm.searchengine.cqp.corpus.Property; |
|
34 |
|
|
35 |
// TODO: Auto-generated Javadoc |
|
36 |
/** |
|
37 |
* Compare the references of concordance line @ author mdecorde. |
|
38 |
*/ |
|
39 |
public class PropertiesReferenceComparator extends LocalizedLineComparator { |
|
40 |
|
|
41 |
/** The Constant NAME. */ |
|
42 |
private static final String NAME = ConcordanceMessages.PropertiesReferenceComparator_0; |
|
43 |
|
|
44 |
//protected Collator collator = Collator.getInstance(new Locale(System.getProperty("user.language"))); //$NON-NLS-1$ |
|
45 |
|
|
46 |
/** |
|
47 |
* Instantiates a new properties reference comparator. |
|
48 |
*/ |
|
49 |
public PropertiesReferenceComparator() { |
|
50 |
super(NAME); |
|
51 |
} |
|
52 |
|
|
53 |
/* (non-Javadoc) |
|
54 |
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) |
|
55 |
*/ |
|
56 |
@Override |
|
57 |
public int compare(Line l1, Line l2) { |
|
58 |
if (l1 == null || l2 == null) |
|
59 |
return 0; |
|
60 |
|
|
61 |
Reference ref1 = l1.getAnaRef(); |
|
62 |
Reference ref2 = l2.getAnaRef(); |
|
63 |
assert (ref1.getReferencePattern().equals(ref2.getReferencePattern())); |
|
64 |
for (Property prop : ref1.getProperties()) { |
|
65 |
int c = 0; |
|
66 |
try { |
|
67 |
Integer i1 = Integer.parseInt(ref1.getValue(prop)); |
|
68 |
Integer i2 = Integer.parseInt(ref2.getValue(prop)); |
|
69 |
c = i1.compareTo(i2); |
|
70 |
} catch (NumberFormatException e) { |
|
71 |
//System.out.println("sort "+ref1+ " "+ ref2 +" with "+collator); |
|
72 |
c = collator.compare(ref1.getValue(prop), ref2.getValue(prop)); |
|
73 |
} |
|
74 |
|
|
75 |
if (c != 0) { |
|
76 |
return c; |
|
77 |
} |
|
78 |
} |
|
79 |
return 0; |
|
80 |
} |
|
81 |
} |
|
0 | 82 |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/comparators/ReverseComparator.java (revision 345) | ||
---|---|---|
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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $ |
|
25 |
// $LastChangedRevision: 2386 $ |
|
26 |
// $LastChangedBy: mdecorde $ |
|
27 |
// |
|
28 |
package org.txm.concordances.functions.comparators; |
|
29 |
|
|
30 |
import org.txm.concordances.functions.Line; |
|
31 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
32 |
|
|
33 |
// TODO: Auto-generated Javadoc |
|
34 |
/** |
|
35 |
* Revert a comparator @ author mdecorde. |
|
36 |
*/ |
|
37 |
public class ReverseComparator extends LineComparator { |
|
38 |
|
|
39 |
/** The comparator. */ |
|
40 |
private LineComparator comparator; |
|
41 |
|
|
42 |
/** |
|
43 |
* Instantiates a new reverse comparator. |
|
44 |
* |
|
45 |
* @param name the name |
|
46 |
* @param comparator the comparator |
|
47 |
*/ |
|
48 |
public ReverseComparator(String name, LineComparator comparator) { |
|
49 |
super(name); |
|
50 |
this.comparator = comparator; |
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* Instantiates a new reverse comparator. |
|
55 |
* |
|
56 |
* @param comparator the comparator |
|
57 |
*/ |
|
58 |
public ReverseComparator(LineComparator comparator) { |
|
59 |
super(comparator.getName()); |
|
60 |
this.comparator = comparator; |
|
61 |
} |
|
62 |
|
|
63 |
/* (non-Javadoc) |
|
64 |
* @see org.txm.functions.concordances.comparators.LineComparator#initialize(org.txm.searchengine.cqp.corpus.Corpus) |
|
65 |
*/ |
|
66 |
@Override |
|
67 |
public void initialize(Corpus corpus) { |
|
68 |
comparator.initialize(corpus); |
|
69 |
} |
|
70 |
|
|
71 |
/* (non-Javadoc) |
|
72 |
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) |
|
73 |
*/ |
|
74 |
@Override |
|
75 |
public int compare(Line l1, Line l2) { |
|
76 |
return -1 * comparator.compare(l1, l2); |
|
77 |
} |
|
78 |
} |
|
0 | 79 |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/comparators/LocalizedLineComparator.java (revision 345) | ||
---|---|---|
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: 2014-07-15 09:42:00 +0200 (mar., 15 juil. 2014) $ |
|
25 |
// $LastChangedRevision: 2820 $ |
|
26 |
// $LastChangedBy: mdecorde $ |
|
27 |
// |
|
28 |
package org.txm.concordances.functions.comparators; |
|
29 |
|
|
30 |
import java.text.Collator; |
|
31 |
import java.util.Locale; |
|
32 |
|
|
33 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
34 |
import org.txm.utils.logger.Log; |
|
35 |
|
|
36 |
// TODO: Auto-generated Javadoc |
|
37 |
/** |
|
38 |
* use the giver locale to compare concordance line, if locale is not defined, |
|
39 |
* use the system locale @ author mdecorde. |
|
40 |
*/ |
|
41 |
public abstract class LocalizedLineComparator extends LineComparator { |
|
42 |
|
|
43 |
/** The locale. */ |
|
44 |
private Locale locale = new Locale("en", "US"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
45 |
|
|
46 |
/** The collator. */ |
|
47 |
protected Collator collator; |
|
48 |
|
|
49 |
/** |
|
50 |
* Instantiates a new localized line comparator. |
|
51 |
* |
|
52 |
* @param name the name |
|
53 |
*/ |
|
54 |
public LocalizedLineComparator(String name) { |
|
55 |
super(name); |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* Gets the locale. |
|
60 |
* |
|
61 |
* @return the locale |
|
62 |
*/ |
|
63 |
public Locale getLocale() { |
|
64 |
return locale; |
|
65 |
} |
|
66 |
|
|
67 |
/** |
|
68 |
* Sets the locale. |
|
69 |
* |
|
70 |
* @param locale the new locale |
|
71 |
*/ |
|
72 |
public void setLocale(Locale locale) { |
|
73 |
Log.info("Set comparator locale to "+locale); |
|
74 |
this.locale = locale; |
|
75 |
this.collator = Collator.getInstance(locale); |
|
76 |
this.collator.setStrength(Collator.TERTIARY); |
|
77 |
} |
|
78 |
|
|
79 |
/* (non-Javadoc) |
|
80 |
* @see org.txm.functions.concordances.comparators.LineComparator#initialize(org.txm.searchengine.cqp.corpus.Corpus) |
|
81 |
*/ |
|
82 |
@Override |
|
83 |
public void initialize(Corpus corpus) { |
|
84 |
setLocale(corpus.getLocale()); |
|
85 |
} |
|
86 |
} |
|
0 | 87 |
tmp/org.txm.concordance.core/src/org/txm/concordances/functions/Concordance.java (revision 345) | ||
---|---|---|
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-11-29 16:47:07 +0100 (Tue, 29 Nov 2016) $ |
|
25 |
// $LastChangedRevision: 3349 $ |
|
26 |
// $LastChangedBy: mdecorde $ |
|
27 |
// |
|
28 |
package org.txm.concordances.functions; |
|
29 |
|
|
30 |
import java.io.BufferedOutputStream; |
|
31 |
import java.io.BufferedWriter; |
|
32 |
import java.io.File; |
|
33 |
import java.io.FileOutputStream; |
|
34 |
import java.io.IOException; |
|
35 |
import java.io.OutputStreamWriter; |
|
36 |
import java.io.UnsupportedEncodingException; |
|
37 |
import java.io.Writer; |
|
38 |
import java.util.ArrayList; |
|
39 |
import java.util.Arrays; |
|
40 |
import java.util.Collections; |
|
41 |
import java.util.Comparator; |
|
42 |
import java.util.HashMap; |
|
43 |
import java.util.HashSet; |
|
44 |
import java.util.List; |
|
45 |
import java.util.Map; |
|
46 |
|
|
47 |
import org.txm.annotation.Annotation; |
|
48 |
import org.txm.annotation.AnnotationManager; |
|
49 |
import org.txm.annotation.repository.AnnotationType; |
|
50 |
import org.txm.annotation.repository.TypedValue; |
|
51 |
import org.txm.concordances.functions.comparators.LineComparator; |
|
52 |
import org.txm.concordances.messages.ConcordanceMessages; |
|
53 |
//import org.txm.core.messages.ConcordanceMessages; |
|
54 |
import org.txm.functions.Function; |
|
55 |
import org.txm.functions.Reference; |
|
56 |
import org.txm.functions.ReferencePattern; |
|
57 |
import org.txm.searchengine.cqp.AbstractCqiClient; |
|
58 |
import org.txm.searchengine.cqp.MemCqiClient; |
|
59 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
|
60 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
61 |
import org.txm.searchengine.cqp.corpus.CorpusManager; |
|
62 |
import org.txm.searchengine.cqp.corpus.Property; |
|
63 |
import org.txm.searchengine.cqp.corpus.QueryResult; |
|
64 |
import org.txm.searchengine.cqp.corpus.StructuralUnit; |
|
65 |
import org.txm.searchengine.cqp.corpus.query.Match; |
|
66 |
import org.txm.searchengine.cqp.corpus.query.Query; |
|
67 |
import org.txm.searchengine.cqp.serverException.CqiServerError; |
|
68 |
import org.txm.statsengine.r.core.RWorkspace; |
|
69 |
import org.txm.statsengine.r.core.exceptions.RWorkspaceException; |
|
70 |
import org.txm.utils.logger.Log; |
|
71 |
|
|
72 |
// TODO: Auto-generated Javadoc |
|
73 |
/** |
|
74 |
* The Class Concordance. |
|
75 |
* |
|
76 |
* @author jmague, mdecorde |
|
77 |
*/ |
|
78 |
public class Concordance extends Function { |
|
79 |
|
|
80 |
/** |
|
81 |
* The Enum Format. |
Formats disponibles : Unified diff