Révision 1676

tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 1676)
208 208
				}
209 209
			}
210 210
		}
211
		try {
212
			if (statsData != null)	{
213
				RWorkspace.getRWorkspaceInstance().removeVariableFromWorkspace(statsData.getSymbol());
214
			}
215
		} catch (RWorkspaceException e) {
216
			e.printStackTrace();
217
		}
211 218
		this.statsData = new LexicalTableImpl(mat, filteredForms.toArray(new String[]{}), partition.getPartNames().toArray(new String[] {}));
212 219

  
213 220
	}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/corpuswizard/SourceDirectoryPage.java (revision 1676)
23 23
import org.eclipse.swt.widgets.Display;
24 24
import org.eclipse.swt.widgets.Label;
25 25
import org.eclipse.swt.widgets.Text;
26
import org.txm.Toolbox;
27
import org.txm.objects.Project;
26 28
import org.txm.rcp.messages.TXMUIMessages;
27 29
import org.txm.rcp.preferences.RCPPreferences;
28 30
import org.txm.utils.AsciiUtils;
......
142 144
		if (corpusName.getText().length() > 0) {
143 145
			//File srcProjectLink = ResourcesPlugin.getWorkspace().getRoot().getProject(corpusName.getText()).getFolder("src").getRawLocation().toFile();
144 146
			if (ResourcesPlugin.getWorkspace().getRoot().getProject(getCorpusName()).exists()) {
145
				newOrEdit.setText(NLS.bind("The ''{0}'' corpus will be replaced.", getCorpusName()));
147
				Project p = Toolbox.workspace.getProject();
148
				if (p != null && p.getChildren().size() > 0) {
149
					newOrEdit.setText(NLS.bind("The ''{0}'' corpus will be replaced.", getCorpusName()));
150
				} else {
151
					newOrEdit.setText(NLS.bind("The ''{0}'' corpus import will be resumed.", getCorpusName()));
152
				}
146 153
			} else {
147 154
				newOrEdit.setText(NLS.bind("The ''{0}'' corpus will be created.", getCorpusName()));
148 155
			}
......
156 163
		}
157 164

  
158 165
		return getCorpusName().length() > 0 && getSourcePath().length() > 0;
159
		//    	return getSourcePath().length() > 0;
160 166
	}
