Révision 3546
TXM/trunk/org.txm.treesearch.core/src/org/txm/treesearch/function/TreeSearch.java (revision 3546) | ||
---|---|---|
153 | 153 |
} |
154 | 154 |
|
155 | 155 |
public abstract Selection getSelection(); |
156 |
|
|
157 |
public abstract File createTemporaryFile(File resultDir); |
|
156 | 158 |
|
157 | 159 |
} |
TXM/trunk/org.txm.rcp/plugin.xml (revision 3546) | ||
---|---|---|
1939 | 1939 |
label="%command.label.172" |
1940 | 1940 |
style="push" |
1941 | 1941 |
tooltip="%command.tooltip.37"> |
1942 |
<visibleWhen |
|
1943 |
checkEnabled="false"> |
|
1944 |
<reference |
|
1945 |
definitionId="TextEditorActive"> |
|
1946 |
</reference> |
|
1947 |
</visibleWhen> |
|
1948 | 1942 |
</command> |
1949 | 1943 |
<command |
1950 | 1944 |
commandId="org.txm.rcp.commands.ExecuteLastGroovyScript" |
TXM/trunk/org.txm.rcp/META-INF/MANIFEST.MF (revision 3546) | ||
---|---|---|
147 | 147 |
org.txm.treetagger.core;visibility:=reexport, |
148 | 148 |
org.eclipse.equinox.p2.discovery.compatibility;bundle-version="1.0.201";visibility:=reexport, |
149 | 149 |
org.eclipse.e4.ui.workbench.renderers.swt;visibility:=reexport, |
150 |
javax.annotation;bundle-version="1.2.0";visibility:=reexport |
|
150 |
javax.annotation;bundle-version="1.2.0";visibility:=reexport, |
|
151 |
org.eclipse.ui.net;bundle-version="1.3.300" |
|
151 | 152 |
Bundle-ActivationPolicy: lazy |
152 | 153 |
Bundle-ManifestVersion: 2 |
153 | 154 |
Bundle-Activator: org.txm.rcp.Activator |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java (revision 3546) | ||
---|---|---|
164 | 164 |
// |
165 | 165 |
String scriptRootDir = Toolbox.getTxmHomePath() + "/scripts"; //$NON-NLS-1$ |
166 | 166 |
File currentRootDir = new File(scriptRootDir, "groovy/user"); //$NON-NLS-1$ |
167 |
|
|
167 |
if (stringArgs == null) stringArgs = ""; |
|
168 | 168 |
return executeScript(currentRootDir, scriptpath, page, selection, modal, Arrays.asList(stringArgs.split("\t")), null, null); |
169 | 169 |
} |
170 | 170 |
|
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyText.java (revision 3546) | ||
---|---|---|
136 | 136 |
binding.setVariable("corpusViewSelections", corpusViewSelections); //$NON-NLS-1$ |
137 | 137 |
binding.setProperty("monitor", this); //$NON-NLS-1$ |
138 | 138 |
//binding.setProperty("gse", gse); |
139 |
GroovyShell shell = new GroovyShell(this.getClass() |
|
140 |
.getClassLoader(), binding); |
|
139 |
GroovyShell shell = new GroovyShell(this.getClass().getClassLoader(), binding); |
|
141 | 140 |
|
142 | 141 |
for (File file : classPath) { |
143 | 142 |
try { |
... | ... | |
148 | 147 |
return null; |
149 | 148 |
} |
150 | 149 |
} |
151 |
|
|
150 |
|
|
152 | 151 |
// try { |
153 | 152 |
System.out.println("Executing text selection..."); //$NON-NLS-1$ |
154 | 153 |
long time = System.currentTimeMillis(); |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScriptFromFile.java (revision 3546) | ||
---|---|---|
42 | 42 |
import org.txm.core.preferences.TBXPreferences; |
43 | 43 |
import org.txm.core.preferences.TXMPreferences; |
44 | 44 |
import org.txm.rcp.swt.dialog.LastOpened; |
45 |
import org.txm.utils.io.IOUtils; |
|
45 | 46 |
/** |
46 | 47 |
* Ask the user to select a Groovy script using a File dialog and execute it |
47 | 48 |
*/ |
... | ... | |
78 | 79 |
if (result == null) return null; |
79 | 80 |
|
80 | 81 |
LastOpened.set(ID, new File(result)); |
81 |
ExecuteGroovyScript.executeScript(result, page, selection); |
|
82 |
try { |
|
83 |
String content = IOUtils.getText(new File(result)); |
|
84 |
//ExecuteGroovyScript.executeScript(result, page, selection); |
|
85 |
ExecuteText.executeText(content, result); |
|
86 |
} catch (Throwable e) { |
|
87 |
e.printStackTrace(); |
|
88 |
} |
|
82 | 89 |
return null; |
83 | 90 |
} |
84 | 91 |
} |
TXM/trunk/org.txm.udpipe.core/src/org/txm/udpipe/core/TestREST.java (revision 3546) | ||
---|---|---|
496 | 496 |
for (int i = 0; i < names.length(); i++) { |
497 | 497 |
System.out.println(names.get(i)); |
498 | 498 |
|
499 |
System.out.println(process(target, names.get(i).toString(), "La petite brise la glace."));
|
|
499 |
System.out.println(process(target, names.get(i).toString(), string));
|
|
500 | 500 |
} |
501 | 501 |
} |
502 | 502 |
catch (JSONException e) { |
TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 3546) | ||
---|---|---|
1 | 1 |
package org.txm.function.tigersearch; |
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 |
import java.io.IOException; |
|
4 | 5 |
import java.nio.MappedByteBuffer; |
5 | 6 |
import java.util.ArrayList; |
6 | 7 |
import java.util.Arrays; |
... | ... | |
332 | 333 |
// TODO Auto-generated method stub |
333 | 334 |
return null; |
334 | 335 |
} |
336 |
|
|
337 |
@Override |
|
338 |
public File createTemporaryFile(File resultDir) { |
|
339 |
|
|
340 |
try { |
|
341 |
return File.createTempFile("TIGERSearch", ".svg", resultDir); |
|
342 |
} |
|
343 |
catch (IOException e) { |
|
344 |
// TODO Auto-generated catch block |
|
345 |
e.printStackTrace(); |
|
346 |
return null; |
|
347 |
} //$NON-NLS-1$ //$NON-NLS-2$ull; |
|
348 |
} |
|
335 | 349 |
} |
TXM/trunk/org.txm.conllu.rcp/src/org/txm/conllu/rcp/preferences/UDTreePreferencePage.java (revision 3546) | ||
---|---|---|
5 | 5 |
import org.eclipse.ui.IWorkbench; |
6 | 6 |
import org.txm.conllu.core.preferences.UDTreePreferences; |
7 | 7 |
import org.txm.rcp.IImageKeys; |
8 |
import org.txm.rcp.jface.ComboFieldEditor; |
|
8 | 9 |
import org.txm.rcp.preferences.TXMPreferencePage; |
9 | 10 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
10 | 11 |
|
... | ... | |
19 | 20 |
@Override |
20 | 21 |
public void createFieldEditors() { |
21 | 22 |
|
22 |
this.addField(new StringFieldEditor(UDTreePreferences.ENGINE, "Engine", this.getFieldEditorParent()));
|
|
23 |
String[][] values = {{"DepTreeViz", UDTreePreferences.DEPTREEVIZ}, {"Brat", UDTreePreferences.BRAT}};
|
|
23 | 24 |
|
25 |
this.addField(new ComboFieldEditor(UDTreePreferences.ENGINE, "Engine", values, this.getFieldEditorParent())); |
|
26 |
|
|
24 | 27 |
this.addField(new BooleanFieldEditor(UDTreePreferences.PRINTCONLLUSENTENCES, "Print CoNLL-U sentence when browsing the matches", this.getFieldEditorParent())); |
25 | 28 |
} |
26 | 29 |
|
TXM/trunk/org.txm.conllu.rcp/src/org/txm/conllu/rcp/preferences/CoNLLUPreferencePage.java (revision 3546) | ||
---|---|---|
20 | 20 |
public void createFieldEditors() { |
21 | 21 |
|
22 | 22 |
this.addField(new BooleanFieldEditor(UDPreferences.IMPORT_USE_NEW_DOC_ID, "Use new odc id when importing CoNLL-U files", this.getFieldEditorParent())); |
23 |
this.addField(new BooleanFieldEditor(UDPreferences.IMPORT_BUILD_TIGERSEARCH_INDEXES, "Build TIGERSearch indexes as well", this.getFieldEditorParent())); |
|
24 |
|
|
23 | 25 |
this.addField(new BooleanFieldEditor(UDPreferences.KEEP_CONTRACTIONS, "Keep word contractions when importing CoNLL-U files", this.getFieldEditorParent())); |
24 | 26 |
this.addField(new StringFieldEditor(UDPreferences.UDPREFIX, "UD properties prefix", this.getFieldEditorParent())); |
25 | 27 |
this.addField(new StringFieldEditor(UDPreferences.IMPORT_HEAD_TO_PROJECT, "UD head properties to project (comma separated list)", this.getFieldEditorParent())); |
TXM/trunk/org.txm.connlu.core/plugin.xml (revision 3546) | ||
---|---|---|
20 | 20 |
<initializer |
21 | 21 |
class="org.txm.conllu.core.preferences.UDPreferences"> |
22 | 22 |
</initializer> |
23 |
<initializer |
|
24 |
class="org.txm.conllu.core.preferences.UDTreePreferences"> |
|
25 |
</initializer> |
|
23 | 26 |
</extension> |
24 | 27 |
|
25 | 28 |
</plugin> |
TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImport.groovy (revision 3546) | ||
---|---|---|
18 | 18 |
import org.txm.scripts.importer.tigersearch.TSImport |
19 | 19 |
import org.txm.utils.* |
20 | 20 |
import org.txm.searchengine.ts.TIGERSearchEngine |
21 |
import org.txm.conllu.core.preferences.UDPreferences |
|
21 | 22 |
import org.txm.tigersearch.preferences.TigerSearchPreferences |
22 | 23 |
import org.txm.conllu.core.CallUD2TigerPerlScript |
23 | 24 |
|
... | ... | |
58 | 59 |
|
59 | 60 |
println "Converting CoNLL-U files to TIGER-XML files..." |
60 | 61 |
|
61 |
cutps.convertCoNLLUFiles(this.sourceDirectory.listFiles(), this.binaryDirectory.getAbsolutePath()) |
|
62 |
File conlluDirectory = new File(this.binaryDirectory, "conllu") |
|
63 |
cutps.convertCoNLLUFiles(conlluDirectory.listFiles(), this.binaryDirectory.getAbsolutePath()) |
|
62 | 64 |
|
63 | 65 |
File tigerXMLDirectory = new File(this.binaryDirectory, "tiger-xml") |
64 | 66 |
String driverFilename = TigerSearchPreferences.getInstance().getString(TigerSearchPreferences.DRIVER_FILENAME); |
TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImporter.groovy (revision 3546) | ||
---|---|---|
156 | 156 |
if (words.size() > 0) { |
157 | 157 |
def sentence = [par_id, sent_id, words, comments] |
158 | 158 |
content.add(sentence) |
159 |
|
|
160 |
sent_id = ""; |
|
161 |
par_id = "1"; |
|
162 |
comments = []; |
|
163 |
words = [] |
|
159 | 164 |
} |
165 |
|
|
160 | 166 |
} else { |
161 | 167 |
|
162 | 168 |
HashMap<String, String> wProperties = new HashMap<String, String>() |
... | ... | |
172 | 178 |
if (words.size() > 0) { |
173 | 179 |
def sentence = [par_id, sent_id, words, comments] |
174 | 180 |
content.add(sentence) |
181 |
|
|
182 |
sent_id = ""; |
|
183 |
par_id = "1"; |
|
184 |
comments = []; |
|
185 |
words = [] |
|
175 | 186 |
} |
176 |
|
|
177 |
sent_id = ""; |
|
178 |
par_id = "1"; |
|
179 |
comments = []; |
|
180 |
words = [] |
|
181 | 187 |
} |
182 | 188 |
|
183 | 189 |
words << wProperties |
TXM/trunk/org.txm.connlu.core/src/org/txm/conllu/core/preferences/UDPreferences.java (revision 3546) | ||
---|---|---|
25 | 25 |
|
26 | 26 |
public static String IMPORT_DEPS_TO_PROJECT = "import_deps_to_project"; |
27 | 27 |
|
28 |
public static String IMPORT_BUILD_TIGERSEARCH_INDEXES = "import_build_tiger_indexes"; |
|
29 |
|
|
28 | 30 |
/** |
29 | 31 |
* Gets the instance. |
30 | 32 |
* |
... | ... | |
48 | 50 |
preferences.put(IMPORT_DEPS_TO_PROJECT, "upos,deprel"); |
49 | 51 |
preferences.putBoolean(KEEP_CONTRACTIONS, true); |
50 | 52 |
preferences.putBoolean(IMPORT_USE_NEW_DOC_ID, true); |
53 |
preferences.putBoolean(IMPORT_BUILD_TIGERSEARCH_INDEXES, true); |
|
51 | 54 |
} |
52 | 55 |
} |
TXM/trunk/org.txm.connlu.core/src/org/txm/conllu/core/preferences/UDTreePreferences.java (revision 3546) | ||
---|---|---|
16 | 16 |
public static final String DEPTREEVIZ = "deptreeviz"; |
17 | 17 |
public static final String BRAT = "brat"; |
18 | 18 |
|
19 |
public static final String ENGINE = "engine"; |
|
19 |
public static final String ENGINE = "visu_engine";
|
|
20 | 20 |
public static final String PRINTCONLLUSENTENCES = "print_ud_seentence"; |
21 | 21 |
|
22 | 22 |
/** |
... | ... | |
39 | 39 |
Preferences preferences = this.getDefaultPreferencesNode(); |
40 | 40 |
preferences.put(ENGINE, DEPTREEVIZ); |
41 | 41 |
preferences.putBoolean(PRINTCONLLUSENTENCES, false); |
42 |
preferences.put(TFEATURE, "word");
|
|
42 |
preferences.put(TFEATURE, ""); |
|
43 | 43 |
preferences.put(NTFEATURE, "feats"); |
44 | 44 |
} |
45 | 45 |
} |
TXM/trunk/org.txm.connlu.core/src/org/txm/conllu/core/function/UDSearch.java (revision 3546) | ||
---|---|---|
1 | 1 |
package org.txm.conllu.core.function; |
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 |
import java.io.IOException; |
|
4 | 5 |
import java.util.ArrayList; |
5 | 6 |
import java.util.Arrays; |
6 | 7 |
import java.util.HashMap; |
... | ... | |
362 | 363 |
|
363 | 364 |
return "platform:/plugin/org.txm.conllu.core/icons/functions/UD.png"; |
364 | 365 |
} |
366 |
|
|
367 |
@Override |
|
368 |
public File createTemporaryFile(File resultDir) { |
|
369 |
|
|
370 |
try { |
|
371 |
String engine = UDTreePreferences.getInstance().getString(UDTreePreferences.ENGINE); |
|
372 |
if (engine.equals("brat")) { |
|
373 |
return File.createTempFile("UDTreeSearch", ".html", resultDir); |
|
374 |
} else { |
|
375 |
return File.createTempFile("UDTreeSearch", ".svg", resultDir); |
|
376 |
} |
|
377 |
} |
|
378 |
catch (IOException e) { |
|
379 |
// TODO Auto-generated catch block |
|
380 |
e.printStackTrace(); |
|
381 |
return null; |
|
382 |
} //$NON-NLS-1$ //$NON-NLS-2$ull; |
|
383 |
} |
|
365 | 384 |
} |
TXM/trunk/org.txm.connlu.core/src/org/txm/conllu/core/function/BratPrintTree.java (revision 3546) | ||
---|---|---|
1 | 1 |
package org.txm.conllu.core.function; |
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 |
import java.io.IOException; |
|
4 | 5 |
import java.util.List; |
5 | 6 |
|
7 |
import org.apache.commons.lang.StringUtils; |
|
8 |
import org.txm.utils.BundleUtils; |
|
9 |
import org.txm.utils.io.IOUtils; |
|
10 |
|
|
6 | 11 |
public class BratPrintTree { |
7 | 12 |
public static File print(File file, List<String> conll, String[] Tvalues, String[] NTvalues) { |
8 | 13 |
|
9 | 14 |
|
10 | 15 |
|
16 |
try { |
|
17 |
String bundle_id = "org.txm.conllu.core"; |
|
18 |
File HTMLTEMPATE = BundleUtils.getFile(bundle_id, "template", "/", "index.html"); |
|
19 |
File root = HTMLTEMPATE.getParentFile(); |
|
20 |
|
|
21 |
String content = IOUtils.getText(HTMLTEMPATE); |
|
22 |
content = content.replace("HTMLROOTDIRECTORY", root.getAbsolutePath()); |
|
23 |
content = content.replace("CONLLUSENTENCE", StringUtils.join(conll, "\n")); |
|
24 |
|
|
25 |
IOUtils.write(file, content); |
|
26 |
//BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/scripts/importer", "", scriptsPackageDirectory, true); |
|
27 |
} |
|
28 |
catch (IOException e) { |
|
29 |
// TODO Auto-generated catch block |
|
30 |
e.printStackTrace(); |
|
31 |
} |
|
32 |
|
|
33 |
|
|
11 | 34 |
return file; |
12 | 35 |
} |
13 | 36 |
} |
TXM/trunk/org.txm.connlu.core/template/index.html (revision 3546) | ||
---|---|---|
7 | 7 |
<meta name="viewport" content="width=device-width"> |
8 | 8 |
<meta name="description" content="CoNLL-U format library for JavaScript"> |
9 | 9 |
|
10 |
<link rel="stylesheet" href="css/jquery-ui-redmond.css"> |
|
11 |
<link rel="stylesheet" href="css/main.css"> |
|
12 |
<link rel="stylesheet" href="css/style-vis.css"> |
|
10 |
<link rel="stylesheet" href="HTMLROOTDIRECTORY/css/jquery-ui-redmond.css">
|
|
11 |
<link rel="stylesheet" href="HTMLROOTDIRECTORY/css/main.css">
|
|
12 |
<link rel="stylesheet" href="HTMLROOTDIRECTORY/css/style-vis.css">
|
|
13 | 13 |
|
14 |
<script type="text/javascript" src="lib/ext/head.load.min.js"></script> |
|
14 |
<script type="text/javascript" src="HTMLROOTDIRECTORY/lib/ext/head.load.min.js"></script>
|
|
15 | 15 |
</head> |
16 | 16 |
|
17 | 17 |
<body> |
18 | 18 |
|
19 | 19 |
<code class="conllu-parse" tabs="yes"><pre> |
20 |
# sentence-label A |
|
21 |
# visual-style 1 bgColor:blue |
|
22 |
# visual-style 1 fgColor:white |
|
23 |
# visual-style 2 1 nsubj color:blue |
|
24 |
# visual-style 4 1 nsubj labelArrow:triangle,10,3 |
|
25 |
1 They they PRON PRN Case=Nom|Num=Plur 2 nsubj 4:nsubj _ |
|
26 |
2 buy buy VERB VBP Num=Plur|Per=3|Tense=Pres 0 root _ _ |
|
27 |
3 and and CONJ CC _ 2 cc _ _ |
|
28 |
4 sell sell VERB VBP Num=Plur|Per=3|Tense=Pres 2 conj _ _ |
|
29 |
5 books book NOUN NNS Num=Plur 2 dobj 4:dobj _ |
|
30 |
6 . . PUNCT . _ 2 punct _ _ |
|
31 |
|
|
20 |
CONLLUSENTENCE |
|
32 | 21 |
</pre></code> |
33 | 22 |
|
34 | 23 |
</body> |
35 | 24 |
|
36 | 25 |
<script type="text/javascript"> |
37 |
var root = ''; // filled in by jekyll |
|
26 |
var root = 'HTMLROOTDIRECTORY'; // filled in by jekyll
|
|
38 | 27 |
head.js( |
39 | 28 |
// External libraries |
40 |
root + 'lib/ext/jquery.min.js', |
|
41 |
root + 'lib/ext/jquery.svg.min.js', |
|
42 |
root + 'lib/ext/jquery.svgdom.min.js', |
|
43 |
root + 'lib/ext/jquery-ui.min.js', |
|
44 |
root + 'lib/ext/waypoints.min.js', |
|
29 |
root + '/lib/ext/jquery.min.js',
|
|
30 |
root + '/lib/ext/jquery.svg.min.js',
|
|
31 |
root + '/lib/ext/jquery.svgdom.min.js',
|
|
32 |
root + '/lib/ext/jquery-ui.min.js',
|
|
33 |
root + '/lib/ext/waypoints.min.js',
|
|
45 | 34 |
|
46 | 35 |
// brat helper modules |
47 |
root + 'lib/brat/configuration.js', |
|
48 |
root + 'lib/brat/util.js', |
|
49 |
root + 'lib/brat/annotation_log.js', |
|
50 |
root + 'lib/ext/webfont.js', |
|
36 |
root + '/lib/brat/configuration.js',
|
|
37 |
root + '/lib/brat/util.js',
|
|
38 |
root + '/lib/brat/annotation_log.js',
|
|
39 |
root + '/lib/ext/webfont.js',
|
|
51 | 40 |
// brat modules |
52 |
root + 'lib/brat/dispatcher.js', |
|
53 |
root + 'lib/brat/url_monitor.js', |
|
54 |
root + 'lib/brat/visualizer.js', |
|
41 |
root + '/lib/brat/dispatcher.js',
|
|
42 |
root + '/lib/brat/url_monitor.js',
|
|
43 |
root + '/lib/brat/visualizer.js',
|
|
55 | 44 |
|
56 | 45 |
// annotation documentation support |
57 | 46 |
'http://spyysalo.github.io/annodoc/lib/local/annodoc.js', |
58 |
root + 'lib/local/config.js', |
|
47 |
root + '/lib/local/config.js',
|
|
59 | 48 |
|
60 | 49 |
// the conllu.js library itself |
61 |
root + 'conllu.js' |
|
50 |
root + '/conllu.js'
|
|
62 | 51 |
); |
63 | 52 |
|
64 | 53 |
var webFontURLs = [ |
TXM/trunk/org.txm.rcp.feature/feature.xml (revision 3546) | ||
---|---|---|
257 | 257 |
<import plugin="org.txm.searchengine.core" version="1.0.0" match="greaterOrEqual"/> |
258 | 258 |
<import plugin="org.txm.rcp" version="0.8.2" match="greaterOrEqual"/> |
259 | 259 |
<import plugin="org.txm.core"/> |
260 |
<import plugin="org.eclipse.ui.net" version="1.3.300" match="greaterOrEqual"/> |
|
261 |
<import plugin="org.eclipse.ui" version="3.3.0" match="compatible"/> |
|
262 |
<import plugin="org.eclipse.core.runtime" version="3.3.0" match="compatible"/> |
|
263 |
<import plugin="org.eclipse.core.net" version="1.0.0" match="compatible"/> |
|
260 | 264 |
</requires> |
261 | 265 |
|
262 | 266 |
<plugin |
... | ... | |
285 | 289 |
version="0.0.0" |
286 | 290 |
unpack="false"/> |
287 | 291 |
|
292 |
<plugin |
|
293 |
id="org.eclipse.ui.net" |
|
294 |
download-size="0" |
|
295 |
install-size="0" |
|
296 |
version="0.0.0" |
|
297 |
unpack="false"/> |
|
298 |
|
|
288 | 299 |
</feature> |
TXM/trunk/org.txm.treesearch.rcp/src/org/txm/treesearch/editor/TreeSearchEditor.java (revision 3546) | ||
---|---|---|
107 | 107 |
tsPerRepresentation.put("TIGER", currentSelector.getTreeSearch(corpus)); //$NON-NLS-1$ |
108 | 108 |
} |
109 | 109 |
updateFields = true; |
110 |
} else if (representationCombo.getText().equals("UD") && !currentSelector.getEngine().equals("UD")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
110 |
} |
|
111 |
else if (representationCombo.getText().equals("UD") && !currentSelector.getEngine().equals("UD")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
111 | 112 |
currentSelector = selectors.get("UD"); //$NON-NLS-1$ |
112 | 113 |
if (!tsPerRepresentation.containsKey("UD")) { //$NON-NLS-1$ |
113 | 114 |
tsPerRepresentation.put("UD", currentSelector.getTreeSearch(corpus)); //$NON-NLS-1$ |
... | ... | |
120 | 121 |
getEditorInput().setResult(tsPerRepresentation.get(currentSelector.getEngine())); |
121 | 122 |
representationLabel.setImage(IImageKeys.getImage(tsPerRepresentation.get(currentSelector.getEngine()).getIconPath())); |
122 | 123 |
|
123 |
//if (e.widget == sentSpinner && tsPerRepresentation.get(currentSelector.getEngine()).hasSubMatchesStrategy()) { |
|
124 |
// if (e.widget == sentSpinner && tsPerRepresentation.get(currentSelector.getEngine()).hasSubMatchesStrategy()) {
|
|
124 | 125 |
|
125 | 126 |
subSpinner.setSelection(1); |
126 | 127 |
subSpinner.setMaximum(tsPerRepresentation.get(currentSelector.getEngine()).getNSubGraph(sentSpinner.getSelection() - 1)); |
127 | 128 |
subCounterLabel.setText("/" + tsPerRepresentation.get(currentSelector.getEngine()).getNSubGraph(sentSpinner.getSelection() - 1)); //$NON-NLS-1$ |
128 |
//} |
|
129 |
// }
|
|
129 | 130 |
} |
130 | 131 |
|
131 | 132 |
|
132 | 133 |
TreeSearchEditor.this.compute(true); |
133 |
//reloadGraph(); |
|
134 |
// reloadGraph();
|
|
134 | 135 |
} |
135 | 136 |
|
136 | 137 |
@Override |
... | ... | |
170 | 171 |
} |
171 | 172 |
|
172 | 173 |
@Override |
173 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
|
174 |
public void widgetDefaultSelected(SelectionEvent e) {} |
|
174 | 175 |
}); |
175 | 176 |
|
176 | 177 |
// System.out.println(parent.getLayout()); |
... | ... | |
179 | 180 |
// fill query Area |
180 | 181 |
GridLayout qlayout = new GridLayout(1, false); |
181 | 182 |
qlayout.horizontalSpacing = 0; |
182 |
// qlayout.verticalSpacing = 0;
|
|
183 |
// qlayout.verticalSpacing = 0;
|
|
183 | 184 |
queryPanel.setLayout(qlayout); |
184 | 185 |
|
185 | 186 |
|
... | ... | |
190 | 191 |
line1.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
191 | 192 |
|
192 | 193 |
Label l = new Label(line1, SWT.NONE); |
193 |
l.setText(TXMUIMessages.query); //$NON-NLS-1$ |
|
194 |
l.setText(TXMUIMessages.query); // $NON-NLS-1$
|
|
194 | 195 |
l.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); |
195 | 196 |
|
196 | 197 |
queryArea = new LargeQueryField(line1, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, currentSelector.getQueryClass()); |
... | ... | |
204 | 205 |
|
205 | 206 |
@Override |
206 | 207 |
public void handleEvent(Event e) { |
208 |
|
|
207 | 209 |
if (e.stateMask == SWT.CTRL) { |
208 | 210 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { |
209 | 211 |
e.doit = false; |
... | ... | |
266 | 268 |
|
267 | 269 |
new Label(navigationAreaComposite, SWT.NONE); |
268 | 270 |
|
269 |
//if (tsPerRepresentation.get(currentSelector.getEngine()).hasSubMatchesStrategy()) { |
|
271 |
// if (tsPerRepresentation.get(currentSelector.getEngine()).hasSubMatchesStrategy()) {
|
|
270 | 272 |
Label l4 = new Label(navigationAreaComposite, SWT.NONE); |
271 | 273 |
l4.setText("Sub-Match "); //$NON-NLS-1$ |
272 | 274 |
gdata = new GridData(SWT.FILL, SWT.CENTER, false, false); |
... | ... | |
284 | 286 |
subCounterLabel = new Label(navigationAreaComposite, SWT.NONE); |
285 | 287 |
gdata = new GridData(SWT.FILL, SWT.CENTER, false, false); |
286 | 288 |
subCounterLabel.setLayoutData(gdata); |
287 |
//} |
|
289 |
// }
|
|
288 | 290 |
|
289 | 291 |
Composite mainPanel = this.getResultArea(); |
290 | 292 |
svgPanel = new Browser(mainPanel, SWT.EMBEDDED | SWT.NO_BACKGROUND); |
291 | 293 |
svgPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
292 | 294 |
|
293 |
//this.getTopToolbar().setVisible(COMPUTING_PARAMETERS_GROUP_ID, true); |
|
295 |
// this.getTopToolbar().setVisible(COMPUTING_PARAMETERS_GROUP_ID, true);
|
|
294 | 296 |
initializeFields(); |
295 | 297 |
} |
296 | 298 |
|
297 | 299 |
protected void initializeFields() { |
298 |
//String id = corpus.getID(); |
|
300 |
// String id = corpus.getID();
|
|
299 | 301 |
|
300 |
//if (ts.isReady()) { |
|
302 |
// if (ts.isReady()) {
|
|
301 | 303 |
TreeSearch ts = tsPerRepresentation.get(currentSelector.getEngine()); |
302 | 304 |
|
303 | 305 |
this.queryArea.setText(ts.getQuery()); |
... | ... | |
320 | 322 |
String[] values = selectors.keySet().toArray(new String[selectors.size()]); |
321 | 323 |
representationCombo.setItems(values); |
322 | 324 |
|
323 |
String defaultEngine = ts.getEngine();//TreeSearchPreferences.getInstance().getString(TreeSearchPreferences.DEFAULT_REPRESENTATION); |
|
325 |
String defaultEngine = ts.getEngine();// TreeSearchPreferences.getInstance().getString(TreeSearchPreferences.DEFAULT_REPRESENTATION);
|
|
324 | 326 |
representationCombo.select(Arrays.binarySearch(values, defaultEngine)); |
325 | 327 |
|
326 | 328 |
if (representationCombo.getItemCount() == 1) { |
... | ... | |
343 | 345 |
if (ts.isDrawn()) { |
344 | 346 |
sentSpinner.setSelection(1); |
345 | 347 |
sentSpinner.setMaximum(ts.getNSentences()); |
346 |
//if (ts.hasSubMatchesStrategy()) { |
|
348 |
// if (ts.hasSubMatchesStrategy()) {
|
|
347 | 349 |
subSpinner.setSelection(ts.getSub(0)); |
348 | 350 |
subSpinner.setMaximum(ts.getNSubGraph(0)); |
349 |
//} |
|
351 |
// }
|
|
350 | 352 |
|
351 | 353 |
try { |
352 | 354 |
reloadGraph(); |
... | ... | |
368 | 370 |
if (ts.hasSubMatchesStrategy()) subSpinner.setMaximum(1); |
369 | 371 |
} |
370 | 372 |
} |
371 |
// }
|
|
372 |
// else {
|
|
373 |
// System.out.println("Corpus '" + id + "' is not ready.");
|
|
374 |
// return;
|
|
375 |
// }
|
|
373 |
// }
|
|
374 |
// else {
|
|
375 |
// System.out.println("Corpus '" + id + "' is not ready.");
|
|
376 |
// return;
|
|
377 |
// }
|
|
376 | 378 |
} |
377 | 379 |
|
378 | 380 |
/** |
... | ... | |
380 | 382 |
* @return 1..N sentences |
381 | 383 |
*/ |
382 | 384 |
public int getNSent() { |
385 |
|
|
383 | 386 |
return this.sentSpinner.getSelection(); |
384 | 387 |
} |
385 | 388 |
|
386 | 389 |
public File getSVGFile() { |
390 |
|
|
387 | 391 |
return svgFile; |
388 | 392 |
} |
389 | 393 |
|
... | ... | |
396 | 400 |
|
397 | 401 |
@Override |
398 | 402 |
public void updateEditorFromResult(boolean update) { |
399 |
// if (update == false) {
|
|
400 |
// //initializeFields();
|
|
401 |
// }
|
|
403 |
// if (update == false) {
|
|
404 |
// //initializeFields();
|
|
405 |
// }
|
|
402 | 406 |
// final String query = queryArea.getText().trim(); |
403 | 407 |
// if (query.length() == 0) { |
404 | 408 |
// System.out.println("No query, aborting."); |
... | ... | |
457 | 461 |
if (!ts.isComputed()) return false; |
458 | 462 |
|
459 | 463 |
try { |
464 |
if (svgFile != null && svgFile.exists()) svgFile.delete(); |
|
465 |
|
|
466 |
File resultDir = new File(Toolbox.getTxmHomePath(), "results"); //$NON-NLS-1$ |
|
467 |
resultDir.mkdirs(); |
|
468 |
svgFile = this.getResult().createTemporaryFile(resultDir); // File.createTempFile("TreeSearch", ".svg", resultDir); //$NON-NLS-1$ //$NON-NLS-2$ |
|
460 | 469 |
if (ts.toSVG(svgFile, sent, sub, T, NT)) { |
461 |
Log.finer("SVG file: "+svgFile); //$NON-NLS-1$
|
|
470 |
Log.finer("SVG file: " + svgFile); //$NON-NLS-1$
|
|
462 | 471 |
svgPanel.setUrl(svgFile.toURI().toURL().toString()); |
463 | 472 |
svgPanel.layout(); |
464 | 473 |
svgPanel.redraw(); |
... | ... | |
476 | 485 |
|
477 | 486 |
@Override |
478 | 487 |
public void _setFocus() { |
488 |
|
|
479 | 489 |
if (queryArea != null) |
480 | 490 |
queryArea.forceFocus(); |
481 | 491 |
} |
482 | 492 |
|
483 | 493 |
@SuppressWarnings("unchecked") |
484 | 494 |
@Override |
485 |
public void init(IEditorSite site, IEditorInput input) |
|
486 |
throws PartInitException { |
|
495 |
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
|
|
496 |
|
|
487 | 497 |
setSite(site); |
488 | 498 |
setInput(input); |
489 | 499 |
|
490 | 500 |
File resultDir = new File(Toolbox.getTxmHomePath(), "results"); //$NON-NLS-1$ |
491 | 501 |
resultDir.mkdirs(); |
492 |
try { |
|
493 |
svgFile = File.createTempFile("TreeSearch", ".svg", resultDir); //$NON-NLS-1$ //$NON-NLS-2$ |
|
494 |
} |
|
495 |
catch (IOException e) { |
|
496 |
Log.severe(Messages.bind(Messages.ErrorP0, e.getLocalizedMessage())); |
|
497 |
Log.printStackTrace(e); |
|
498 |
} |
|
502 |
svgFile = this.getResult().createTemporaryFile(resultDir); // File.createTempFile("TreeSearch", ".svg", resultDir); //$NON-NLS-1$ //$NON-NLS-2$ |
|
499 | 503 |
Log.fine(svgFile.toString()); |
500 | 504 |
|
501 | 505 |
TXMResultEditorInput<TreeSearch> ii = (TXMResultEditorInput<TreeSearch>) input; |
TXM/trunk/org.txm.conllu.feature/feature.xml (revision 3546) | ||
---|---|---|
29 | 29 |
id="org.txm.conllu.core" |
30 | 30 |
download-size="0" |
31 | 31 |
install-size="0" |
32 |
version="0.0.0" |
|
33 |
unpack="false"/> |
|
32 |
version="0.0.0"/> |
|
34 | 33 |
|
35 | 34 |
<plugin |
36 | 35 |
id="org.txm.conllu.rcp" |
Formats disponibles : Unified diff