Révision 2080

tmp/org.txm.core/src/java/org/txm/importer/EncodingConverter.java (revision 2080)
182 182

  
183 183
		while (racine != null) {
184 184
			if (racine.exists())
185
				for (File f : racine.listFiles(IOUtils.FILTER_HIDDEN)) {
185
				for (File f : racine.listFiles(IOUtils.HIDDENFILE_FILTER)) {
186 186
					// System.out.println("scan file "+f);
187 187
					if (f.isDirectory()) {
188 188
						if (!f.getName().equals(".svn"))
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartsEngine.java (revision 2080)
754 754

  
755 755
			// FIXME: recursive addition of subdirectories of root font paths
756 756
//			  static protected void traverseDir(File folder, DefaultFontMapper mapper) {
757
//				    File[] files = folder.listFiles(IOUtils.FILTER_HIDDEN);
757
//				    File[] files = folder.listFiles(IOUtils.HIDDENFILE_FILTER);
758 758
//				    for (int i = 0; i < files.length; i++) {
759 759
//				      if (files[i].isDirectory()) {
760 760
//				        mapper.insertDirectory(files[i].getPath());
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java (revision 2080)
352 352
		 * System.out.println("SCRIPTROOTDIR "+script.getParent());
353 353
		 * System.out.println("SCRIPT "+script); GroovyScriptEngine gse; try {
354 354
		 * gse = new GroovyScriptEngine(roots); for(File f :
355
		 * script.getParentFile().listFiles(IOUtils.FILTER_HIDDEN))
355
		 * script.getParentFile().listFiles(IOUtils.HIDDENFILE_FILTER))
356 356
		 * gse.loadScriptByName(f.getName()); Binding binding = new Binding();
357 357
		 * 
358 358
		 * System.out.println("start execution"); gse.run(script.getName(),
tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy (revision 2080)
65 65
			
66 66
			if (xmlFiles.size() > 1) {
67 67
				println "Error, the source directory contains more than one TIGER XML file ?"
68
				isSuccessful = false;
68
				isSuccessFul = false;
69 69
				return;
70 70
			}
71 71
			if (xmlFiles.size() == 0) {
72 72
				println "Error no XML file found in $sourceDirectory directory"
73
				isSuccessful = false;
73
				isSuccessFul = false;
74 74
				return;
75 75
			}
76 76
			println "No TIGER XML 'main.xml' file found. Using $xmlFiles as TIGER XML source file "
......
85 85
			
86 86
			if (xmlFiles.size() == 0) {
87 87
				println "Error no XML file found in $master file"
88
				isSuccessful = false;
88
				isSuccessFul = false;
89 89
				return;
90 90
			}
91 91
		}
......
106 106
		
107 107
		if (!ApplyXsl2.processImportSources(tsXSLFile, xmltxmSrcDir, tokenizedDir)) {
108 108
			println "Error while applying TS XSL file to $xmltxmSrcDir"
109
			isSuccessful = false;
109
			isSuccessFul = false;
110 110
			return;
111 111
		}
112 112

  
113
		File[] files = tokenizedDir.listFiles(IOUtils.FILTER_HIDDEN);
113
		File[] files = tokenizedDir.listFiles(IOUtils.HIDDENFILE_FILTER);
114 114
		if (files == null || files.length == 0) {
115 115
			println "Error while applying TS XSL file to $xmltxmSrcDir is empty"
116
			isSuccessful = false;
116
			isSuccessFul = false;
117 117
			return;
118 118
		}
119 119

  
......
121 121
		if (!doInjectMetadataStep()) return;
122 122

  
123 123
		File txmdDir = new File(module.getBinaryDirectory(),"txm");
124
		isSuccessFul = txmdDir.listFiles(IOUtils.FILTER_HIDDEN).size() > 0
124
		isSuccessFul = txmdDir.listFiles(IOUtils.HIDDENFILE_FILTER).size() > 0
125 125
	}
126 126
}
tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImport.groovy (revision 2080)
9 9
import org.txm.Toolbox;
10 10
import org.txm.importer.ApplyXsl2;
11 11
import org.txm.importer.xtz.*
12
import org.txm.objects.BaseParameters
12
import org.txm.objects.Project
13 13
import org.txm.utils.BundleUtils;
14 14
import org.txm.utils.io.FileCopy;
15 15
import org.apache.log4j.BasicConfigurator;
......
18 18

  
19 19
class TSImport extends XTZImport {
20 20

  
21
	public TSImport(BaseParameters params) {
21
	public TSImport(Project params) {
22 22
		super(params);
23 23
	}
24 24

  
25 25
	@Override
26
	public void init(BaseParameters p) {
26
	public void init(Project p) {
27 27
		super.init(p);
28 28

  
29 29
		importer = new TSImporter(this); // select TIGER XML files then do XTZImporter step
......
40 40
		
41 41
		super.start(); // call the usual XTZ import
42 42
		
43
		if (isSuccessful) {
43
		if (successFul) {
44 44

  
45 45
			File tigerDir = new File(this.binaryDirectory, "tiger");
46 46
			tigerDir.mkdir();
tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/tigersearchLoader.groovy (revision 2080)
19 19
// Public License along with the TXM platform. If not, see
20 20
// http://www.gnu.org/licenses.
21 21
//
22
//
23
//
22 24
// $LastChangedDate: 2015-06-03 15:04:53 +0200 (mer., 03 juin 2015) $
23 25
// $LastChangedRevision: 2984 $
24 26
// $LastChangedBy: mdecorde $
25 27
//
26 28
package org.txm.scripts.importer.tigersearch;
27 29

  
28
import javax.xml.stream.XMLStreamReader;
30
import javax.xml.stream.*
29 31

  
30
import org.txm.scripts.importer.RemoveTag;
31
import org.txm.importer.ApplyXsl2;
32
import org.txm.importer.ValidateXml;
33
import org.txm.objects.*;
34
import org.txm.tokenizer.TokenizerClasses;
35
import org.txm.utils.*;
36
import org.txm.*;
37
import org.txm.importer.xmltxm.*;
38
import org.txm.utils.i18n.*;
39
import org.txm.metadatas.*;
40
import javax.xml.stream.*;
41
import org.w3c.dom.Element
42
import org.txm.utils.xml.DomUtils;
32
import org.txm.*
33
import org.txm.metadatas.*
34
import org.txm.objects.*
35
import org.txm.importer.scripts.xmltxm.*
36
import org.txm.tokenizer.TokenizerClasses
37
import org.txm.utils.*
38
import org.txm.utils.i18n.*
43 39
import org.txm.importer.xtz.*
44 40

  
45 41
String userDir = System.getProperty("user.home");
46 42

  
47 43
def MONITOR;
48
boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
49
BaseParameters params;
50
try {params = paramsBinding;MONITOR=monitor} catch (Exception)
51
{	println "DEV MODE";//exception means we debug
52
	debug = true
53
	params = new BaseParameters(new File(userDir, "xml/roland/import.xml"))
54
	params.load()
55
}
44
Project project;
56 45

  
57
if (params == null) { println "no parameters. Aborting"; return; }
46
try {project=projectBinding;MONITOR=monitor} catch (Exception)
47
{	}
48
if (project == null) { println "no project set. Aborting"; return; }
58 49

  
59
//params.getKeyValueParameters().put(ImportKeys.CLEAN, "false")
60
//params.getKeyValueParameters().put(ImportKeys.MULTITHREAD, "false")
61
//params.getKeyValueParameters().put(ImportKeys.DEBUG, "false")
62
//params.getKeyValueParameters().put(ImportKeys.UPDATECORPUS, "false")
63

  
64
TSImport i = new TSImport(params);
50
TSImport i = new TSImport(project);
51
/*
52
 * To customize the XTZ import, replace the importer, compiler, annotater or pager objects before calling process()
53
		i.importer = new XTZImporter(i)
54
		i.compiler = new XTZCompiler(i)
55
		i.annotater = new TTAnnotater(i);
56
		i.pager = new XTZPager(i)
57
 */
65 58
i.process();
66
readyToLoad = i.isSuccessful
59
readyToLoad = i.successFul && project.save()
tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/srcmf/SrcmfImporter.groovy (revision 2080)
53 53
    File tigerDir = new File(binDir, "tiger")
54 54
    tigerDir.mkdir()
55 55
    File masterpos = new File(tigerDir, "master_pos.xml")
56
    File xmltxm = txmSrcDir.listFiles(IOUtils.FILTER_HIDDEN)[0]
56
    File xmltxm = txmSrcDir.listFiles(IOUtils.HIDDENFILE_FILTER)[0]
57 57
    File logFile = new File(binDir, "tiger.log")
58 58
    def sdi = new SubcorpusDataInject(
59 59
        xmltxm, 
tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/srcmf/srcmfLoader.groovy (revision 2080)
92 92
txmDir.deleteDir();
93 93
txmDir.mkdirs();
94 94
// copy txm files
95
List<File> srcfiles = txmSrcDir.listFiles(IOUtils.FILTER_HIDDEN);
95
List<File> srcfiles = txmSrcDir.listFiles(IOUtils.HIDDENFILE_FILTER);
96 96
for (File f : srcfiles) {// check XML format, and copy file into binDir
97 97
	if (f.getName().equals("import.xml") || f.getName().matches("metadata\\.....?") || f.getName().endsWith(".properties"))
98 98
		continue;
......
102 102
		println "Won't process file "+f;
103 103
	}
104 104
}
105
if (txmDir.listFiles(IOUtils.FILTER_HIDDEN) == null) {
105
if (txmDir.listFiles(IOUtils.HIDDENFILE_FILTER) == null) {
106 106
	println "No txm file to process"
107 107
	return;
108 108
}
109 109

  
110
List<File> filelist = txmDir.listFiles(IOUtils.FILTER_HIDDEN);
110
List<File> filelist = txmDir.listFiles(IOUtils.HIDDENFILE_FILTER);
111 111
Collections.sort(filelist);
112 112

  
113 113
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
......
164 164
File tigerDir = new File(binDir, "tiger");
165 165
tigerDir.mkdir();
166 166
File master = new File(tigerSrcDir, "master.xml");
167
File txmSrcFile = txmSrcDir.listFiles(IOUtils.FILTER_HIDDEN)[0]; // only one text file 
167
File txmSrcFile = txmSrcDir.listFiles(IOUtils.HIDDENFILE_FILTER)[0]; // only one text file 
168 168

  
169 169
// Run SRCMF cmd line corpus import script 
170 170
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERSearchEngine.java (revision 2080)
1 1
package org.txm.searchengine.ts;
2 2

  
3 3
import java.io.File;
4
import java.lang.reflect.Field;
4 5
import java.util.ArrayList;
5 6
import java.util.List;
6 7

  
......
23 24
import ims.tiger.gui.tigergraphviewer.draw.Display_Sentence;
24 25
import ims.tiger.gui.tigergraphviewer.forest.ResultForest;
25 26
import ims.tiger.index.reader.Index;
27
import ims.tiger.index.reader.structure.CorpusFeatures;
28
import ims.tiger.index.reader.structure.SentenceIndex;
26 29
import ims.tiger.query.api.MatchResult;
27 30
import ims.tiger.query.internalapi.InternalCorpusQueryManager;
28 31
import ims.tiger.query.processor.CorpusQueryProcessor;
......
70 73
		CorpusQueryProcessor processor = tigermanager.getQueryProcessor();
71 74
		Index index = processor.getIndex();
72 75
		
76
		
77
		
78
//		Field f = Index.class.getDeclaredField("sentindex");
79
//		f.setAccessible(true);
80
//		SentenceIndex sentenceIndex = (SentenceIndex) f.get(index);
81
//		
82
//		Field f2 = Index.class.getDeclaredField("corpus");
83
//		f2.setAccessible(true);
84
//		CorpusFeatures corpusFeatures = (CorpusFeatures) f2.get(index);
85
		
73 86
		System.out.println("MANAGER="+tigermanager.getClass());
74 87
		int nsentences = 0;
75
		int sentence_sizes[] = new int[nsentences];
88
		//int sentence_sizes[] = new int[nsentences];
76 89
		int size = mresult.size();
77 90
		System.out.println("size: "+size);
78 91
		int subsize = mresult.submatchSize();
92
		
93
		ArrayList<TIGERMatch> tigerMatchesList = new ArrayList<TIGERMatch>();
94
		
95
		int[] starts = new int[index.getNumberOfGraphs()];
96
		for (int i = 0 ; i < index.getNumberOfGraphs() ; i++) {
97
			starts[i] = 0;
98
			if (i > 0) {
99
				starts[i] += index.getNumberOfTNodes(i-1) + starts[i-1];
100
			}
101
		}
102
		System.out.println("sent size="+index.getNumberOfGraphs());
103
		
104
		tcorpus.manager.getSentence(0);
105
		
79 106
		System.out.println("submatchSize: "+subsize);
80 107
		for (int imatch = 0 ; imatch < size; imatch++) { // the matching sentences
81 108
			int sent = mresult.getSentenceNumberAt(imatch);
82 109
			Sentence sentence = tcorpus.manager.getSentence(sent);
110
			
83 111
			System.out.println(" sent: "+sent);
84 112
			int sent_submatch = mresult.getSentenceSubmatchSize(sent);
85 113
			//System.out.println(" sent submatch size: "+sent_submatch);
86 114
			for (int isubmatch = 0 ; isubmatch < sent_submatch ; isubmatch++) { // the matches in the sentence
87 115
				int[] match = mresult.getSentenceSubmatchAt(sent, isubmatch);
88
				//System.out.println("  match="+Arrays.toString(match));
116
				System.out.println("  matches="+Arrays.toString(match));
89 117
				
118
				int sent_start = starts[sent];
119
//				for (int inode : match) {
120
//					System.out.println("   m="+(sent_start+inode));
121
//				}
90 122
				
91
				for (int inode : match) {
92
					System.out.println("  match="+ sentence.getNode(inode).getFeatures());
93
				}
123
				TIGERMatch tigerMatch = new TIGERMatch(sent_start+match[0], sent_start+match[match.length-1]);
124
				System.out.println("   m="+(tigerMatch));
125
				tigerMatchesList.add(tigerMatch);
94 126
			}
95 127
		}
96 128
		
......
152 184
		//			}
153 185
		//		}
154 186

  
155
		System.out.println("FIXME return EmptySelection for now...");
156
		return new EmptySelection(query);
187
		return new TIGERSelection(query, tigerMatchesList);
157 188
	}
158 189

  
159 190
	@Override
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERMatch.java (revision 2080)
1
package org.txm.searchengine.ts;
2

  
3
import org.txm.objects.Match2P;
4

  
5
public class TIGERMatch extends Match2P {
6

  
7
	public TIGERMatch(int start, int end) {
8
		super(start, end);
9
	}
10
}
0 11

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

  
3
import java.util.ArrayList;
4
import java.util.List;
5

  
6
import org.txm.objects.Match;
7
import org.txm.searchengine.core.Query;
8
import org.txm.searchengine.core.Selection;
9

  
10
public class TIGERSelection extends Selection {
11

  
12
	ArrayList<TIGERMatch> matches;
13
	Query query;
14
	
15
	public TIGERSelection(Query query, ArrayList<TIGERMatch> matches2) {
16
		this.query = query;
17
		matches = matches2;
18
	}
19
	
20
	@Override
21
	public List<? extends Match> getMatches() throws Exception {
22
		return matches;
23
	}
24

  
25
	@Override
26
	public List<? extends Match> getMatches(int from, int to) throws Exception {
27
		if (to > matches.size()) to = matches.size();
28
		return matches.subList(from, to + 1); // +1 because Match.getMatches is start-end inclusive and List.subList is start inclusif and end exclusif
29
	}
30

  
31
	@Override
32
	public int getNMatch() throws Exception {
33
		return matches.size();
34
	}
35

  
36
	@Override
37
	public Query getQuery() {
38
		return query;
39
	}
40

  
41
	@Override
42
	public boolean isTargetUsed() throws Exception {
43
		return false;
44
	}
45

  
46
	@Override
47
	public void drop() throws Exception {
48
		// TODO Auto-generated method stub
49
	}
50

  
51
	@Override
52
	public boolean delete(int iMatch) {
53
		if (iMatch < 0) return false;
54
		if (iMatch >= matches.size()) return false;
55
		return matches.remove(iMatch) != null;
56
	}
57

  
58
	@Override
59
	public boolean delete(Match match) {
60
		return matches.remove(match);
61
	}
62

  
63
	@Override
64
	public boolean delete(ArrayList<Match> matchesToRemove) {
65
		return matches.removeAll(matchesToRemove);
66
	}
67
}
0 68

  
tmp/org.txm.tigersearch.rcp/src/org/txm/test/DrawTSSVG.java (revision 2080)
62 62
//			System.out.println( next.toHTML() + "<br>");
63 63

  
64 64
			//	System.out.println( "make some room :)"
65
			//	for(File f : new File("/home/mdecorde/Bureau/tigerexports/").listFiles(IOUtils.FILTER_HIDDEN))
65
			//	for(File f : new File("/home/mdecorde/Bureau/tigerexports/").listFiles(IOUtils.HIDDENFILE_FILTER))
66 66
			//		f.delete()
67 67
			//
68 68

  
tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/search/URSSelection.java (revision 2080)
9 9

  
10 10
public class URSSelection extends Selection {
11 11

  
12
	ArrayList<? extends Match> matches;
12
	ArrayList<URSMatch> matches;
13 13
	Query query;
14 14
	
15 15
	public URSSelection(Query query, ArrayList<URSMatch> matches2) {
tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/TEI2ProjectMacro.groovy (revision 2080)
185 185
	return;
186 186
}
187 187

  
188
if (imagesDirectory.exists() && imagesDirectory.listFiles(IOUtils.FILTER_HIDDEN).size() > 0) {
188
if (imagesDirectory.exists() && imagesDirectory.listFiles(IOUtils.HIDDENFILE_FILTER).size() > 0) {
189 189
	println "Copying images files from $imagesDirectory to $imgDirectory..."
190 190
	FileCopy.copyFiles(imagesDirectory, imgDirectory);
191
	def files = imgDirectory.listFiles(IOUtils.FILTER_HIDDEN)
191
	def files = imgDirectory.listFiles(IOUtils.HIDDENFILE_FILTER)
192 192
	if (files != null) println ""+files.size()+" images copied."
193 193
}
194 194

  
tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/Project2XTZMacro.groovy (revision 2080)
88 88
File wFile = null
89 89
File cFile = null
90 90

  
91
def xmlFiles = textDirectory.listFiles(IOUtils.FILTER_HIDDEN)
91
def xmlFiles = textDirectory.listFiles(IOUtils.HIDDENFILE_FILTER)
92 92
if (xmlFiles == null) return;
93 93

  
94 94
for (File xmlFile : xmlFiles) {
......
126 126
	println "Error: fail to split $cFile"
127 127
	return false
128 128
}
129
if (!ApplyXsl2.processImportSources(cFrontXSLFile, cDirectory.listFiles(IOUtils.FILTER_HIDDEN), [:])) {
129
if (!ApplyXsl2.processImportSources(cFrontXSLFile, cDirectory.listFiles(IOUtils.HIDDENFILE_FILTER), [:])) {
130 130
	println "Error: fail to apply front XSL with $cDirectory files"
131 131
	return false
132 132
}
133 133
// INJECT ontologies 
134 134

  
135 135
println "Injecting ontologies..."
136
for (File f : cDirectory.listFiles(IOUtils.FILTER_HIDDEN)) {
136
for (File f : cDirectory.listFiles(IOUtils.HIDDENFILE_FILTER)) {
137 137
	if (f.getName().startsWith(cDirectory.getName())) {
138 138
		OntologiesProjection cp = new OntologiesProjection(f, projectDirectory);
139 139
		File outputFile = new File(cDirectory, "temp.xml")
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy (revision 2080)
29 29

  
30 30
class XTZImporter extends Importer {
31 31

  
32
	boolean cancelNow = false;
33
	def filesToProcess = []
32
	public boolean cancelNow = false;
33
	public def filesToProcess = []
34 34

  
35
	File frontXSLResultDirectory;
36
	File tokenizedDirectory;
37
	File sentencedDirectory;
35
	public File frontXSLResultDirectory;
36
	public File tokenizedDirectory;
37
	public File sentencedDirectory;
38 38

  
39
	String xslPath;
40
	def xslParams;
41
	String lang;
42
	String wordTag;
43
	boolean doTokenizeStep = false;
39
	public String xslPath;
40
	public def xslParams;
41
	public String lang;
42
	public String wordTag;
43
	public boolean doTokenizeStep = false;
44 44

  
45
	Metadatas metadata = null; // text metadata
45
	public Metadatas metadata = null; // text metadata
46 46

  
47 47
	public XTZImporter(ImportModule module) {
48 48
		super(module);
tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessagesManager.java (revision 2080)
377 377
	//			return null;
378 378
	//		}
379 379
	//
380
	//		for (File messagesJavaFile : messagesPackageDir.listFiles(IOUtils.FILTER_HIDDEN)) {
380
	//		for (File messagesJavaFile : messagesPackageDir.listFiles(IOUtils.HIDDENFILE_FILTER)) {
381 381
	//			if (messagesJavaFile.isDirectory()) continue;
382 382
	//			if (!messagesJavaFile.getName().endsWith("Messages.java")) continue;
383 383
	//			return messagesJavaFile;

Formats disponibles : Unified diff