Révision 2346
tmp/org.txm.tigersearch.rcp/groovy/org/txm/macro/tiger/exploit/TIGERIndexMacro.groovy (revision 2346) | ||
---|---|---|
43 | 43 |
def labels |
44 | 44 |
@Field @Option(name="properties", usage="List of properties separated with ','", widget="String", required=true, def="word, word, word") |
45 | 45 |
def properties |
46 |
@Field @Option(name="count_subgraph", usage="A Full TIGERSearch query", widget="Boolean", required=true, def="true")
|
|
47 |
def count_subgraph
|
|
46 |
@Field @Option(name="count_sub_matches", usage="A Full TIGERSearch query", widget="Boolean", required=true, def="true")
|
|
47 |
def count_sub_matches
|
|
48 | 48 |
@Field @Option(name="sort_column", usage="choose between the len or freq columns", widget="StringArray", metaVar="freq labels", required=false, def="freq") |
49 | 49 |
String sort_column |
50 | 50 |
@Field @Option(name="max_lines", usage="choose between the len or freq columns", widget="Integer", metaVar="freq labels", required=false, def="-1") |
... | ... | |
149 | 149 |
counts[strings] = counts[strings] + 1 |
150 | 150 |
total_counts[strings] = total_counts[strings] + 1 |
151 | 151 |
|
152 |
if (!count_subgraph) break;
|
|
152 |
if (!count_sub_matches) break;
|
|
153 | 153 |
} |
154 | 154 |
} |
155 | 155 |
|
tmp/org.txm.tigersearch.rcp/groovy/org/txm/macro/tiger/exploit/TIGERSummaryMacro.groovy (revision 2346) | ||
---|---|---|
27 | 27 |
|
28 | 28 |
@Field @Option(name="tiger_query", usage="A Full TIGERSearch query", widget="Text", required=true, def="[]") |
29 | 29 |
String tiger_query |
30 |
@Field @Option(name="count_subgraph", usage="A Full TIGERSearch query", widget="Boolean", required=true, def="true")
|
|
31 |
def count_subgraph
|
|
30 |
@Field @Option(name="count_sub_matches", usage="A Full TIGERSearch query", widget="Boolean", required=true, def="true")
|
|
31 |
def count_sub_matches
|
|
32 | 32 |
@Field @Option(name="debug", usage="Show internal variable content", widget="StringArray", metaVar="OFF ON ALL REALLY ALL", required=true, def="OFF") |
33 | 33 |
debug |
34 | 34 |
if (!ParametersDialog.open(this)) return |
... | ... | |
54 | 54 |
def sentences_min_max = tse.getSentMinMax(corpus); |
55 | 55 |
def mresult = tcorpus.manager.processQuery(tiger_query, sentences_min_max[0], sentences_min_max[1], 9999999); |
56 | 56 |
int size = 0; |
57 |
if (count_subgraph) {
|
|
57 |
if (count_sub_matches) {
|
|
58 | 58 |
size = mresult.submatchSize(); |
59 | 59 |
} else { |
60 | 60 |
size = mresult.size(); |
tmp/org.txm.tigersearch.rcp/groovy/org/txm/macro/tiger/exploit/TIGERRatioMacro.groovy (revision 2346) | ||
---|---|---|
29 | 29 |
String tiger_query_A |
30 | 30 |
@Field @Option(name="tiger_query_B", usage="A Full TIGERSearch query", widget="Text", required=true, def="[]") |
31 | 31 |
String tiger_query_B |
32 |
@Field @Option(name="count_subgraph", usage="A Full TIGERSearch query", widget="Boolean", required=true, def="true")
|
|
33 |
def count_subgraph
|
|
32 |
@Field @Option(name="count_sub_matches", usage="A Full TIGERSearch query", widget="Boolean", required=true, def="true")
|
|
33 |
def count_sub_matches
|
|
34 | 34 |
@Field @Option(name="debug", usage="Show internal variable content", widget="StringArray", metaVar="OFF ON ALL REALLY ALL", required=true, def="OFF") |
35 | 35 |
debug |
36 | 36 |
if (!ParametersDialog.open(this)) return |
37 | 37 |
if (debug == "OFF") debug = 0; else if (debug == "ON") debug = 1; else if (debug == "ALL") debug = 2 else if (debug == "REALLY ALL") debug = 3 |
38 | 38 |
|
39 | 39 |
|
40 |
def results_A = gse.run(TIGERSummaryMacro, ["args":["tiger_query":tiger_query_A, "count_subgraph":count_subgraph, "debug":debug],
|
|
40 |
def results_A = gse.run(TIGERSummaryMacro, ["args":["tiger_query":tiger_query_A, "count_sub_matches":count_sub_matches, "debug":debug],
|
|
41 | 41 |
"selection":selection, |
42 | 42 |
"selections":selections, |
43 | 43 |
"corpusViewSelection":corpusViewSelection, |
44 | 44 |
"corpusViewSelections":corpusViewSelections, |
45 | 45 |
"monitor":monitor]) |
46 | 46 |
|
47 |
def results_B = gse.run(TIGERSummaryMacro, ["args":["tiger_query":tiger_query_B, "count_subgraph":count_subgraph, "debug":debug],
|
|
47 |
def results_B = gse.run(TIGERSummaryMacro, ["args":["tiger_query":tiger_query_B, "count_sub_matches":count_sub_matches, "debug":debug],
|
|
48 | 48 |
"selection":selection, |
49 | 49 |
"selections":selections, |
50 | 50 |
"corpusViewSelection":corpusViewSelection, |
tmp/org.txm.tigersearch.rcp/groovy/org/txm/macro/tiger/exploit/TIGERSVOSummaryMacro.groovy (revision 2346) | ||
---|---|---|
6 | 6 |
|
7 | 7 |
import groovy.transform.Field |
8 | 8 |
|
9 |
import org.txm.libs.office.WriteODS |
|
9 | 10 |
import org.txm.searchengine.core.SearchEnginesManager |
10 | 11 |
import org.txm.searchengine.cqp.corpus.* |
11 | 12 |
import org.txm.searchengine.ts.TIGERSearchEngine |
13 |
import org.txm.utils.ConsoleProgressBar |
|
12 | 14 |
import org.txm.utils.TableReader |
13 | 15 |
|
14 | 16 |
def scriptName = this.class.getSimpleName() |
... | ... | |
26 | 28 |
for (def c : selection) c.compute(false) |
27 | 29 |
} |
28 | 30 |
|
31 |
@Field @Option(name="new_ods_file", usage="file to create", widget="FileSave", required=true, def="result.ods") |
|
32 |
def new_ods_file |
|
29 | 33 |
@Field @Option(name="query_table_file", usage="A Full TIGERSearch query", widget="FileOpen", required=true, def="queries.ods") |
30 | 34 |
def query_table_file |
31 |
@Field @Option(name="count_subgraph", usage="A Full TIGERSearch query", widget="Boolean", required=true, def="true")
|
|
32 |
def count_subgraph
|
|
33 |
@Field @Option(name="sujet_value", usage="", widget="String", required=true, def=".*subj.*")
|
|
35 |
@Field @Option(name="count_sub_matches", usage="A Full TIGERSearch query", widget="Boolean", required=true, def="true")
|
|
36 |
def count_sub_matches
|
|
37 |
@Field @Option(name="sujet_value", usage="", widget="String", required=true, def="[cat=(\"nsubj\"|\"csubj\")]")
|
|
34 | 38 |
def sujet_value |
35 |
@Field @Option(name="object_value", usage="", widget="String", required=true, def=".*obj.*")
|
|
39 |
@Field @Option(name="object_value", usage="", widget="String", required=true, def="[cat=(\"obj\"|\"ccomp\"|\"obj\\\\:advneg\"|\"obj\\\\:advmod\")]")
|
|
36 | 40 |
def object_value |
37 |
@Field @Option(name="proposition_type", usage="", widget="String", required=true, def=".*") |
|
38 |
def proposition_type |
|
39 |
@Field @Option(name="proposition_subordonee", usage="", widget="StringArray", metaVar="Sans Seulement Avec", required=true, def="Sans") |
|
40 |
def proposition_subordonee |
|
41 |
@Field @Option(name="coordinations", usage="", widget="StringArray", metaVar="Sans Seulement Avec", required=true, def="Sans") |
|
42 |
def coordinations |
|
41 |
@Field @Option(name="clauses_count_main", usage="", widget="Boolean", required=true, def="true") |
|
42 |
def clauses_count_main |
|
43 |
@Field @Option(name="clauses_count_subordinate", usage="", widget="Boolean", required=true, def="false") |
|
44 |
def clauses_count_subordinate |
|
45 |
@Field @Option(name="clauses_count_inserted", usage="", widget="Boolean", required=true, def="false") |
|
46 |
def clauses_count_inserted |
|
47 |
@Field @Option(name="print_queries", usage="insert columns with the used queries", widget="Boolean", required=true, def="true") |
|
48 |
def print_queries |
|
43 | 49 |
@Field @Option(name="debug", usage="Show internal variable content", widget="StringArray", metaVar="OFF ON ALL REALLY ALL", required=true, def="OFF") |
44 | 50 |
debug |
45 | 51 |
|
46 | 52 |
if (!ParametersDialog.open(this)) return |
53 |
|
|
47 | 54 |
if (debug == "OFF") debug = 0; else if (debug == "ON") debug = 1; else if (debug == "ALL") debug = 2 else if (debug == "REALLY ALL") debug = 3 |
48 | 55 |
|
49 |
TIGERSearchEngine tse = SearchEnginesManager.getTIGERSearchEngine() |
|
56 |
if (!clauses_count_main && !clauses_count_subordinate && !clauses_count_inserted) { |
|
57 |
println "Error: at least one clause must be selected" |
|
58 |
return |
|
59 |
} |
|
50 | 60 |
|
51 |
String based_query = """#pivot:[pos="VERB"] & #clause:[cat="root" & type="VFin"] & #clause >L #pivot & #clause >D #obj:[cat=("obj"|"ccomp"|"obj\\:advneg"|"obj\\:advmod")] & #clause >D #suj:[cat=("nsubj"|"csubj")] & #obj >L #objhead:[] & #suj >L #sujhead:[]""" |
|
61 |
String based_query = """#pivot:[pos="VERB"] |
|
62 |
& #clause:CLAUSEVALUE |
|
63 |
& #clause >L #pivot |
|
64 |
& #clause >D #obj:OBJVALUE |
|
65 |
& #clause >D #suj:SUJVALUE |
|
66 |
& #obj >L #objhead:[] & #suj >L #sujhead:[]""" |
|
67 |
|
|
68 |
String clause_value = "[cat=\"root\" & type=\"VFin\"]" // main clause |
|
69 |
if (clauses_count_inserted) { |
|
70 |
clause_value = "[cat=\"Insrt\" & type=\"VFin\"]" |
|
71 |
} else if (clauses_count_subordinate) { |
|
72 |
clause_value = "[cat!=(\"root\"|\"Insrt\") & type=\"VFin\"]" |
|
73 |
} |
|
74 |
based_query = based_query.replaceAll("CLAUSEVALUE", clause_value) |
|
75 |
based_query = based_query.replaceAll("OBJVALUE", object_value) |
|
76 |
based_query = based_query.replaceAll("SUJVALUE", sujet_value) |
|
77 |
|
|
52 | 78 |
println "based_query=$based_query" |
53 | 79 |
def SVO_queries = new LinkedHashMap<String, String>() |
54 | 80 |
SVO_queries["SVO"] = "& #sujhead .* #pivot & #pivot .* #objhead" |
... | ... | |
57 | 83 |
SVO_queries["OVS"] = "& #objhead .* #pivot & #pivot .* #sujhead" |
58 | 84 |
SVO_queries["VSO"] = "& #pivot .* #sujhead & #sujhead .* #objhead" |
59 | 85 |
SVO_queries["VOS"] = "& #pivot .* #objhead & #objhead .* #sujhead" |
60 |
|
|
86 |
int ncols = 2 + (SVO_queries.keySet().size() * (print_queries?2:1)) |
|
87 |
|
|
61 | 88 |
def test_queries = [] |
62 | 89 |
TableReader reader = new TableReader(query_table_file) |
63 | 90 |
reader.readHeaders() |
91 |
|
|
92 |
WriteODS writer = new WriteODS(new_ods_file); |
|
93 |
|
|
64 | 94 |
def headers = reader.getHeaders() |
65 | 95 |
if (!(headers.contains("mesure") && headers.contains("valeur") && headers.contains("requête"))) { // mesure, valeur, requête |
66 | 96 |
println "Error: 'mesure', 'valeur', 'requête' columns not found" |
67 | 97 |
return |
68 | 98 |
} |
69 | 99 |
while (reader.readRecord()) { |
70 |
test_queries << [reader.get("mesure"), reader.get("valeur"), reader.get("requête")] |
|
100 |
test_queries << [ |
|
101 |
reader.get("mesure"), |
|
102 |
reader.get("valeur"), |
|
103 |
reader.get("requête") |
|
104 |
] |
|
71 | 105 |
} |
72 | 106 |
|
73 |
println "mesure valeur SVO SOV OSV OVS VSO VOS"
|
|
107 |
ConsoleProgressBar cpb = new ConsoleProgressBar(selection.size())
|
|
74 | 108 |
|
109 |
|
|
110 |
TIGERSearchEngine tse = SearchEnginesManager.getTIGERSearchEngine() |
|
75 | 111 |
def results = new LinkedHashMap() |
76 | 112 |
for (def corpus : selection) { |
113 |
cpb.tick() |
|
77 | 114 |
|
115 |
writer.newTable(corpus.getName()) |
|
116 |
|
|
78 | 117 |
def root = corpus.getRootCorpusBuild(); |
79 | 118 |
File buildDirectory = new File(root.getProjectDirectory(), "tiger"); |
80 | 119 |
|
... | ... | |
83 | 122 |
continue; |
84 | 123 |
} |
85 | 124 |
|
125 |
writer.declareRowsAndColumns(0, ncols) |
|
126 |
def cols = ["mesure", "valeur"] |
|
127 |
for (String col : SVO_queries.keySet()) { |
|
128 |
if (print_queries) cols << "q"+col |
|
129 |
cols << col |
|
130 |
} |
|
131 |
writer.writeLine(cols) |
|
132 |
|
|
86 | 133 |
def tcorpus = tse.getTSCorpus(corpus); |
87 | 134 |
def based_sentences_min_max = tse.getSentMinMax(corpus); |
88 | 135 |
|
89 | 136 |
for (def test : test_queries) { |
90 | 137 |
def test_query = test[2] |
138 |
def lineToWrite = [] |
|
139 |
lineToWrite << test[0] |
|
140 |
lineToWrite << test[1] |
|
91 | 141 |
|
92 |
print test[0]+"\t"+test[1] |
|
93 |
|
|
94 | 142 |
for (def k : SVO_queries.keySet()) { |
95 | 143 |
def svo_query = based_query+"\n"+SVO_queries[k]+"\n"+test_query |
96 |
|
|
144 |
|
|
145 |
if (debug > 0) println svo_query |
|
146 |
|
|
97 | 147 |
def test_result = tcorpus.manager.processQuery(svo_query, based_sentences_min_max[0], based_sentences_min_max[1], 9999999); |
98 |
if (count_subgraph) { |
|
99 |
print " "+test_result.submatchSize() |
|
148 |
if (print_queries) lineToWrite << svo_query |
|
149 |
if (count_sub_matches) { |
|
150 |
lineToWrite << test_result.submatchSize() |
|
100 | 151 |
} else { |
101 |
print " "+test_result.size()
|
|
152 |
lineToWrite << test_result.size()
|
|
102 | 153 |
} |
103 | 154 |
} |
104 |
println "" |
|
105 |
|
|
106 |
// for (def svo_match : svo_result.getMatches()) { |
|
107 |
// |
|
108 |
// } |
|
155 |
|
|
156 |
writer.writeLine(lineToWrite) |
|
109 | 157 |
} |
110 | 158 |
} |
111 | 159 |
|
112 |
println "" |
|
160 |
writer.save() |
|
161 |
cpb.done() |
|
113 | 162 |
|
114 |
println "Done." |
|
115 |
|
|
116 | 163 |
return results |
tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 2346) | ||
---|---|---|
141 | 141 |
return tsresult.getNumberOfMatch(); |
142 | 142 |
} |
143 | 143 |
|
144 |
public int getNSubGraph() { |
|
144 |
public int getNSubGraph(int matchNo) {
|
|
145 | 145 |
if (tsresult == null) return 0; |
146 |
if (tsresult.getCurrentMatch() == null) return 0;
|
|
146 |
if (tsresult.getMatch(matchNo) == null) return 0;
|
|
147 | 147 |
|
148 |
return tsresult.getCurrentMatch().getNumberOfSubGraph();
|
|
148 |
return tsresult.getMatch(matchNo).getNumberOfSubGraph();
|
|
149 | 149 |
} |
150 | 150 |
|
151 |
public int getSent() { |
|
152 |
if (tsresult == null) return 0; |
|
153 |
return tsresult.getCurrentMatchNo(); |
|
154 |
} |
|
151 |
// public int getSent() {
|
|
152 |
// if (tsresult == null) return 0;
|
|
153 |
// return tsresult.getCurrentMatchNo();
|
|
154 |
// }
|
|
155 | 155 |
|
156 |
public int getSub() { |
|
156 |
public int getSub(int matchNo) {
|
|
157 | 157 |
if (tsresult == null) return 0; |
158 |
return tsresult.getCurrentMatch().getCurrentSubMatchNo(); |
|
158 |
if (tsresult.getMatch(matchNo) == null) return 0; |
|
159 |
|
|
160 |
return tsresult.getMatch(matchNo).getCurrentSubMatchNo(); |
|
159 | 161 |
} |
160 | 162 |
|
161 | 163 |
public String getQuery() { |
... | ... | |
210 | 212 |
|
211 | 213 |
@Override |
212 | 214 |
public boolean canCompute() { |
213 |
return corpus != null && pQuery != null && pQuery.length() > 0;
|
|
215 |
return corpus != null; // && pQuery != null && pQuery.length() > 0; // if pQuery is empty/null set a default query
|
|
214 | 216 |
} |
215 | 217 |
|
216 | 218 |
@Override |
... | ... | |
235 | 237 |
protected boolean _compute() throws Exception { |
236 | 238 |
|
237 | 239 |
if (tscorpus == null) return false; |
240 |
|
|
238 | 241 |
tsresult = null; |
239 |
if (pQuery.length() == 0) { |
|
240 |
return false; |
|
242 |
|
|
243 |
if (pQuery == null || pQuery.length() == 0) { |
|
244 |
pQuery = "root(#n1)"; |
|
241 | 245 |
} |
242 | 246 |
tsresult = tscorpus.query(pQuery); |
243 | 247 |
tsresult.getFirst(); |
... | ... | |
248 | 252 |
public String getResultType() { |
249 | 253 |
return "Tiger search"; |
250 | 254 |
} |
251 |
|
|
252 | 255 |
} |
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TSResult.java (revision 2346) | ||
---|---|---|
50 | 50 |
import org.txm.core.messages.TXMCoreMessages; |
51 | 51 |
import org.txm.importer.ApplyXsl2; |
52 | 52 |
|
53 |
// TODO: Auto-generated Javadoc |
|
54 | 53 |
/** |
55 | 54 |
* The Class TSResult. |
56 | 55 |
*/ |
... | ... | |
71 | 70 |
/** The matches. */ |
72 | 71 |
TSMatch[] matches; |
73 | 72 |
|
74 |
/** The current match. */ |
|
75 |
int currentMatchNo = 0; |
|
76 |
TSMatch currentMatch; |
|
73 |
// /** The current match. */
|
|
74 |
// int currentMatchNo = 0;
|
|
75 |
// TSMatch currentMatch;
|
|
77 | 76 |
|
78 | 77 |
/** The query. */ |
79 | 78 |
private String query; |
... | ... | |
139 | 138 |
return result.size(); |
140 | 139 |
} |
141 | 140 |
|
142 |
/** |
|
143 |
* return the no of match, begins with 1. |
|
144 |
* |
|
145 |
* @return the current match no |
|
146 |
*/ |
|
147 |
public int getCurrentMatchNo() { |
|
148 |
return currentMatchNo; |
|
149 |
} |
|
141 |
// /** |
|
142 |
// * return the no of match, begins with 1. |
|
143 |
// * |
|
144 |
// * @return the current match no |
|
145 |
// */ |
|
146 |
// public int getCurrentMatchNo() { |
|
147 |
// return currentMatchNo; |
|
148 |
// } |
|
149 |
// |
|
150 |
// /** |
|
151 |
// * return the no of match, begins with 1. |
|
152 |
// * |
|
153 |
// * @return the current match no |
|
154 |
// */ |
|
155 |
// public TSMatch getCurrentMatch() { |
|
156 |
// return currentMatch; |
|
157 |
// } |
|
150 | 158 |
|
151 |
/** |
|
152 |
* return the no of match, begins with 1. |
|
153 |
* |
|
154 |
* @return the current match no |
|
155 |
*/ |
|
156 |
public TSMatch getCurrentMatch() { |
|
157 |
return currentMatch; |
|
158 |
} |
|
159 |
// /** |
|
160 |
// * return the no of match, begins with 1. |
|
161 |
// * |
|
162 |
// * @return the current sentence no |
|
163 |
// */ |
|
164 |
// public int getCurrentSentenceNo() { |
|
165 |
// System.out.println(TXMCoreMessages.numberOfMatch+this.getNumberOfMatch()); |
|
166 |
// System.out.println("current match "+this.getCurrentMatchNo()); //$NON-NLS-1$ |
|
167 |
// System.out.println(TXMCoreMessages.numberOfSubMatch+this.getCurrentMatch().getNumberOfSubGraph()); |
|
168 |
// System.out.println("current sub graph "+this.getCurrentMatch().getCurrentSubMatchNo()); //$NON-NLS-1$ |
|
169 |
// return result.getSentenceNumberAt(this.currentMatchNo); // + 1 ? |
|
170 |
// } |
|
159 | 171 |
|
160 | 172 |
/** |
161 |
* return the no of match, begins with 1. |
|
162 |
* |
|
163 |
* @return the current sentence no |
|
164 |
*/ |
|
165 |
public int getCurrentSentenceNo() { |
|
166 |
System.out.println(TXMCoreMessages.numberOfMatch+this.getNumberOfMatch()); |
|
167 |
System.out.println("current match "+this.getCurrentMatchNo()); //$NON-NLS-1$ |
|
168 |
System.out.println(TXMCoreMessages.numberOfSubMatch+this.getCurrentMatch().getNumberOfSubGraph()); |
|
169 |
System.out.println("current sub graph "+this.getCurrentMatch().getCurrentSubMatchNo()); //$NON-NLS-1$ |
|
170 |
return result.getSentenceNumberAt(this.currentMatchNo); // + 1 ? |
|
171 |
} |
|
172 |
|
|
173 |
/** |
|
174 | 173 |
* Gets the match. |
175 | 174 |
* |
176 | 175 |
* @param matchNo the no |
... | ... | |
198 | 197 |
public TSMatch getFirst() |
199 | 198 |
{ |
200 | 199 |
if (result.size() > 0) { |
201 |
currentMatchNo = 0; |
|
202 |
currentMatch = getMatch(0); |
|
203 |
return currentMatch;
|
|
200 |
// currentMatchNo = 0;
|
|
201 |
// currentMatch = getMatch(0);
|
|
202 |
return getMatch(0);
|
|
204 | 203 |
} else { |
205 | 204 |
return null; |
206 | 205 |
} |
... | ... | |
214 | 213 |
public TSMatch getLast() |
215 | 214 |
{ |
216 | 215 |
if (result.size() > 0) { |
217 |
currentMatchNo = result.size() -1; |
|
218 |
currentMatch = getMatch(result.size() -1); |
|
219 |
return currentMatch;
|
|
216 |
// currentMatchNo = result.size() -1;
|
|
217 |
// currentMatch = getMatch(result.size() -1);
|
|
218 |
return getMatch(result.size() -1);
|
|
220 | 219 |
} else { |
221 | 220 |
return null; |
222 | 221 |
} |
223 | 222 |
} |
223 |
// |
|
224 |
// /** |
|
225 |
// * Gets the next. |
|
226 |
// * |
|
227 |
// * @return the next |
|
228 |
// */ |
|
229 |
// public TSMatch getNext() |
|
230 |
// { |
|
231 |
// int next = currentMatchNo + 1; |
|
232 |
// if (result.size() > next) { |
|
233 |
// currentMatchNo = next; |
|
234 |
// currentMatch = getMatch(next); |
|
235 |
// return currentMatch; |
|
236 |
// } else { |
|
237 |
// return null; |
|
238 |
// } |
|
239 |
// } |
|
240 |
// |
|
241 |
// /** |
|
242 |
// * Gets the previous. |
|
243 |
// * |
|
244 |
// * @return the previous |
|
245 |
// */ |
|
246 |
// public TSMatch getPrevious() |
|
247 |
// { |
|
248 |
// int next = currentMatchNo - 1; |
|
249 |
// if (next >= 0 && result.size() > 0) { |
|
250 |
// currentMatchNo = next; |
|
251 |
// currentMatch = getMatch(next); |
|
252 |
// return currentMatch; |
|
253 |
// } else { |
|
254 |
// return null; |
|
255 |
// } |
|
256 |
// } |
|
257 |
// |
|
258 |
// public TSMatch setCurrentMatch(int graphNo) { |
|
259 |
// currentMatch = this.getMatch(graphNo); |
|
260 |
// currentMatchNo = graphNo; |
|
261 |
// return currentMatch; |
|
262 |
// } |
|
224 | 263 |
|
225 |
/** |
|
226 |
* Gets the next. |
|
227 |
* |
|
228 |
* @return the next |
|
229 |
*/ |
|
230 |
public TSMatch getNext() |
|
231 |
{ |
|
232 |
int next = currentMatchNo + 1; |
|
233 |
if (result.size() > next) { |
|
234 |
currentMatchNo = next; |
|
235 |
currentMatch = getMatch(next); |
|
236 |
return currentMatch; |
|
237 |
} else { |
|
238 |
return null; |
|
239 |
} |
|
240 |
} |
|
241 |
|
|
242 |
/** |
|
243 |
* Gets the previous. |
|
244 |
* |
|
245 |
* @return the previous |
|
246 |
*/ |
|
247 |
public TSMatch getPrevious() |
|
248 |
{ |
|
249 |
int next = currentMatchNo - 1; |
|
250 |
if (next >= 0 && result.size() > 0) { |
|
251 |
currentMatchNo = next; |
|
252 |
currentMatch = getMatch(next); |
|
253 |
return currentMatch; |
|
254 |
} else { |
|
255 |
return null; |
|
256 |
} |
|
257 |
} |
|
258 |
|
|
259 |
public TSMatch setCurrentMatch(int graphNo) { |
|
260 |
currentMatch = this.getMatch(graphNo); |
|
261 |
currentMatchNo = graphNo; |
|
262 |
return currentMatch; |
|
263 |
} |
|
264 |
|
|
265 | 264 |
public boolean toXml(File outfile, File xmlFile, File xslFile) throws ExportException, ExportStopException, IOException, TransformerException |
266 | 265 |
{ |
267 | 266 |
return toXml(outfile, xmlFile, xslFile, false, 30, new ArrayList<String>(), new ArrayList<String>()); |
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TIGERSearchEditor.java (revision 2346) | ||
---|---|---|
99 | 99 |
|
100 | 100 |
@Override |
101 | 101 |
public void widgetSelected(SelectionEvent e) { |
102 |
if (e.widget == sentSpinner) { |
|
103 |
subSpinner.setSelection(1); |
|
104 |
subSpinner.setMaximum(ts.getNSubGraph(sentSpinner.getSelection()-1)); |
|
105 |
subCounterLabel.setText("/"+ts.getNSubGraph(sentSpinner.getSelection()-1)); |
|
106 |
} |
|
102 | 107 |
reloadGraph(); |
103 | 108 |
} |
104 | 109 |
|
... | ... | |
137 | 142 |
NTCombo.setLayoutData(gdata); |
138 | 143 |
NTCombo.addSelectionListener(selChangedListener); |
139 | 144 |
|
140 |
okButton = new Button(queryPanel, SWT.PUSH); |
|
141 |
okButton.setText("Search"); |
|
142 |
okButton.addSelectionListener(new SelectionListener() { |
|
143 |
@Override |
|
144 |
public void widgetSelected(SelectionEvent e) { |
|
145 |
compute(true); |
|
146 |
} |
|
147 |
|
|
148 |
@Override |
|
149 |
public void widgetDefaultSelected(SelectionEvent e) { } |
|
150 |
}); |
|
151 | 145 |
queryArea.addListener(SWT.KeyDown, new Listener() { |
152 | 146 |
public void handleEvent(Event e) { |
153 |
if (e.stateMask == SWT.CTRL) |
|
147 |
if (e.stateMask == SWT.CTRL) {
|
|
154 | 148 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { |
155 | 149 |
e.doit = false; |
156 | 150 |
compute(true); |
157 | 151 |
} |
152 |
} |
|
158 | 153 |
} |
159 | 154 |
}); |
160 | 155 |
|
... | ... | |
163 | 158 |
svgPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
164 | 159 |
|
165 | 160 |
initializeFields(); |
161 |
this.getTopToolbar().setVisible(COMPUTING_PARAMETERS_GROUP_ID, true); |
|
166 | 162 |
} |
167 | 163 |
|
168 | 164 |
protected void initializeFields() { |
... | ... | |
216 | 212 |
if (ts.isComputed()) { |
217 | 213 |
queryArea.setText(ts.getQuery()); |
218 | 214 |
sentCounterLabel.setText("/"+ts.getNSentences()); |
219 |
subCounterLabel.setText("/"+ts.getNSubGraph()); |
|
215 |
subCounterLabel.setText("/"+ts.getNSubGraph(0));
|
|
220 | 216 |
} else { |
221 | 217 |
sentCounterLabel.setText("No Sentence"); |
222 | 218 |
subCounterLabel.setText("No sub graph"); |
223 | 219 |
} |
224 | 220 |
|
225 | 221 |
if (ts.isDrawn()) { |
226 |
sentSpinner.setSelection(ts.getSent());
|
|
222 |
sentSpinner.setSelection(1);
|
|
227 | 223 |
sentSpinner.setMaximum(ts.getNSentences()); |
228 |
subSpinner.setSelection(ts.getSub()); |
|
229 |
subSpinner.setMaximum(ts.getNSubGraph()); |
|
224 |
subSpinner.setSelection(ts.getSub(0));
|
|
225 |
subSpinner.setMaximum(ts.getNSubGraph(0));
|
|
230 | 226 |
|
231 | 227 |
reloadGraph(); |
232 | 228 |
} else { |
... | ... | |
234 | 230 |
subSpinner.setSelection(1); |
235 | 231 |
if (ts.isComputed()) { |
236 | 232 |
sentSpinner.setMaximum(ts.getNSentences()); |
237 |
subSpinner.setMaximum(ts.getNSubGraph()); |
|
233 |
subSpinner.setMaximum(ts.getNSubGraph(0));
|
|
238 | 234 |
} else { |
239 | 235 |
sentSpinner.setMaximum(1); |
240 | 236 |
subSpinner.setMaximum(1); |
... | ... | |
268 | 264 |
@Override |
269 | 265 |
public void updateResultFromEditor() { |
270 | 266 |
|
271 |
reloadGraph(); |
|
267 |
String query = this.queryArea.getText(); |
|
268 |
this.queryArea.setText(query.trim()); |
|
272 | 269 |
} |
273 | 270 |
|
274 | 271 |
@Override |
... | ... | |
298 | 295 |
// public void run() { |
299 | 296 |
|
300 | 297 |
sentCounterLabel.setText("/"+ts.getNSentences()); |
301 |
subCounterLabel.setText("/"+ts.getNSubGraph()); |
|
298 |
subCounterLabel.setText("/"+ts.getNSubGraph(0));
|
|
302 | 299 |
sentSpinner.setSelection(1); |
303 | 300 |
sentSpinner.setMaximum(ts.getNSentences()); |
304 | 301 |
subSpinner.setSelection(1); |
305 |
subSpinner.setMaximum(ts.getNSubGraph()); |
|
302 |
subSpinner.setMaximum(ts.getNSubGraph(0));
|
|
306 | 303 |
|
307 | 304 |
reloadGraph(); |
308 | 305 |
|
Formats disponibles : Unified diff