Révision 3511

TXM/trunk/TXMAlphaPlugins.site/site.xml (revision 3511)
3 3
   <description name="TXM Extensions - Alpha" url="https://gitlab.huma-num.fr/txm/txm-software/-/raw/master/dist/0.8.2/ext/alpha">
4 4
      This update site contains the Alpha extensions for TXM
5 5
   </description>
6
   <feature url="features/org.txm.annotation.urs.feature_1.0.0.202104081736.jar" id="org.txm.annotation.urs.feature" version="1.0.0.202104081736"/>
7
   <feature url="features/org.txm.backtomedia.feature_1.0.0.202104081736.jar" id="org.txm.backtomedia.feature" version="1.0.0.202104081736"/>
8
   <feature url="features/org.txm.dictionary.feature_1.0.0.202104081736.jar" id="org.txm.dictionary.feature" version="1.0.0.202104081736"/>
9
   <feature url="features/org.txm.oriflamms.feature_1.0.0.202104081736.jar" id="org.txm.oriflamms.feature" version="1.0.0.202104081736"/>
10
   <feature url="features/org.txm.svn.feature_1.0.0.202104081736.jar" id="org.txm.svn.feature" version="1.0.0.202104081736"/>
11
   <feature url="features/org.txm.textsbalance.feature_1.0.0.202104081736.jar" id="org.txm.textsbalance.feature" version="1.0.0.202104081736"/>
12
   <feature url="features/org.txm.tigersearch.feature_1.0.0.202104081736.jar" id="org.txm.tigersearch.feature" version="1.0.0.202104081736"/>
13
   <feature url="features/org.txm.translate.feature_1.0.0.202104081736.jar" id="org.txm.translate.feature" version="1.0.0.202104081736"/>
14
   <feature url="features/org.txm.wordcloud.feature_1.0.0.202104081736.jar" id="org.txm.wordcloud.feature" version="1.0.0.202104081736"/>
15
   <feature url="features/org.txm.xmleditor.feature_1.0.0.202104081736.jar" id="org.txm.xmleditor.feature" version="1.0.0.202104081736"/>
16
   <feature url="features/org.txm.udpipe.feature_1.0.0.202104081736.jar" id="org.txm.udpipe.feature" version="1.0.0.202104081736"/>
6
   <feature url="features/org.txm.annotation.urs.feature_1.0.0.202207281752.jar" id="org.txm.annotation.urs.feature" version="1.0.0.202207281752"/>
7
   <feature url="features/org.txm.backtomedia.feature_1.0.0.202207281752.jar" id="org.txm.backtomedia.feature" version="1.0.0.202207281752"/>
8
   <feature url="features/org.txm.dictionary.feature_1.0.0.202207281752.jar" id="org.txm.dictionary.feature" version="1.0.0.202207281752"/>
9
   <feature url="features/org.txm.oriflamms.feature_1.0.0.202207281752.jar" id="org.txm.oriflamms.feature" version="1.0.0.202207281752"/>
10
   <feature url="features/org.txm.svn.feature_1.0.0.202207281752.jar" id="org.txm.svn.feature" version="1.0.0.202207281752"/>
11
   <feature url="features/org.txm.textsbalance.feature_1.0.0.202207281752.jar" id="org.txm.textsbalance.feature" version="1.0.0.202207281752"/>
12
   <feature url="features/org.txm.translate.feature_1.0.0.202207281752.jar" id="org.txm.translate.feature" version="1.0.0.202207281752"/>
13
   <feature url="features/org.txm.wordcloud.feature_1.0.0.202207281752.jar" id="org.txm.wordcloud.feature" version="1.0.0.202207281752"/>
14
   <feature url="features/org.txm.xmleditor.feature_1.0.0.202207281752.jar" id="org.txm.xmleditor.feature" version="1.0.0.202207281752"/>
15
   <feature url="features/org.txm.udpipe.feature_1.0.0.202207281752.jar" id="org.txm.udpipe.feature" version="1.0.0.202207281752"/>
16
   <feature url="features/org.txm.treesearch.feature_1.0.0.202207281752.jar" id="org.txm.treesearch.feature" version="1.0.0.202207281752"/>
17 17
</site>
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/DeleteFile.java (revision 3511)
88 88
	 * open a dialog box to confirm and update views
