Révision 3747
| TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/messages.properties (revision 3747) | ||
|---|---|---|
| 1 |
UDSearchEngine_0=Limit search to UD sentences |
|
| 2 |
UDSearchEngine_9=<p>Sentences: |
|
| 0 | 3 | |
| TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/function/UDTreeSearch.java (revision 3747) | ||
|---|---|---|
| 32 | 32 |
|
| 33 | 33 |
public class UDTreeSearch extends TreeSearch {
|
| 34 | 34 |
|
| 35 |
protected boolean ready = false; |
|
| 36 |
|
|
| 37 | 35 |
Subcorpus udSentences; |
| 38 | 36 |
|
| 39 | 37 |
private QueryResult rawMatches; |
| ... | ... | |
| 52 | 50 |
|
| 53 | 51 |
this.corpus = getParent(); |
| 54 | 52 |
|
| 55 |
ready = hasUDProperties(corpus, UDPreferences.getInstance().getProjectPreferenceValue(corpus.getProject(), UDPreferences.UDPREFIX, UDPreferences.getInstance().getString(UDPreferences.UDPREFIX))); |
|
| 53 |
|
|
| 56 | 54 |
} |
| 57 | 55 |
|
| 58 | 56 |
public UDTreeSearch(String parentNodePath) {
|
| ... | ... | |
| 220 | 218 |
} |
| 221 | 219 |
|
| 222 | 220 |
public boolean isReady() {
|
| 223 |
return ready;
|
|
| 221 |
return hasUDProperties(corpus, UDPreferences.getInstance().getProjectPreferenceValue(corpus.getProject(), UDPreferences.UDPREFIX, UDPreferences.getInstance().getString(UDPreferences.UDPREFIX)));
|
|
| 224 | 222 |
} |
| 225 | 223 |
|
| 226 | 224 |
public int getNMatchingSentences() {
|
| ... | ... | |
| 301 | 299 |
} |
| 302 | 300 |
|
| 303 | 301 |
@Override |
| 304 |
public boolean saveParameters() throws Exception {
|
|
| 302 |
public boolean _loadParameters() throws Exception {
|
|
| 305 | 303 |
return true; |
| 306 | 304 |
} |
| 307 | 305 |
|
| 308 | 306 |
@Override |
| 309 |
public boolean loadParameters() throws Exception {
|
|
| 310 |
return super.loadParameters(); |
|
| 311 |
} |
|
| 312 |
|
|
| 313 |
@Override |
|
| 314 | 307 |
protected boolean _compute(TXMProgressMonitor monitor) throws Exception {
|
| 315 | 308 |
|
| 316 | 309 |
String prefix = UDPreferences.getInstance().getProjectPreferenceValue(corpus.getProject(), UDPreferences.UDPREFIX, UDPreferences.getInstance().getString(UDPreferences.UDPREFIX)); |
| TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/search/UDSearchEngine.java (revision 3747) | ||
|---|---|---|
| 4 | 4 |
|
| 5 | 5 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 6 | 6 |
import org.txm.Toolbox; |
| 7 |
import org.txm.conllu.core.Messages; |
|
| 7 | 8 |
import org.txm.conllu.core.function.UDTreeSearch; |
| 8 | 9 |
import org.txm.conllu.core.preferences.UDPreferences; |
| 9 | 10 |
import org.txm.core.engines.EngineType; |
| ... | ... | |
| 30 | 31 |
*/ |
| 31 | 32 |
public class UDSearchEngine extends SearchEngine {
|
| 32 | 33 |
|
| 33 |
public static final String NAME = "UD"; |
|
| 34 |
public static final String NAME = "UD"; //$NON-NLS-1$
|
|
| 34 | 35 |
|
| 35 | 36 |
CQPSearchEngine CQI; |
| 36 | 37 |
|
| ... | ... | |
| 39 | 40 |
if (CQI == null) {
|
| 40 | 41 |
CQI = CQPSearchEngine.getEngine(); |
| 41 | 42 |
} |
| 42 |
return CQI; |
|
| 43 |
return CQI;
|
|
| 43 | 44 |
} |
| 44 | 45 |
|
| 45 | 46 |
public String getOptionForSearchengine() {
|
| 46 |
return "CQP"; |
|
| 47 |
return "CQP"; //$NON-NLS-1$
|
|
| 47 | 48 |
} |
| 48 | 49 |
|
| 49 | 50 |
public String getOptionNameForSearchengine() {
|
| 50 |
return "ud-s"; |
|
| 51 |
return "ud-s"; //$NON-NLS-1$
|
|
| 51 | 52 |
} |
| 52 | 53 |
|
| 53 | 54 |
public String getOptionDescriptionForSearchengine() {
|
| 54 |
return "Work with the ud-s subcorpus of the UD sentences";
|
|
| 55 |
return Messages.UDSearchEngine_0;
|
|
| 55 | 56 |
} |
| 56 | 57 |
|
| 57 | 58 |
@Override |
| ... | ... | |
| 83 | 84 |
|
| 84 | 85 |
@Override |
| 85 | 86 |
public String getName() {
|
| 86 |
return "UD"; |
|
| 87 |
return "UD"; //$NON-NLS-1$
|
|
| 87 | 88 |
} |
| 88 | 89 |
|
| 89 | 90 |
@Override |
| ... | ... | |
| 130 | 131 |
|
| 131 | 132 |
public static Subcorpus getSentenceSubcorpus(CQPCorpus corpus, String prefix) throws CqiClientException, InterruptedException {
|
| 132 | 133 |
|
| 133 |
Subcorpus udSentences = corpus.getSubcorpusByName(corpus.getName()+TXMPreferences.PARENT_NAME_SEPARATOR+"ud-s"); |
|
| 134 |
Subcorpus udSentences = corpus.getSubcorpusByName(corpus.getName()+TXMPreferences.PARENT_NAME_SEPARATOR+"ud-s"); //$NON-NLS-1$
|
|
| 134 | 135 |
if (udSentences != null) udSentences.compute(false); |
| 135 | 136 |
|
| 136 |
CQLQuery sentencesQuery = new CQLQuery("["+prefix+"id=\"1\"] ["+prefix+"id !=\"1\"]+ [:"+prefix+"id=\"1|__UNDEF__\":]");
|
|
| 137 |
CQLQuery sentencesQuery = new CQLQuery(getUDSCQPQueryString(prefix));
|
|
| 137 | 138 |
if (udSentences == null) { // no ud-s subcorpus, create it
|
| 138 |
udSentences = corpus.createSubcorpus(sentencesQuery, "ud-s"); |
|
| 139 |
udSentences = corpus.createSubcorpus(sentencesQuery, "ud-s"); //$NON-NLS-1$
|
|
| 139 | 140 |
udSentences.setVisible(false); |
| 140 | 141 |
} |
| 141 | 142 |
if (!udSentences.getQuery().equals(sentencesQuery)) { // the subcorpus exists but its query differs
|
| 142 |
udSentences = corpus.createSubcorpus(sentencesQuery, "ud-s"); |
|
| 143 |
udSentences = corpus.createSubcorpus(sentencesQuery, "ud-s"); //$NON-NLS-1$
|
|
| 143 | 144 |
udSentences.setVisible(false); |
| 144 | 145 |
} |
| 145 | 146 |
|
| 146 | 147 |
return udSentences; |
| 147 | 148 |
} |
| 149 |
|
|
| 150 |
/** |
|
| 151 |
* |
|
| 152 |
* @param prefix the UD prefix of the CQP properties |
|
| 153 |
* @return A CQL query to build a Subcorpus of UD sentences |
|
| 154 |
*/ |
|
| 155 |
public static String getUDSCQPQueryString(String prefix) {
|
|
| 156 |
return "["+prefix+"id=\"1\"] ["+prefix+"id !=\"1\"]+ [:"+prefix+"id=\"1|__UNDEF__\":]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
|
| 157 |
} |
|
| 148 | 158 |
|
| 149 | 159 |
public String hasAdditionalDetailsForResult(TXMResult result) {
|
| 150 | 160 |
if (result instanceof CQPCorpus) {
|
| 151 | 161 |
CQPCorpus corpus = (CQPCorpus)result; |
| 152 |
return UDTreeSearch.hasUDProperties(corpus)?"Syntax":null; |
|
| 162 |
return UDTreeSearch.hasUDProperties(corpus)?"Syntax":null; //$NON-NLS-1$
|
|
| 153 | 163 |
} |
| 154 | 164 |
return null; |
| 155 | 165 |
} |
| ... | ... | |
| 160 | 170 |
if (UDTreeSearch.hasUDProperties(corpus)) {
|
| 161 | 171 |
StringBuilder buffer = new StringBuilder(); |
| 162 | 172 |
|
| 163 |
buffer.append("<h3>CoNLLU</h3>\n");
|
|
| 173 |
buffer.append("<h3>CoNLLU</h3>\n"); //$NON-NLS-1$
|
|
| 164 | 174 |
|
| 165 | 175 |
String prefix = UDPreferences.getInstance().getProjectPreferenceValue(corpus.getProject(), UDPreferences.UDPREFIX, UDPreferences.getInstance().getString(UDPreferences.UDPREFIX)); |
| 166 |
buffer.append("<p>UD prefix: '"+prefix+"'</p>\n");
|
|
| 176 |
buffer.append("<p>UD prefix: '"+prefix+"'</p>\n"); //$NON-NLS-2$
|
|
| 167 | 177 |
|
| 168 | 178 |
try {
|
| 169 | 179 |
Subcorpus udSentences = getSentenceSubcorpus(corpus, prefix); |
| 170 |
buffer.append("<p>Sentences: "+udSentences.getNMatch()+"</p>\n");
|
|
| 180 |
buffer.append(Messages.UDSearchEngine_9+udSentences.getNMatch()+"</p>\n"); //$NON-NLS-2$
|
|
| 171 | 181 |
} catch (Exception e) {
|
| 172 | 182 |
// TODO Auto-generated catch block |
| 173 | 183 |
e.printStackTrace(); |
| TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/Messages.java (revision 3747) | ||
|---|---|---|
| 1 |
package org.txm.conllu.core; |
|
| 2 |
|
|
| 3 |
import org.eclipse.osgi.util.NLS; |
|
| 4 |
import org.txm.utils.messages.Utf8NLS; |
|
| 5 |
|
|
| 6 |
public class Messages extends NLS {
|
|
| 7 |
|
|
| 8 |
private static final String BUNDLE_NAME = Messages.class.getPackageName() + ".messages"; //$NON-NLS-1$ |
|
| 9 |
public static String UDSearchEngine_0; |
|
| 10 |
public static String UDSearchEngine_9; |
|
| 11 |
|
|
| 12 |
static {
|
|
| 13 |
// initialize resource bundle |
|
| 14 |
Utf8NLS.initializeMessages(BUNDLE_NAME, Messages.class); |
|
| 15 |
} |
|
| 16 |
|
|
| 17 |
private Messages() {
|
|
| 18 |
} |
|
| 19 |
} |
|
| 0 | 20 | |
| TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/messages_fr.properties (revision 3747) | ||
|---|---|---|
| 1 |
UDSearchEngine_0=Limiter la recherche aux phrases UD |
|
| 2 |
UDSearchEngine_9=<p>Phrases : |
|
| 0 | 3 | |
| TXM/trunk/bundles/org.txm.conllu.rcp/src/org/txm/conllu/rcp/commands/CoNLLUCorpusPreferences.java (revision 3747) | ||
|---|---|---|
| 28 | 28 |
package org.txm.conllu.rcp.commands; |
| 29 | 29 |
|
| 30 | 30 |
import java.util.HashMap; |
| 31 |
import java.util.LinkedHashMap; |
|
| 31 | 32 |
|
| 32 | 33 |
import org.eclipse.core.commands.AbstractHandler; |
| 33 | 34 |
import org.eclipse.core.commands.ExecutionEvent; |
| 34 | 35 |
import org.eclipse.core.commands.ExecutionException; |
| 35 | 36 |
import org.eclipse.jface.dialogs.InputDialog; |
| 36 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
| 37 | 37 |
import org.eclipse.ui.handlers.HandlerUtil; |
| 38 |
import org.kohsuke.args4j.Option; |
|
| 39 | 38 |
import org.osgi.service.prefs.Preferences; |
| 40 | 39 |
import org.txm.conllu.core.preferences.UDPreferences; |
| 41 |
import org.txm.rcp.swt.widget.parameters.ParametersDialog;
|
|
| 40 |
import org.txm.rcp.swt.dialog.MultipleValueDialog;
|
|
| 42 | 41 |
import org.txm.rcp.views.corpora.CorporaView; |
| 43 | 42 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
| 43 |
import org.txm.treesearch.preferences.TreeSearchPreferences; |
|
| 44 | 44 |
import org.txm.utils.logger.Log; |
| 45 | 45 |
|
| 46 | 46 |
/** |
| ... | ... | |
| 49 | 49 |
* @author mdecorde. |
| 50 | 50 |
*/ |
| 51 | 51 |
public class CoNLLUCorpusPreferences extends AbstractHandler {
|
| 52 |
|
|
| 52 |
|
|
| 53 | 53 |
public static final String ID = CoNLLUCorpusPreferences.class.getName(); |
| 54 |
|
|
| 55 |
|
|
| 54 |
|
|
| 55 |
|
|
| 56 | 56 |
/* |
| 57 | 57 |
* (non-Javadoc) |
| 58 | 58 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
| 59 | 59 |
*/ |
| 60 | 60 |
@Override |
| 61 | 61 |
public Object execute(final ExecutionEvent event) throws ExecutionException {
|
| 62 |
|
|
| 62 |
|
|
| 63 | 63 |
Object s = CorporaView.getFirstSelectedObject(); |
| 64 |
|
|
| 64 |
|
|
| 65 | 65 |
if (!(s instanceof MainCorpus)) {
|
| 66 | 66 |
Log.warning("Selection is not a corpus. Aborting.");
|
| 67 | 67 |
return null; |
| 68 | 68 |
} |
| 69 |
|
|
| 69 |
|
|
| 70 | 70 |
MainCorpus c = (MainCorpus)s; |
| 71 |
|
|
| 71 |
|
|
| 72 | 72 |
Preferences customNode = c.getProject().getPreferencesScope().getNode(UDPreferences.getInstance().getPreferencesNodeQualifier()); |
| 73 | 73 |
String udPrefix = customNode.get(UDPreferences.UDPREFIX, UDPreferences.getInstance().getString(UDPreferences.UDPREFIX)); |
| 74 |
|
|
| 75 |
InputDialog dialog = new InputDialog(HandlerUtil.getActiveShell(event), "CoNLL-U Corpus preferences", "Prefix of the CQP properties encoding the UD fields", udPrefix, null); |
|
| 76 |
|
|
| 77 |
if (dialog.open() == InputDialog.OK) {
|
|
| 78 |
if (dialog.getValue().length() == 0) {
|
|
| 74 |
customNode = c.getProject().getPreferencesScope().getNode(TreeSearchPreferences.getInstance().getPreferencesNodeQualifier()); |
|
| 75 |
String defaultEngine = customNode.get(TreeSearchPreferences.DEFAULT_VISUALISATION, TreeSearchPreferences.getInstance().getString(TreeSearchPreferences.DEFAULT_VISUALISATION)); |
|
| 76 |
|
|
| 77 |
LinkedHashMap<String, String> valuesMap = new LinkedHashMap<String, String>(); |
|
| 78 |
valuesMap.put(UDPreferences.UDPREFIX, udPrefix); |
|
| 79 |
valuesMap.put(TreeSearchPreferences.DEFAULT_VISUALISATION, defaultEngine); |
|
| 80 |
|
|
| 81 |
|
|
| 82 |
MultipleValueDialog multiInputddialog = new MultipleValueDialog(HandlerUtil.getActiveShell(event), "CoNLL-U Corpus preferences", valuesMap); |
|
| 83 |
if (multiInputddialog.open() == InputDialog.OK) {
|
|
| 84 |
HashMap<String, String> newValues = multiInputddialog.getValues(); |
|
| 85 |
|
|
| 86 |
customNode = c.getProject().getPreferencesScope().getNode(UDPreferences.getInstance().getPreferencesNodeQualifier()); |
|
| 87 |
if (newValues.get(UDPreferences.UDPREFIX) == null || newValues.get(UDPreferences.UDPREFIX).isEmpty()) {
|
|
| 79 | 88 |
Log.warning("UD prefix cannot be empty");
|
| 80 |
return null; |
|
| 89 |
} else {
|
|
| 90 |
customNode.put(UDPreferences.UDPREFIX, newValues.get(UDPreferences.UDPREFIX)); |
|
| 81 | 91 |
} |
| 82 |
customNode.put(UDPreferences.UDPREFIX, dialog.getValue()); |
|
| 83 |
Log.info("Set "+c.getName()+" prefix to "+dialog.getValue());
|
|
| 84 |
return s; |
|
| 92 |
|
|
| 93 |
customNode = c.getProject().getPreferencesScope().getNode(TreeSearchPreferences.getInstance().getPreferencesNodeQualifier()); |
|
| 94 |
if (newValues.get(TreeSearchPreferences.DEFAULT_VISUALISATION) == null || newValues.get(TreeSearchPreferences.DEFAULT_VISUALISATION).isEmpty()) {
|
|
| 95 |
Log.warning("Default tree representation cannot be empty");
|
|
| 96 |
} else {
|
|
| 97 |
customNode.put(TreeSearchPreferences.DEFAULT_VISUALISATION, newValues.get(TreeSearchPreferences.DEFAULT_VISUALISATION)); |
|
| 98 |
} |
|
| 85 | 99 |
} |
| 100 |
|
|
| 101 |
// InputDialog dialog = new InputDialog(HandlerUtil.getActiveShell(event), "CoNLL-U Corpus preferences", "Prefix of the CQP properties encoding the UD fields", udPrefix, null); |
|
| 102 |
// |
|
| 103 |
// if (dialog.open() == InputDialog.OK) {
|
|
| 104 |
// if (dialog.getValue().length() == 0) {
|
|
| 105 |
// |
|
| 106 |
// return null; |
|
| 107 |
// } |
|
| 108 |
// customNode.put(UDPreferences.UDPREFIX, dialog.getValue()); |
|
| 109 |
// Log.info("Set "+c.getName()+" prefix to "+dialog.getValue());
|
|
| 110 |
// return s; |
|
| 111 |
// } |
|
| 112 |
|
|
| 86 | 113 |
return null; |
| 87 | 114 |
} |
| 88 | 115 |
} |
| TXM/trunk/bundles/org.txm.treesearch.rcp/src/org/txm/treesearch/command/ComputeTreeSearch.java (revision 3747) | ||
|---|---|---|
| 146 | 146 |
} |
| 147 | 147 |
|
| 148 | 148 |
public static TreeSearch getTreeSearchFor(CQPCorpus corpus) {
|
| 149 |
TreeSearchSelector s = getSelectorForCorpus(corpus, TreeSearchPreferences.getInstance().getString(TreeSearchPreferences.DEFAULT_VISUALISATION)); |
|
| 149 |
|
|
| 150 |
Preferences customNode = corpus.getProject().getPreferencesScope().getNode(TreeSearchPreferences.getInstance().getPreferencesNodeQualifier()); |
|
| 151 |
String defaultEngine = customNode.get(TreeSearchPreferences.DEFAULT_VISUALISATION, TreeSearchPreferences.getInstance().getString(TreeSearchPreferences.DEFAULT_VISUALISATION)); |
|
| 152 |
|
|
| 153 |
TreeSearchSelector s = getSelectorForCorpus(corpus, defaultEngine); |
|
| 154 |
if (s == null) s = getSelectorForCorpus(corpus, null); |
|
| 150 | 155 |
if (s != null) return s.getTreeSearch(corpus); |
| 151 | 156 |
|
| 152 | 157 |
return null; |
| TXM/trunk/bundles/org.txm.treesearch.rcp/src/org/txm/treesearch/command/SendToTreeSearch.java (revision 3747) | ||
|---|---|---|
| 198 | 198 |
for (Match m : matches) {
|
| 199 | 199 |
if (m.getStart() <= kp && kp <= m.getEnd()) {
|
| 200 | 200 |
// System.out.println("set index "+(i+1));
|
| 201 |
ts.setIndexAndSubIndex(i+1, 1);
|
|
| 201 |
ts.setIndexAndSubIndex(i, 1); |
|
| 202 | 202 |
break; |
| 203 | 203 |
} |
| 204 | 204 |
i++; |
| TXM/trunk/bundles/org.txm.treesearch.rcp/src/org/txm/treesearch/editor/TreeSearchEditor.java (revision 3747) | ||
|---|---|---|
| 30 | 30 |
import org.eclipse.ui.IEditorInput; |
| 31 | 31 |
import org.eclipse.ui.IEditorSite; |
| 32 | 32 |
import org.eclipse.ui.PartInitException; |
| 33 |
import org.osgi.service.prefs.Preferences; |
|
| 33 | 34 |
import org.txm.Toolbox; |
| 34 | 35 |
import org.txm.concordance.rcp.messages.ConcordanceUIMessages; |
| 35 | 36 |
import org.txm.core.preferences.TXMPreferences; |
| ... | ... | |
| 222 | 223 |
l1.setText("T "); //$NON-NLS-1$
|
| 223 | 224 |
l1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); |
| 224 | 225 |
|
| 225 |
TCombo = new org.eclipse.swt.widgets.List(line2, SWT.READ_ONLY|SWT.MULTI); |
|
| 226 |
GridData gdata = new GridData(SWT.FILL, SWT.CENTER, true, true); |
|
| 226 |
TCombo = new org.eclipse.swt.widgets.List(line2, SWT.READ_ONLY|SWT.MULTI|SWT.V_SCROLL); |
|
| 227 |
GridData gdata = new GridData(SWT.FILL, SWT.CENTER, true, false); |
|
| 228 |
gdata.heightHint = 100; |
|
| 227 | 229 |
TCombo.setLayoutData(gdata); |
| 228 |
TCombo.addSelectionListener(selChangedListener); |
|
| 230 |
//TCombo.addSelectionListener(selChangedListener);
|
|
| 229 | 231 |
|
| 230 | 232 |
Label l2 = new Label(line2, SWT.NONE); |
| 231 | 233 |
l2.setText("NT "); //$NON-NLS-1$
|
| 232 | 234 |
l2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); |
| 233 | 235 |
|
| 234 |
NTCombo = new org.eclipse.swt.widgets.List(line2, SWT.READ_ONLY|SWT.MULTI); |
|
| 235 |
gdata = new GridData(SWT.FILL, SWT.CENTER, true, true); |
|
| 236 |
NTCombo = new org.eclipse.swt.widgets.List(line2, SWT.READ_ONLY|SWT.MULTI|SWT.V_SCROLL); |
|
| 237 |
gdata = new GridData(SWT.FILL, SWT.CENTER, true, false); |
|
| 238 |
gdata.heightHint = 100; |
|
| 236 | 239 |
NTCombo.setLayoutData(gdata); |
| 237 |
NTCombo.addSelectionListener(selChangedListener); |
|
| 240 |
//NTCombo.addSelectionListener(selChangedListener);
|
|
| 238 | 241 |
|
| 239 | 242 |
// bottom toolbar |
| 240 | 243 |
|
| ... | ... | |
| 493 | 496 |
representationCombo.setItems(values); |
| 494 | 497 |
|
| 495 | 498 |
String defaultEngine = ts.getEngine();// TreeSearchPreferences.getInstance().getString(TreeSearchPreferences.DEFAULT_REPRESENTATION); |
| 499 |
|
|
| 496 | 500 |
representationCombo.select(Arrays.binarySearch(values, defaultEngine)); |
| 497 | 501 |
|
| 498 | 502 |
if (representationCombo.getItemCount() == 1) {
|
| TXM/trunk/bundles/org.txm.treesearch.core/src/org/txm/treesearch/function/TreeSearch.java (revision 3747) | ||
|---|---|---|
| 5 | 5 |
import java.util.Arrays; |
| 6 | 6 |
import java.util.List; |
| 7 | 7 |
|
| 8 |
import org.apache.commons.lang.StringUtils; |
|
| 8 | 9 |
import org.eclipse.osgi.util.NLS; |
| 9 | 10 |
import org.txm.core.preferences.TXMPreferences; |
| 10 | 11 |
import org.txm.core.results.Parameter; |
| ... | ... | |
| 13 | 14 |
import org.txm.searchengine.core.IQuery; |
| 14 | 15 |
import org.txm.searchengine.core.Selection; |
| 15 | 16 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
| 17 |
import org.txm.searchengine.cqp.corpus.WordProperty; |
|
| 16 | 18 |
import org.txm.treesearch.preferences.TreeSearchPreferences; |
| 17 | 19 |
|
| 18 | 20 |
public abstract class TreeSearch extends TXMResult {
|
| ... | ... | |
| 122 | 124 |
} |
| 123 | 125 |
|
| 124 | 126 |
@Override |
| 125 |
public boolean loadParameters() throws Exception {
|
|
| 127 |
public final boolean loadParameters() throws Exception {
|
|
| 126 | 128 |
|
| 127 | 129 |
this.T = new ArrayList<>(); |
| 128 | 130 |
String values = getStringParameterValue(TreeSearchPreferences.TFEATURE); |
| ... | ... | |
| 131 | 133 |
this.T.addAll(Arrays.asList(values.split(",")));
|
| 132 | 134 |
} |
| 133 | 135 |
|
| 136 |
this.NT = new ArrayList<>(); |
|
| 137 |
values = getStringParameterValue(TreeSearchPreferences.TFEATURE); |
|
| 138 |
|
|
| 139 |
if (values != null && !values.isEmpty() && values.length() > 0) {
|
|
| 140 |
this.NT.addAll(Arrays.asList(values.split(",")));
|
|
| 141 |
} |
|
| 142 |
|
|
| 143 |
String squery = getStringParameterValue(TreeSearchPreferences.QUERY); |
|
| 144 |
if (squery != null && !squery.isEmpty() && squery.length() > 0) {
|
|
| 145 |
this.pQuery = IQuery.fromPrefString(squery); |
|
| 146 |
} |
|
| 147 |
|
|
| 148 |
return _loadParameters(); |
|
| 149 |
} |
|
| 150 |
|
|
| 151 |
@Override |
|
| 152 |
public boolean saveParameters() throws Exception {
|
|
| 153 |
|
|
| 154 |
if (pQuery != null) {
|
|
| 155 |
this.saveParameter(TreeSearchPreferences.QUERY, IQuery.toPrefString(pQuery)); |
|
| 156 |
} |
|
| 157 |
|
|
| 158 |
this.saveParameter(TreeSearchPreferences.TFEATURE, StringUtils.join(this.T, ",")); |
|
| 159 |
|
|
| 160 |
this.saveParameter(TreeSearchPreferences.NTFEATURE, StringUtils.join(this.NT, ",")); |
|
| 161 |
|
|
| 134 | 162 |
return true; |
| 135 | 163 |
} |
| 136 | 164 |
|
| 165 |
public abstract boolean _loadParameters() throws Exception; |
|
| 166 |
|
|
| 137 | 167 |
public abstract boolean hasSubMatchesStrategy(); |
| 138 | 168 |
|
| 139 | 169 |
@Override |
Formats disponibles : Unified diff