Revision 1726

tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ConcordanceToUnitMacro.groovy (revision 1726)
82 82

  
83 83
int n = 0
84 84
for (int iLine = 0 ; iLine < lines.size() ; iLine++) {
85
	int iUnit = 0
85 86
	def line = lines[iLine]
86 87
	def m = line.getMatch()
88
	def do_create = true
87 89
	if (create_only_if_new && iUnit < units.size()) { // test only if create_only_if_new == true
88 90
		def unit = null
89
		//TODO don't iterates over
90
		int iUnit = 0
91
		//TODO don't iterates over all units
91 92
		while (iUnit < units.size() ) { //&& units[iUnit].getDeb() < m.getStart()) {
92 93
			if (iUnit < units.size()) {
93 94
				unit = units[iUnit++]
94 95
				if (unit.getDeb() == m.getStart() && unit.getFin() == m.getEnd()) { // skip and print the line
95 96
					println "skiping line: "+line.getViewRef().toString()+" "+line.keywordToString()
97
					do_create = false
96 98
					continue
97 99
				}
98 100
			}
99 101
		}
100 102
	}
101
	n++
102
	def props = [:]
103
	props[prop] = value
104
	Unite u = analecCorpus.addUniteSaisie(unit_type, m.getStart(), m.getEnd(), props)
105
	//println "$props -> "+u.getProps()
103
	if (do_create) {
104
		n++
105
		def props = [:]
106
		props[prop] = value
107
		Unite u = analecCorpus.addUniteSaisie(unit_type, m.getStart(), m.getEnd(), props)
108
		//	println "$props -> "+u.getProps()
109
	}
106 110
}
107 111
println "$n $unit_type created."
108 112
if (n > 0) corpus.setIsModified(true);
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZCompiler.groovy (revision 1726)
185 185
			String concat = name+":"+structsProf.get(name); // append the depth
186 186
			for (String attributeName : structs.get(name)) // append the attributes
187 187
				concat += "+"+attributeName.toLowerCase();
188
				
188
			
189 189
			if (structs.get(name).size() == 0) {
190 190
				concat += "+n";
191 191
			} else {
......
217 217
		println " Structures: "+sargs
218 218
		File allcqpFile = new File(cqpDirectory, "all.cqp");
219 219
		allcqpFile.delete()
220
		try {		
220
		try {
221 221
			if (!CwbEncode.concat(cqpFiles, allcqpFile)) {
222 222
				println "Fail to write the master cqp file: "+allcqpFile
223 223
				return false;
224 224
			}
225
						
225
			
226 226
			if (!cwbEn.run(outputDirectory.getAbsolutePath() + "/$corpusname",
227 227
					allcqpFile.getAbsolutePath(),
228 228
					regPath, pAttributes, sAttributes, false)) {
......
258 258
			
259 259
			// remove milestones from CWB registry and data files
260 260
			FixMilestoneDeclarations fm = new FixMilestoneDeclarations(
261
				new File(regPath), new File(outputDirectory.getAbsolutePath(), corpusname));			
261
				new File(regPath), new File(outputDirectory.getAbsolutePath(), corpusname));
262 262
			if (!fm.process()) {
263 263
				println "Fail to verify&fix milestone declarations"
264 264
				return false

Also available in: Unified diff