89 89
	 * 
90 90
	 * @param files the files or directories to delete
91
	 * @param definitive definitivelly delete the files FIXME NOT IMPLEMENTED YET
91
	 * @param definitive definitively delete the files FIXME NOT IMPLEMENTED YET
92 92
	 */
93 93
	public static void delete(List<?> files, boolean definitive) {
94 94
		
......
112 112
									File dest = new File(System.getProperty("java.io.tmpdir"), file.getName());
113 113
									dest.delete();
114 114
									if (!file.renameTo(dest)) {
115
										System.out.println(NLS.bind("Fail to move file to the tmp directory: {0}", file));
115
										System.out.println(NLS.bind("Fail to move the {0} file to the tmp directory: {1}", file, dest));
116 116
									}
117 117
								}
118 118
							}
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroExplorer.java (revision 3511)
300 300
				if (sel instanceof IStructuredSelection) {
301 301
					List<?> objects = ((IStructuredSelection) sel).toList();
302 302
					if (e.keyCode == SWT.DEL) {
303
						boolean definitive = (e.stateMask & SWT.SHIFT) != 0;
303
						boolean definitive = true; //(e.stateMask & SWT.SHIFT) != 0;
304 304
						DeleteFile.delete(objects, definitive);
305 305
					}
306 306
					else if (e.keyCode == SWT.F5) {
TXM/trunk/org.txm.treesearch.rcp/plugin.xml (revision 3511)
61 61
            allPopups="false"
62 62
            locationURI="popup:org.txm.rcp.views.corpora.CorporaView?after=org.txm.rcp.corporaview.annotation">
63 63
         <command
64
               commandId="org.txm.tigersearch.commands.ComputeTreeSearch"
64
               commandId="org.txm.treesearch.command.ComputeTreeSearch"
65 65
               icon="icons/functions/Tree.png"
66 66
               label="%command.label"
67 67
               style="push">
68 68
            <visibleWhen
69
                  checkEnabled="false">
69
                  checkEnabled="true">
70 70
               <or>
71 71
                  <test
72 72
                        forcePluginActivation="true"
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/URSAnnotationsImporter.java (revision 3511)
33 33
import visuAnalec.elements.Schema;
34 34
import visuAnalec.elements.Unite;
35 35
import visuAnalec.fichiers.FichiersGlozz;
36
import visuAnalec.fichiers.FichiersJava;
36 37
import visuAnalec.vue.Vue;
37 38

  
38 39
public class URSAnnotationsImporter {
......
51 52
	
52 53
	protected File aamFile;
53 54
	
55
	protected File evFile;
56
	
54 57
	protected static PersonalNamespaceContext Nscontext = new PersonalNamespaceContext();
55 58
	
56
	public URSAnnotationsImporter(IProgressMonitor monitor, File outputDirectory, File aamFile, MainCorpus mainCorpus, Corpus analecCorpus, Vue analecVue) {
59
	public URSAnnotationsImporter(IProgressMonitor monitor, File outputDirectory, File aamFile, File evFile, MainCorpus mainCorpus, Corpus analecCorpus, Vue analecVue) {
57 60
		this.annotationsDirectory = outputDirectory;
58 61
		this.aamFile = aamFile;
62
		this.evFile = evFile;
59 63
		this.mainCorpus = mainCorpus;
60 64
		this.analecCorpus = analecCorpus;
61 65
		this.analecVue = analecVue;
......
72 76
			Log.warning(NLS.bind("Error: annotationsDirectory is not a directory: {0}.", annotationsDirectory.getAbsolutePath()));
73 77
			return false;
74 78
		}
75
		if (!aamFile.exists()) {
76
			Log.warning(NLS.bind("Warning: aamFile does not exist: {0}.", aamFile.getAbsolutePath()));
77
		}
79
		
80
		if (aamFile == null || !aamFile.exists() || aamFile.isDirectory()) {
81
			Log.warning(NLS.bind("Warning: aamFile does not exist: {0}.", aamFile));
82
		} 
78 83
		else {
79
			
80 84
			if (!FichiersGlozz.importerModeleGlozz(analecCorpus, aamFile)) {
81 85
				Log.warning(NLS.bind("Error while importing Glozz model: {0}", aamFile));
82 86
				return false;
83 87
			}
84 88
		}
89
		
90
		if (evFile == null || !evFile.exists() || evFile.isDirectory()) {
91
			Log.warning(NLS.bind("Warning: evFile does not exist: {0}.", evFile));
92
		}
93
		else {
94
			Vue vue = URSCorpora.getVue(analecCorpus);
95
			if (!FichiersJava.ouvrirVue(vue, evFile)) {
96
				Log.warning(NLS.bind("Error while importing View: {0}", evFile));
97
				return false;
98
			}
99
		}
100
		
85 101
		File[] ursFiles = annotationsDirectory.listFiles(new FilenameFilter() {
86 102
			
87 103
			@Override
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportTEIAnnotations.java (revision 3511)
32 32

  
33 33
	@Option(name="directory",usage="the directory containing the XML-TEI-URS annotations files", widget="Folder", required=true, def="annotations")
34 34
	File directory;
35
	
35 36
	@Option(name="aamFile",usage="The Glozz model file", widget="FileOpen", required=false, def="model.aam")
36 37
	File aamFile;
38
	
39
	@Option(name="evFile",usage="The Analec view file", widget="FileOpen", required=false, def="view.ev")
40
	File evFile;
41
	
37 42
	//@Option(name="standoffAnnotations",usage="select this if the directory contains standoff annotation files", widget="Boolean", required=true, def="false")
38 43
	//boolean standoffAnnotations;
39 44
	@Option(name="resetAnnotations",usage="Remove the old annotations", widget="Boolean", required=true, def="false")
......
66 71
							analecCorpus.clearAnnot();
67 72
						}
68 73
						
69
						if (!importer(monitor, directory, aamFile, true, mainCorpus, analecCorpus, vue)) {
74
						if (!importer(monitor, directory, aamFile, evFile, true, mainCorpus, analecCorpus, vue)) {
70 75
							Log.warning(Messages.ImportTEIAnnotations_2);
71 76
							return Status.CANCEL_STATUS;
72 77
						} else {
......
111 116
	 * @return
112 117
	 * @throws Exception
113 118
	 */
114
	public static boolean importer(IProgressMonitor monitor, File annotationDirectory, File aamFile, boolean standoffAnnotations, MainCorpus mainCorpus, Corpus analecCorpus, Vue vue) throws Exception {
119
	public static boolean importer(IProgressMonitor monitor, File annotationDirectory, File aamFile, File evFile, boolean standoffAnnotations, MainCorpus mainCorpus, Corpus analecCorpus, Vue vue) throws Exception {
115 120
//		if (!standoffAnnotations) { // use stax because files are too big for DOM process
116 121
//			AnalecAnnotationsImporter importer = new AnalecAnnotationsImporter(monitor, annotationDirectory, mainCorpus, analecCorpus, vue);
117 122
//			boolean ret = importer.process();
......
124 129
//			return ret;
125 130
//		}
126 131
		//TODO: DOMAnalecAnnotationsImporter not finished
127
		URSAnnotationsImporter importer = new URSAnnotationsImporter(monitor, annotationDirectory, aamFile, mainCorpus, analecCorpus, vue);
132
		URSAnnotationsImporter importer = new URSAnnotationsImporter(monitor, annotationDirectory, aamFile, evFile, mainCorpus, analecCorpus, vue);
128 133
		boolean ret = importer.process();
129 134
		
130 135
		if (ret) {
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/export/URSAnnotationTEIExporter.java (revision 3511)
16 16
import org.apache.commons.lang.StringUtils;
17 17
import org.eclipse.core.runtime.IProgressMonitor;
18 18
import org.eclipse.osgi.util.NLS;
19
import org.txm.annotation.urs.URSCorpora;
19 20
import org.txm.importer.PersonalNamespaceContext;
20 21
import org.txm.importer.StaxIdentityParser;
21 22
import org.txm.scripts.importer.StaxStackWriter;
......
36 37
import visuAnalec.elements.Schema;
37 38
import visuAnalec.elements.Unite;
38 39
import visuAnalec.fichiers.FichiersGlozz;
40
import visuAnalec.fichiers.FichiersJava;
39 41
import visuAnalec.vue.Vue;
40 42

  
41 43
/**
......
77 79
	 * 1- Copy the XML-TXM files
78 80
	 * 2- Write the annotations
79 81
	 * 3- Write the structure
82
	 * 4- Write the view
80 83
	 * 
81 84
	 * @return true if success
82 85
	 * @throws Exception
......
117 120
		FichiersGlozz.ModelGlozzPrinter gp = new FichiersGlozz.ModelGlozzPrinter(analecCorpus.getStructure(), model);
118 121
		gp.ecrireModel();
119 122
		model.close();
123
		
124
		//FichiersGlozz.exporterModeleGlozz(analecCorpus.getStructure());
125
		File fichierVueCorpus = new File(outputDirectory, mainCorpus.getName()+".ev");
126
		FichiersJava.enregistrerVue(analecVue, fichierVueCorpus);
120 127

  
121 128
		//		File xmltxmStructureFile = new File(outputDirectory, mainCorpus.getName()+"-structure.xml");
122 129
		//		StaxStackWriter writer = new StaxStackWriter(xmltxmStructureFile);
TXM/trunk/org.txm.connlu.core/src/org/txm/conllu/core/function/ImportCoNLLUAnnotations.java (revision 3511)
64 64
					
65 65
					// write previous sentence word properties
66 66
					if (sentenceProperties.size() > 0) {
67
						storeSentenceProperties(sentenceProperties, processor, propertiesPrefix, headPropertiesToProject, depsPropertiesToProject);
67
						storeSentenceProperties(sentenceProperties, processor, propertiesPrefix, headPropertiesToProject, depsPropertiesToProject, udPropertiesToImport);
68 68
					}
69 69
					
70 70
					sent_id = line.substring(12).trim();
......
150 150
		
151 151
		// IF ANY write previous sentence word properties 
152 152
		if (sentenceProperties.size() > 0) {
153
			storeSentenceProperties(sentenceProperties, processor, propertiesPrefix, headPropertiesToProject, depsPropertiesToProject);
153
			storeSentenceProperties(sentenceProperties, processor, propertiesPrefix, headPropertiesToProject, depsPropertiesToProject, udPropertiesToImport);
154 154
		}
155 155
		
156 156
		if (nWords2 == 0) {
......
251 251
		//System.out.println("Result "+sentenceProperties);
252 252
	}
253 253
	
254
	private static void storeSentenceProperties(LinkedHashMap<String, HashMap<String, String>> sentenceProperties, XMLTXMWordPropertiesInjection processor, String propertiesPrefix, Set<String> headPropertiesToProject, Set<String> depsPropertiesToProject) throws IOException, XMLStreamException {
254
	private static void storeSentenceProperties(LinkedHashMap<String, HashMap<String, String>> sentenceProperties, XMLTXMWordPropertiesInjection processor, String propertiesPrefix, Set<String> headPropertiesToProject, Set<String> depsPropertiesToProject, Set<String> udPropertiesToImport) throws IOException, XMLStreamException {
255 255
		
256 256
		buildPropertiesProjections(sentenceProperties, headPropertiesToProject, depsPropertiesToProject);
257 257
		
......
261 261
			
262 262
			for (String p : propertyNames) {
263 263
				
264
				if (udPropertiesToImport != null && udPropertiesToImport.size() > 0 && !udPropertiesToImport.contains(p)) continue; // keep only the sentence properties to import
265
				
264 266
				if (p.startsWith("#")) continue; //property already prefixed with #, do not add the prefix
265 267
				
266 268
				String value = properties.get(p);
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy (revision 3511)
160 160
				this.idxstart.add("w_0")
161 161
				pagedWriter.write("<span id=\"w_0\"/>");
162 162
			}
163
			pagedWriter.writeEndElements();
164
			// write notes
163
			
164
			// write notes before closing all tags 
165 165
			if (notes.size() > 0) {
166 166
				pagedWriter.writeStartElement("hr", ["id":"notes", "width":"20%", "align":"left"]);
167 167
				pagedWriter.writeEndElement() // </hr>
......
181 181
				notes.clear()
182 182
			}
183 183
			
184
			pagedWriter.writeEndElements();
185
			
184 186
			pagedWriter.close();
185 187
			
186 188
			//println "STACK TO REWRITE: $tags"

Formats disponibles : Unified diff