161 167

  
162 168
	public String getCorpusName() {
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ImportSelectedText.java (revision 1676)
99 99
	 * Import text.
100 100
	 *
101 101
	 * @param text the text
102
	 * @param basename the basename
102
	 * @param corpusname the basename
103 103
	 * @return the object
104 104
	 * @throws Exception 
105 105
	 */
106
	public static Object importText(String text, String basename) throws Exception {
107
		basename = basename.toUpperCase();
106
	public static Object importText(String text, String corpusname) throws Exception {
107
		corpusname = corpusname.toUpperCase();
108 108
		if (text.length() == 0) {
109 109
			System.err.println(TXMUIMessages.clipboardIsEmpty);
110 110
			return null;
111 111
		}
112 112
		String txmhome = Toolbox.getTxmHomePath();
113 113
		new File(txmhome, "clipboard").mkdir(); //$NON-NLS-1$
114
		File clipboardDirectory = new File(txmhome, "clipboard/" + basename); //$NON-NLS-1$
114
		File clipboardDirectory = new File(txmhome, "clipboard/" + corpusname); //$NON-NLS-1$
115 115
		
116 116
		if (CorpusManager.getCorpusManager().hasCorpus(clipboardDirectory.getName())) {
117 117
			Shell shell = new Shell();
......
124 124
		org.txm.utils.DeleteDir.deleteDirectory(clipboardDirectory);
125 125
		clipboardDirectory.mkdirs();
126 126
		
127
		File quicksrc = new File(clipboardDirectory, basename + ".txt"); //$NON-NLS-1$
127
		File quicksrc = new File(clipboardDirectory, corpusname + ".txt"); //$NON-NLS-1$
128 128
		try {
129 129
			Writer writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(quicksrc)), "UTF-8"); //$NON-NLS-1$ 
130 130
			writer.write(text.replace("\t", "    ")); //$NON-NLS-1$ //$NON-NLS-2$
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 1676)
61 61
import org.txm.statsengine.core.utils.ArrayIndex;
62 62
import org.txm.statsengine.core.utils.CheckArray;
63 63
import org.txm.statsengine.r.core.RWorkspace;
64
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
64 65
import org.txm.utils.logger.Log;
65 66

  
66 67
/**
......
198 199
	 */
199 200
	protected void init(String symbol, double[][] specIndex) throws Exception {
200 201

  
202
		if (this.symbol != null && this.symbol.equals(symbol)) {
203
			try {
204
				RWorkspace.getRWorkspaceInstance().removeVariableFromWorkspace(this.symbol);
205
			} catch (RWorkspaceException e) {
206
				e.printStackTrace();
207
			}
208
		}
201 209
		this.symbol = symbol;
202 210

  
203 211
		if (this.lexicalTable == null) {
......
555 563
	@Override
556 564
	public void clean() {
557 565
		try {
566
			if (symbol != null)	{
567
				RWorkspace.getRWorkspaceInstance().removeVariableFromWorkspace(symbol);
568
			}
569
		} catch (RWorkspaceException e) {
570
			// TODO Auto-generated catch block
571
			e.printStackTrace();
572
		}
573
		
574
		try {
558 575
			if(this.writer != null)	{
559 576
				this.writer.flush();
560 577
				this.writer.close();
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TSCorpus.java (revision 1676)
32 32
import ims.tiger.gui.tigergraphviewer.TIGERGraphViewerConfiguration;
33 33
import ims.tiger.query.internalapi.InternalCorpusQueryManager;
34 34
import ims.tiger.query.internalapi.InternalCorpusQueryManagerLocal;
35
import ims.tiger.query.processor.CorpusQueryProcessor;
35 36

  
36 37
import java.util.HashMap;
37 38
import java.util.List;
......
48 49

  
49 50
	/** The managers. */
50 51
	public TSCorpusManager tsmanager;
51
	InternalCorpusQueryManager manager = null;
52
	InternalCorpusQueryManagerLocal2 manager = null;
52 53
	ExportManager exporter;
53 54
	
54 55
	/** The config. */
......
74 75
		String confpath = tsmanager.getconfPath();
75 76
		try {
76 77
			this.tsmanager = tsmanager;
77
			manager = new InternalCorpusQueryManagerLocal(regpath);
78
			manager = new InternalCorpusQueryManagerLocal2(regpath);
79
			
80
			manager.getQueryProcessor();
78 81
			config = new TIGERGraphViewerConfiguration(confpath, confpath, confpath);
79 82
			this.id = corpusId;		
80 83
			initok = opencorpus();
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/InternalCorpusQueryManagerLocal2.java (revision 1676)
1
package org.txm.searchengine.ts;
2

  
3
import ims.tiger.query.api.CorpusQueryManagerException;
4
import ims.tiger.query.internalapi.InternalCorpusQueryManagerLocal;
5
import ims.tiger.query.processor.CorpusQueryProcessor;
6

  
7
public class InternalCorpusQueryManagerLocal2 extends InternalCorpusQueryManagerLocal {
8

  
9
	public InternalCorpusQueryManagerLocal2(String corpus_base_directory) throws CorpusQueryManagerException {
10
		super(corpus_base_directory);
11
	}
12

  
13
	public CorpusQueryProcessor getQueryProcessor() {
14
		return query_processor;
15
	}
16
}
0 17

  
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERSearchEngine.java (revision 1676)
1 1
package org.txm.searchengine.ts;
2 2

  
3 3
import java.io.File;
4
import java.util.ArrayList;
4 5

  
5 6
import org.eclipse.core.runtime.IProgressMonitor;
6 7
import org.txm.core.results.TXMResult;
......
14 15
import org.txm.searchengine.cqp.corpus.MainCorpus;
15 16
import org.txm.utils.DeleteDir;
16 17

  
18
import cern.colt.Arrays;
19
import ims.tiger.corpus.Sentence;
20
import ims.tiger.gui.tigergraphviewer.draw.Display_Sentence;
17 21
import ims.tiger.gui.tigergraphviewer.forest.ResultForest;
22
import ims.tiger.index.reader.Index;
18 23
import ims.tiger.query.api.MatchResult;
24
import ims.tiger.query.internalapi.InternalCorpusQueryManager;
25
import ims.tiger.query.processor.CorpusQueryProcessor;
19 26

  
20 27
public class TIGERSearchEngine extends SearchEngine {
21 28

  
......
49 56
		File tigerDirectory = new File(corpus.getProjectDirectory(), "tiger");
50 57
		File configfile = new File(tigerDirectory, "tigersearch.logprop");
51 58
		TSCorpusManager manager = new TSCorpusManager(tigerDirectory, configfile);
52
		
53
		TSResult result = manager.getCorpus(corpus.getID()).query(query.getQueryString());
59

  
60
		TSCorpus tcorpus = manager.getCorpus(corpus.getID());
61
		TSResult result = tcorpus.query(query.getQueryString());
54 62
		ResultForest forest = result.getForest();
55 63
		System.out.println("TIGERSearch: forest size="+forest.getForestSize());
56 64
		MatchResult mresult = result.getMatchResult();
57 65
		
66
		InternalCorpusQueryManagerLocal2 tigermanager = tcorpus.manager;
67
		CorpusQueryProcessor processor = tigermanager.getQueryProcessor();
68
		Index index = processor.getIndex();
69
		
70
		System.out.println("MANAGER="+tigermanager.getClass());
71
		int nsentences = 0;
72
		int sentence_sizes[] = new int[nsentences];
73
		int size = mresult.size();
74
		System.out.println("size: "+size);
75
		int subsize = mresult.submatchSize();
76
		System.out.println("submatchSize: "+subsize);
77
		for (int imatch = 0 ; imatch < size; imatch++) { // the matching sentences
78
			int sent = mresult.getSentenceNumberAt(imatch);
79
			Sentence sentence = tcorpus.manager.getSentence(sent);
80
			System.out.println(" sent: "+sent);
81
			int sent_submatch = mresult.getSentenceSubmatchSize(sent);
82
			//System.out.println(" sent submatch size: "+sent_submatch);
83
			for (int isubmatch = 0 ; isubmatch < sent_submatch ; isubmatch++) { // the matches in the sentence
84
				int[] match = mresult.getSentenceSubmatchAt(sent, isubmatch);
85
				//System.out.println("  match="+Arrays.toString(match));
86
				
87
				
88
				for (int inode : match) {
89
					System.out.println("  match="+ sentence.getNode(inode).getFeatures());
90
				}
91
			}
92
		}
93
		
94
//		
95
//		int size = result.getNumberOfMatch();
96
//		for (int match_no = 0 ; match_no < size ; match_no++) {
97
//			TSMatch match = result.getMatch(match_no);
98
////			int sentno = result.getSentenceNumberAt(match_no);
99
////			int n = result.getSentenceSubmatchSize(sentno);
100
//			System.out.println("Sent: "+match);
101
//			int n = match.getNumberOfSubGraph();
102
//			for (int iSubMatch=0 ; iSubMatch<n ; iSubMatch++) {
103
//				System.out.println("   Sub: "+iSubMatch+" -> "+match.getResult().getMatchResult().getSentenceSubmatchSize(sentence));
104
//				match.getCurrentSubMatchNo()
105
//			}
106
//		}
107

  
108
		//		Display_Sentence match = forest.getCurrentMatch();
109
		//		while (match != null) {
110
		////			int s = match.getTerminalsSize();
111
		////			ArrayList<ims.tiger.corpus.T_Node> terms = match.getTerminals();
112
		////			System.out.print("M="+s+"\t");
113
		////			for (ims.tiger.corpus.T_Node term : terms) {
114
		////				System.out.print(" "+term.getFeature("word"));
115
		////			}
116
		////			match.get
117
		////			System.out.println();
118
		//			match.getSe
119
		//			match = forest.nextMatch();
120
		//		}
121

  
122
		//		int size = forest.getForestSize();
123
		//		for ( int match_no = 0 ; match_no < size ; match_no++) {
124
		//			int sentno = mresult.getSentenceNumberAt(match_no);
125
		//			Sentence sentence = manager.getSentence(sentno);
126
		//
127
		//			mresult.orderSentenceSubmatches(sentno); 
128
		//			int n = mresult.getSentenceSubmatchSize(sentno);
129
		//
130
		//			for (int iSubMatch=0; iSubMatch<n; iSubMatch++) {
131
		//				int[] var_values = mresult.getSentenceSubmatchAt(sentno, iSubMatch);
132
		//				int value;
133
		//				for (int j=0; j<var_values.length; j++) {
134
		//					value = var_values[j];
135
		//					if (value>=0) {
136
		//						String var_name = mresult.getVariableName(j);
137
		//						Node referred = sentence.getNode(value);
138
		//						if (p.matcher(var_name).matches()) {
139
		//							if (referred instanceof T_Node) {
140
		//								matchingTnodesID.add(referred.getFeature(EDITIONID));
141
		//							} else if (referred instanceof NT_Node) {
142
		//								for (T_Node c : getTerminals((NT_Node) referred, sentence)) {
143
		//									matchingTnodesID.add(c.getFeature(EDITIONID));
144
		//								}
145
		//							}
146
		//						}
147
		//					}
148
		//				}
149
		//			}
150
		//		}
151

  
58 152
		System.out.println("FIXME return EmptySelection for now...");
59 153
		return new EmptySelection(query);
60 154
	}
......
69 163
		//TODO implement a corpora of TIGER corpus
70 164
		File buildDirectory = new File(corpus.getProjectDirectory(), "tiger");
71 165
		return	new File(buildDirectory, "tigersearch.logprop").exists() && 
72
		 new File(buildDirectory, corpus.getID()).exists();
166
				new File(buildDirectory, corpus.getID()).exists();
73 167
	}
74 168

  
75 169
	@Override
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TIGERSearchEditor.java (revision 1676)
360 360
			System.out.println("Error: "+e.getLocalizedMessage());
361 361
			Log.printStackTrace(e);
362 362
		} //$NON-NLS-1$ //$NON-NLS-2$
363
		Log.severe(svgFile.toString());
363
		Log.fine(svgFile.toString());
364 364
		
365 365
		TXMResultEditorInput<TIGERSearch> ii = (TXMResultEditorInput<TIGERSearch>) input;
366 366
		ts = ii.getResult();
tmp/org.txm.ahc.core/src/org/txm/ahc/core/functions/AHC.java (revision 1676)
205 205

  
206 206
			if (this.symbol == null)	{
207 207
				this.symbol = prefixR + (ahcCounter++);
208
			} else {
209
				try {
210
					RWorkspace.getRWorkspaceInstance().removeVariableFromWorkspace(this.symbol);
211
				} catch (RWorkspaceException e) {
212
					e.printStackTrace();
213
				}
208 214
			}
209 215

  
210 216
			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
......
376 382

  
377 383
	@Override
378 384
	public void clean() {
379
		// TODO Auto-generated method stub
380

  
385
		try {
386
			RWorkspace.getRWorkspaceInstance().removeVariableFromWorkspace(this.symbol);
387
		} catch (RWorkspaceException e) {
388
			e.printStackTrace();
389
		}
381 390
	}
382 391

  
383 392
	/**
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 1676)
46 46
import org.txm.lexicaltable.core.functions.LexicalTable;
47 47
import org.txm.searchengine.cqp.corpus.Property;
48 48
import org.txm.statsengine.core.StatException;
49
import org.txm.statsengine.r.core.RWorkspace;
50
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
49 51
import org.txm.utils.logger.Log;
50 52

  
51 53
/**
......
161 163

  
162 164
	@Override
163 165
	public void clean() {
164
		// TODO Auto-generated method stub
166
		try {
167
			if (this.getCA() != null)	{
168
				RWorkspace.getRWorkspaceInstance().removeVariableFromWorkspace(this.getCA().getSymbol());
169
			}
170
		} catch (RWorkspaceException e) {
171
			e.printStackTrace();
172
		}
165 173
	}
166 174

  
167 175
	@Override
......
177 185
			this.rowtabledata = null;
178 186
			
179 187
			
188
			try {
189
				if (this.getCA() != null)	{
190
					RWorkspace.getRWorkspaceInstance().removeVariableFromWorkspace(this.getCA().getSymbol());
191
				}
192
			} catch (RWorkspaceException e) {
193
				e.printStackTrace();
194
			}
195
			
180 196
			if (this.useFactoMineR) {
181 197
				this.r_ca = new FactoMineRCA(this.getLexicalTable().getData());
182 198
			}
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java (revision 1676)
1488 1488
	 * @throws RWorkspaceException the r workspace exception
1489 1489
	 */
1490 1490
	public void removeVariableFromWorkspace(String variableName) throws RWorkspaceException {
1491
		
1492
		if (variableName == null) return;
1493
		
1491 1494
		try {
1492 1495
			connection.voidEval("rm(" + variableName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
1493 1496
		} catch (RserveException e) {
tmp/TXMReleasePlugins.site/site.xml (revision 1676)
3 3
   <description name="TXM Extensions - RELEASE" url="http://txm.textometrie.org/updates/plugins">
4 4
      This update site contains the Release plugins for TXM
5 5
   </description>
6
   <feature url="features/org.txm.backtomedia.feature_1.0.0.1660.jar" id="org.txm.backtomedia.feature" version="1.0.0.1660">
6
   <feature url="features/org.txm.backtomedia.feature_1.0.0.1674.jar" id="org.txm.backtomedia.feature" version="1.0.0.1674">
7 7
      <category name="Commands"/>
8 8
   </feature>
9
   <feature url="features/org.txm.wordcloud.feature_1.0.0.1660.jar" id="org.txm.wordcloud.feature" version="1.0.0.1660">
9
   <feature url="features/org.txm.wordcloud.feature_1.0.0.1674.jar" id="org.txm.wordcloud.feature" version="1.0.0.1674">
10 10
      <category name="Commands"/>
11 11
   </feature>
12
   <feature url="features/org.txm.treetagger.binaries.feature_1.0.0.1669.jar" id="org.txm.treetagger.binaries.feature" version="1.0.0.1669" os="" ws="">
12
   <feature url="features/org.txm.treetagger.binaries.feature_1.0.0.1674.jar" id="org.txm.treetagger.binaries.feature" version="1.0.0.1674" os="" ws="">
13 13
      <category name="Annotation"/>
14 14
   </feature>
15
   <feature url="features/org.txm.treetagger.models.feature_1.0.0.1660.jar" id="org.txm.treetagger.models.feature" version="1.0.0.1660">
15
   <feature url="features/org.txm.treetagger.models.feature_1.0.0.1674.jar" id="org.txm.treetagger.models.feature" version="1.0.0.1674">
16 16
      <category name="Annotation"/>
17 17
   </feature>
18
   <feature url="features/org.txm.annotation.urs.feature_1.0.0.1660.jar" id="org.txm.annotation.urs.feature" version="1.0.0.1660">
18
   <feature url="features/org.txm.annotation.urs.feature_1.0.0.1674.jar" id="org.txm.annotation.urs.feature" version="1.0.0.1674">
19 19
      <category name="Annotation"/>
20 20
   </feature>
21
   <feature url="features/org.txm.tigersearch.feature_1.0.0.1668.jar" id="org.txm.tigersearch.feature" version="1.0.0.1668">
21
   <feature url="features/org.txm.tigersearch.feature_1.0.0.1674.jar" id="org.txm.tigersearch.feature" version="1.0.0.1674">
22 22
      <category name="Annotation"/>
23 23
   </feature>
24 24
   <category-def name="Commands" label="Commands"/>

Formats disponibles : Unified diff