Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsReferentialDensityMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsReferentialDensityMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsReferentialDensityMacro.groovy	(revision 2094)
@@ -20,12 +20,12 @@
 
 @Field @Option(name="unit_ursql", usage="TYPE@PROP=VALUE", widget="String", required=false, def="MENTION")
 String unit_ursql
-@Field @Option(name="limit_cql", usage="CQL to build structure limits", widget="Query", required=true, def="<div> [] expand to div")
-limit_cql
+@Field @Option(name="cql_limit", usage="CQL to build structure limits", widget="Query", required=true, def="<div> [] expand to div")
+cql_limit
 @Field @Option(name="strict_inclusion", usage="Units must be strictly included into corpus matches", widget="Boolean", required=true, def="true")
 strict_inclusion
-@Field @Option(name="limit_distance", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-limit_distance
+@Field @Option(name="position", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+position
 
 @Field @Option(name="debug", usage="Show internal variable content", widget="StringArray", metaVar="OFF	ON	ALL	REALLY ALL", required=true, def="OFF")
 debug
@@ -40,7 +40,7 @@
 int nMots = corpus.getSize();
 
 def units = AnalecUtils.selectUnitsInSchema(debug, analecCorpus, corpus, "", 0, 0,
-	unit_ursql, 0, limit_cql, strict_inclusion, limit_distance);
+	unit_ursql, 0, cql_limit, strict_inclusion, position);
 
 int nUnites = units.size();
 
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsStabilityScoreMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsStabilityScoreMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsStabilityScoreMacro.groovy	(revision 2094)
@@ -36,6 +36,9 @@
 @Field @Option(name="word_property", usage="", widget="String", required=false, def="word")
 String word_property
 
+@Field @Option(name="show_values", usage="", widget="Boolean", required=false, def="false")
+boolean show_values
+
 @Field @Option(name="debug", usage="Show internal variable content", widget="StringArray", metaVar="OFF	ON	ALL	REALLY ALL", required=true, def="OFF")
 debug
 
@@ -60,12 +63,21 @@
 def CQI = CQPSearchEngine.getCqiClient()
 
 def prop = corpus.getProperty(word_property)
-
+if (prop == null) { // no CQP property called $word_property
+	errors=AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, AnalecUtils.getFilterParameters(unit_ursql)[0], word_property)
+	if (errors.size() > 0) {
+		println "** $word_property unit property cannot be computed in the corpus with types: $errors."
+		return;
+	}
+}
 def schemas = AnalecUtils.selectSchemasInCorpus(debug, analecCorpus, corpus, schema_ursql, minimum_schema_size, 999999);
 allFormesSet = new HashSet();
-nUnitesGrandTotal = 0;
 def coefs = []
 int n = 1
+
+int nUnitesAllSchemas = 0
+int nUnitesTotalSchemas = 0
+
 for (def schema : schemas) {
 	def formesSet = new HashSet(); // contient toutes les formes du CR courant
 	nUnitesTotal = 0;
@@ -73,7 +85,8 @@
 	def allUnites = schema.getUnitesSousjacentesNonTriees()
 
 	def units = AnalecUtils.filterElements(debug, allUnites, unit_ursql)
-	def nUnites = units.size()
+	def nUnites = schema.getUnitesSousjacentes().size()
+	def nUnitesTotal = units.size()
 	for (def unit : units) {
 	
 		String forme =  null;
@@ -88,26 +101,33 @@
 		}
 		
 		formesSet.add(forme)
-		
-		nUnitesTotal++
 	}
-	if (formesSet.size() == 0) {
-		coef = -1
+	
+	if (formesSet.size() == 0 || nUnitesTotal == 0) {
+		coef = "NA"
 	} else {
 		coef = (nUnitesTotal/formesSet.size())
 	}
 	coefs << coef
-	nUnitesGrandTotal += nUnitesTotal;
 	allFormesSet.addAll(formesSet)
 	
-	if (schema_display_property_name != null) {
+	if (schema_display_property_name != null && schema_display_property_name.length() > 0) {
 		print schema.getProp(schema_display_property_name)
 	} else {
 		print schema_ursql+"-"+n+" : "
 	}
 	
-	println " ($nUnites units) : $nUnitesTotal selected units / ${formesSet.size()} forms = $coef"
+	println " ($nUnites units) : $nUnitesTotal selected units / ${formesSet.size()} ${word_property}s = $coef"
+	if (show_values) {
+		println "\t${word_property}s="+formesSet
+	}
 	n++
+	
+	nUnitesAllSchemas += nUnites
+	nUnitesTotalSchemas += nUnitesTotal
 }
 
-return ["result":coefs, "data":["nUnitesTotal":nUnitesGrandTotal, "allFormesSet":allFormesSet], "coef":(nUnitesGrandTotal/allFormesSet.size())]
\ No newline at end of file
+coef = nUnitesTotalSchemas/allFormesSet.size()
+//println "ALL : ($nUnitesAllSchemas units) : $nUnitesTotalSchemas selected units / ${allFormesSet.size()} ${word_property}s = $coef"
+
+return ["result":coefs, "data":["nUnitesTotal":nUnitesTotalSchemas, "allFormesSet":allFormesSet], "coef":(coef)]
\ No newline at end of file
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsIndexMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsIndexMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsIndexMacro.groovy	(revision 2094)
@@ -51,16 +51,16 @@
 		String unit_property_display
 @Field @Option(name="cqp_property_display", usage="Word property to display instead of the unit property", widget="String", required=false, def="")
 		String cqp_property_display
-@Field @Option(name="limit_distance_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		int limit_distance_in_schema
-@Field @Option(name="limit_cql", usage="CQL to build structure limits", widget="Query", required=true, def="<div> [] expand to div")
-		limit_cql
+@Field @Option(name="position_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int position_in_schema
+@Field @Option(name="cql_limit", usage="CQL to build structure limits", widget="Query", required=true, def="<div> [] expand to div")
+		cql_limit
 @Field @Option(name="strict_inclusion", usage="Units must be strictly included into corpus matches", widget="Boolean", required=true, def="true")
 		strict_inclusion
-@Field @Option(name="limit_distance", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		limit_distance
-@Field @Option(name="output_2D", usage="output barplot or 3D plot", widget="Boolean", required=true, def="true")
-		output_2D
+@Field @Option(name="position", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		position
+//@Field @Option(name="output_2D", usage="output barplot or 3D plot", widget="Boolean", required=true, def="true")
+		output_2D = true
 @Field @Option(name="output_showlegend", usage="output barplot or 3D plot", widget="Boolean", required=true, def="true")
 		output_showlegend
 @Field @Option(name="output_fmin", usage="minimal frequency displayed", widget="Integer", required=true, def="0")
@@ -115,7 +115,7 @@
 	}
 
 	def selectedUnits = AnalecUtils.selectUnitsInSchema(debug, analecCorpus, corpus, schema_ursql, minimum_schema_size, maximum_schema_size,
-			unit_ursql, limit_distance_in_schema, limit_cql, strict_inclusion, limit_distance);
+			unit_ursql, position_in_schema, cql_limit, strict_inclusion, position);
 	selectedUnits = new HashSet(selectedUnits)
 	def counts = null
 	if (cqp_property_display != null && cqp_property_display.length() > 0) {
@@ -163,13 +163,13 @@
 else { corpus = corpusViewSelection }
 
 def title = "${corpus.getMainCorpus()}.${corpusViewSelection}\n${unit_ursql}"
-title += "[${limit_distance}]."
+title += "[${position}]."
 if (cqp_property_display.length() > 0) title += "${cqp_property_display} frequencies"
 else if (unit_property_display.length() > 0) title += "${unit_property_display} frequencies"
-if (limit_cql != null && !limit_cql.getQueryString().equals("\"\"")) title += "\n(${limit_cql} limits)"
+if (cql_limit != null && !cql_limit.getQueryString().equals("\"\"")) title += "\n(${cql_limit} limits)"
 
-if (cqp_property_display.length() > 0) println "Index de la propriété $cqp_property_display des mots des unités $unit_ursql[$limit_distance] de ${corpus.getMainCorpus()}.${corpusViewSelection}"
-else println "Index de la propriété $unit_property_display des unités $unit_ursql[$limit_distance] de ${corpus.getMainCorpus()}.${corpusViewSelection}"
+if (cqp_property_display.length() > 0) println "Index de la propriété $cqp_property_display des mots des unités $unit_ursql[$position] de ${corpus.getMainCorpus()}.${corpusViewSelection}"
+else println "Index de la propriété $unit_property_display des unités $unit_ursql[$position] de ${corpus.getMainCorpus()}.${corpusViewSelection}"
 println "$unit_property_display\t"+selection.join("\t")
 
 keys.eachWithIndex { prop_val, i ->
@@ -223,7 +223,7 @@
 		   library(latticeExtra)
 		   library(lattice)
 		   library(RColorBrewer)
-		   cloud(value~col+row, m, panel.3d.cloud=panel.3dbars, col.facet='grey', xbase=0.4, ybase=0.4, scales=list(arrows=FALSE, col=1), par.settings = list(axis.line = list(col = "transparent")))
+		   cloud(value~col+row, ..., panel.3d.cloud=panel.3dbars, col.facet='grey', xbase=0.4, ybase=0.4, scales=list(arrows=FALSE, col=1), par.settings = list(axis.line = list(col = "transparent")))
 		   """
 	}
 
@@ -260,7 +260,8 @@
 				@Override
 				public void run() { try {
 						if (UnitsIndexMacro.this.output_histogram) {
-							OpenSVGGraph.OpenSVGFile(file.getAbsolutePath(), selection.toString()+" Units")
+							//OpenSVGGraph.OpenSVGFile(file.getAbsolutePath(), selection.toString()+" Units")
+							OpenBrowser.openfile(file.getAbsolutePath())
 						}
 						if (UnitsIndexMacro.this.output_lexicaltable) {
 							CorporaView.refreshObject(corpus)
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemasProgressionMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemasProgressionMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemasProgressionMacro.groovy	(revision 2094)
@@ -46,14 +46,14 @@
 		String schema_property_display
 @Field @Option(name="unit_ursql", usage="TYPE@PROP=VALUE", widget="String", required=false, def="")
 		String unit_ursql
-@Field @Option(name="limit_distance_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		int limit_distance_in_schema
-@Field @Option(name="limit_cql", usage="CQL to build structure limits", widget="Query", required=false, def="")
-		limit_cql
+@Field @Option(name="position_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int position_in_schema
+@Field @Option(name="cql_limit", usage="CQL to build structure limits", widget="Query", required=false, def="")
+		cql_limit
 @Field @Option(name="strict_inclusion", usage="Units must be strictly included into corpus matches", widget="Boolean", required=true, def="true")
 		boolean strict_inclusion
-@Field @Option(name="limit_distance", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		int limit_distance
+@Field @Option(name="position", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int position
 @Field @Option(name="struct_name", usage="Structure to display", widget="String", required=true, def="div")
 		String struct_name
 @Field @Option(name="struct_prop", usage="Structure property to display", widget="String", required=true, def="n")
@@ -77,13 +77,13 @@
 
 def CQI = CQPSearchEngine.getCqiClient()
 
-def limit_cql_matches = null;
-if (limit_cql != null && !limit_cql.getQueryString().equals("\"\"")) {
-	def limitssubcorpus = parent.createSubcorpus(limit_cql, parent.getName().toUpperCase())
-	limit_cql_matches = limitssubcorpus.getMatches();
+def cql_limit_matches = null;
+if (cql_limit != null && !cql_limit.getQueryString().equals("\"\"")) {
+	def limitssubcorpus = parent.createSubcorpus(cql_limit, parent.getName().toUpperCase())
+	cql_limit_matches = limitssubcorpus.getMatches();
 	limitssubcorpus.delete();
 } else {
-	limit_cql_matches = parent.getMatches()
+	cql_limit_matches = parent.getMatches()
 }
 
 def queries = []
@@ -121,12 +121,12 @@
 	}
 
 	allUnits = AnalecUtils.groupAllUnitesInElements(debug, allSchemas)
-	if ((unit_ursql != null && unit_ursql.length() > 0) || (limit_cql != null && !limit_cql.getQueryString().equals("\"\""))) {
+	if ((unit_ursql != null && unit_ursql.length() > 0) || (cql_limit != null && !cql_limit.getQueryString().equals("\"\""))) {
 		if (debug) println "Building selection of units to highlight..."
 		allHighlightedUnits = AnalecUtils.groupAllUnitesInElements(debug, allSchemas, unit_ursql)
 	}
 
-	if (limit_distance_in_schema > 0) allHighlightedUnits = AnalecUtils.filterUniteByInclusionInSchema(debug, allSchemas, limit_distance_in_schema)
+	if (position_in_schema > 0) allHighlightedUnits = AnalecUtils.filterUniteByInclusionInSchema(debug, allSchemas, position_in_schema)
 
 	if (allUnits.size() == 0) {
 		println "No unit match for '$unit_ursql' selection. Aborting"
@@ -150,10 +150,10 @@
 		def selectedAndHighlightedUnits = new HashSet() // faster to find items
 		if (allHighlightedUnits != null && allHighlightedUnits.containsKey(schema)) selectedAndHighlightedUnits.addAll(allHighlightedUnits[schema])
 
-		if (limit_cql_matches != null) {
+		if (cql_limit_matches != null) {
 			if (debug) println "corpus matches: "+parent.getMatches()
-			if (debug) println "filter limit_cql_matches=${limit_cql_matches} with "+selectedAndHighlightedUnits.size()+" units."
-			selectedAndHighlightedUnits = AnalecUtils.filterUniteByInclusion(debug, selectedAndHighlightedUnits, limit_cql_matches, strict_inclusion, limit_distance)
+			if (debug) println "filter cql_limit_matches=${cql_limit_matches} with "+selectedAndHighlightedUnits.size()+" units."
+			selectedAndHighlightedUnits = AnalecUtils.filterUniteByInclusion(debug, selectedAndHighlightedUnits, cql_limit_matches, strict_inclusion, position)
 			if (debug) println "selectedAndHighlightedUnits=${selectedAndHighlightedUnits.size()}"
 		}
 
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsListMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsListMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsListMacro.groovy	(revision 2094)
@@ -48,14 +48,14 @@
 		int maximum_schema_size
 @Field @Option(name="unit_ursql", usage="TYPE@PROP=VALUE", widget="String", required=false, def="MENTION")
 		String unit_ursql
-@Field @Option(name="limit_distance_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		int limit_distance_in_schema
-@Field @Option(name="limit_cql", usage="CQL to build structure limits", widget="Query", required=false, def="")
-		limit_cql
+@Field @Option(name="position_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int position_in_schema
+@Field @Option(name="cql_limit", usage="CQL to build structure limits", widget="Query", required=false, def="")
+		cql_limit
 @Field @Option(name="strict_inclusion", usage="Units must be strictly included into corpus matches", widget="Boolean", required=true, def="true")
 		boolean strict_inclusion
-@Field @Option(name="limit_distance", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		int limit_distance
+@Field @Option(name="position", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int position
 @Field @Option(name="output_mode", usage="If selected units properties and words are shown", widget="StringArray", metaVar="COUNT	TABULATED	FORMATED	CONCORDANCE	CQL", required=true, def="FORMATED")
 		output_mode
 @Field @Option(name="debug", usage="Show internal variable content", widget="StringArray", metaVar="OFF	ON	ALL	REALLY ALL", required=true, def="OFF")
@@ -76,7 +76,7 @@
 	def analecCorpus = URSCorpora.getCorpus(mainCorpus)
 
 	def selectedUnits = AnalecUtils.selectUnitsInSchema(debug, analecCorpus, corpus, schema_ursql, minimum_schema_size, maximum_schema_size,
-			unit_ursql, limit_distance_in_schema, limit_cql, strict_inclusion, limit_distance);
+			unit_ursql, position_in_schema, cql_limit, strict_inclusion, position);
 
 	def n = 1
 
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsSummaryMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsSummaryMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsSummaryMacro.groovy	(revision 2094)
@@ -43,14 +43,14 @@
 		int maximum_schema_size
 @Field @Option(name="unit_ursql", usage="TYPE@PROP=VALUE", widget="String", required=false, def="MENTION")
 		String unit_ursql
-@Field @Option(name="limit_distance_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		int limit_distance_in_schema
-@Field @Option(name="limit_cql", usage="CQL to build structure limits", widget="Query", required=false, def="")
-		limit_cql
+@Field @Option(name="position_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int position_in_schema
+@Field @Option(name="cql_limit", usage="CQL to build structure limits", widget="Query", required=false, def="")
+		cql_limit
 @Field @Option(name="strict_inclusion", usage="Units must be strictly included into corpus matches", widget="Boolean", required=false, def="true")
 		boolean strict_inclusion
-@Field @Option(name="limit_distance", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		int limit_distance
+@Field @Option(name="position", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int position
 @Field @Option(name="debug", usage="Show internal variable content", widget="StringArray", metaVar="OFF	ON	ALL	REALLY ALL", required=true, def="OFF")
 		debug
 if (!ParametersDialog.open(this)) return
@@ -70,7 +70,7 @@
 		props.addAll(analecCorpus.getStructure().getUniteProperties(type));
 
 	def selectedUnits = AnalecUtils.selectUnitsInSchema(debug, analecCorpus, corpus, schema_ursql, minimum_schema_size, maximum_schema_size, 
-	unit_ursql, limit_distance_in_schema, limit_cql, strict_inclusion, limit_distance);
+	unit_ursql, position_in_schema, cql_limit, strict_inclusion, position);
 
 	allresults[corpus] = selectedUnits;
 }
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ConcordanceToUnitMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ConcordanceToUnitMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ConcordanceToUnitMacro.groovy	(revision 2094)
@@ -1,112 +0,0 @@
-// STANDARD DECLARATIONS
-package org.txm.macro.urs.edit
-
-import org.kohsuke.args4j.*
-import groovy.transform.Field
-import org.txm.rcp.swt.widget.parameters.*
-import org.txm.rcp.editors.concordances.*
-import org.txm.searchengine.cqp.corpus.CQPCorpus
-import org.txm.searchengine.cqp.corpus.MainCorpus
-import org.txm.functions.concordances.*
-import org.txm.annotation.urs.*
-import org.txm.concordance.core.functions.Concordance
-import org.txm.concordance.rcp.editors.ConcordanceEditor
-import visuAnalec.elements.Unite
-
-// BEGINNING OF PARAMETERS
-
-@Field @Option(name="unit_type", usage="The unit type to create", widget="String", required=true, def="MENTION")
-def unit_type
-
-@Field @Option(name="create_only_if_new", usage="Create the unit if not already annotated", widget="Boolean", required=true, def="true")
-def create_only_if_new
-
-@Field @Option(name="prop", usage="prop", widget="String", required=true, def="REF")
-def prop
-
-@Field @Option(name="value", usage="default value", widget="String", required=true, def="NAME")
-def value
-
-// END OF PARAMETERS
-
-// get a Concordance from 1) current Concordance editor or 2) CorporaView selection
-Concordance concordance
-if (editor instanceof ConcordanceEditor) {
-	concordance = editor.getConcordance()
-} else if (corpusViewSelection instanceof Concordance) {
-	concordance = corpusViewSelection
-} else {
-	println "You must select a concordance or open a concordance result to run this macro."
-	return false
-}
-
-if (concordance == null) {
-	println "You must compute a concordance before."
-	return
-}
-
-// check the analec corpus is ready
-CQPCorpus corpus = concordance.getCorpus().getMainCorpus();
-String name = corpus.getID()
-if (!URSCorpora.isAnnotationStructureReady(corpus)) {
-	println "Annotation structure is not ready."
-	return
-}
-
-// Open the parameters input dialog box
-if (!ParametersDialog.open(this)) return;
-
-// check the corpus structure has the unit_type provided
-def analecCorpus = URSCorpora.getCorpus(corpus)
-if (!analecCorpus.getStructure().getUnites().contains(unit_type)) {
-	//println "The corpus structure does not contains unit with type=$unit_type"
-	//return;
-	analecCorpus.getStructure().ajouterType(Unite.class, unit_type);
-}
-
-if (!analecCorpus.getStructure().getNomsProps(Unite.class, unit_type).contains(prop)) {
-	//println "The corpus structure does not contains unit with type=$unit_type"
-	//return;
-	analecCorpus.getStructure().ajouterProp(Unite.class, unit_type, prop)
-}
-
-if (!analecCorpus.getStructure().getValeursProp(Unite.class, unit_type, prop).contains(value)) {
-	//println "The corpus structure does not contains unit with type=$unit_type"
-	//return;
-	analecCorpus.getStructure().ajouterVal(Unite.class, unit_type, prop, value)
-}
-
-// browse lines and check
-def units = analecCorpus.getUnites(unit_type)
-def lines = concordance.getLines()
-
-int n = 0
-for (int iLine = 0 ; iLine < lines.size() ; iLine++) {
-	int iUnit = 0
-	def line = lines[iLine]
-	def m = line.getMatch()
-	def do_create = true
-	if (create_only_if_new && iUnit < units.size()) { // test only if create_only_if_new == true
-		def unit = null
-		//TODO don't iterates over all units
-		while (iUnit < units.size() ) { //&& units[iUnit].getDeb() < m.getStart()) {
-			if (iUnit < units.size()) {
-				unit = units[iUnit++]
-				if (unit.getDeb() == m.getStart() && unit.getFin() == m.getEnd()) { // skip and print the line
-					println("skiping concordance line '"+line.keywordToString()+"' at "+line.getViewRef().toString()+" ("+unit.getDeb()+ ", "+unit.getFin()+")")
-					do_create = false
-					continue
-				}
-			}
-		}
-	}
-	if (do_create) {
-		n++
-		def props = [:]
-		props[prop] = value
-		Unite u = analecCorpus.addUniteSaisie(unit_type, m.getStart(), m.getEnd(), props)
-		//	println "$props -> "+u.getProps()
-	}
-}
-println "$n $unit_type created."
-if (n > 0) corpus.setIsModified(true);
\ No newline at end of file
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/UnitsDeleteMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/UnitsDeleteMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/UnitsDeleteMacro.groovy	(revision 2094)
@@ -43,14 +43,14 @@
 		int minimum_schema_size
 @Field @Option(name="unit_ursql", usage="TYPE@PROP=VALUE", widget="String", required=false, def="MENTION")
 		String unit_ursql
-@Field @Option(name="limit_distance_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		int limit_distance_in_schema
-@Field @Option(name="limit_cql", usage="CQL to build structure limits", widget="Query", required=true, def="<div> [] expand to div")
-		limit_cql
+@Field @Option(name="position_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int position_in_schema
+@Field @Option(name="cql_limit", usage="CQL to build structure limits", widget="Query", required=true, def="<div> [] expand to div")
+		cql_limit
 @Field @Option(name="strict_inclusion", usage="Units must be strictly included into corpus matches", widget="Boolean", required=true, def="true")
 		boolean strict_inclusion
-@Field @Option(name="limit_distance", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		int limit_distance
+@Field @Option(name="position", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int position
 
 @Field @Option(name="debug", usage="Show internal variable content", widget="StringArray", metaVar="OFF	ON	ALL	REALLY ALL", required=true, def="OFF")
 		debug
@@ -69,7 +69,7 @@
 	Structure structure = analecCorpus.getStructure()
 
 	def selectedUnits = AnalecUtils.selectUnitsInSchema(debug, analecCorpus, corpus, schema_ursql, minimum_schema_size, Integer.MAX_VALUE,
-			unit_ursql, limit_distance_in_schema, limit_cql, strict_inclusion, limit_distance);
+			unit_ursql, position_in_schema, cql_limit, strict_inclusion, position);
 		
 	def n = 0
 	def nerrors = 0
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/UnitsAnnotateMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/UnitsAnnotateMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/UnitsAnnotateMacro.groovy	(revision 2094)
@@ -43,14 +43,14 @@
 		int minimum_schema_size
 @Field @Option(name="unit_ursql", usage="TYPE@PROP=VALUE", widget="String", required=false, def="MENTION")
 		String unit_ursql
-@Field @Option(name="limit_distance_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		int limit_distance_in_schema
-@Field @Option(name="limit_cql", usage="CQL to build structure limits", widget="Query", required=true, def="<div> [] expand to div")
-		limit_cql
+@Field @Option(name="position_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int position_in_schema
+@Field @Option(name="cql_limit", usage="CQL to build structure limits", widget="Query", required=false, def="<div> [] expand to div")
+		cql_limit
 @Field @Option(name="strict_inclusion", usage="Units must be strictly included into corpus matches", widget="Boolean", required=true, def="true")
 		boolean strict_inclusion
-@Field @Option(name="limit_distance", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
-		int limit_distance
+@Field @Option(name="position", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int position
 
 @Field @Option(name="unit_property_to_set", usage="PROP", widget="String", required=false, def="TESTPROP")
 		String unit_property_to_set
@@ -80,7 +80,7 @@
 	analecView.initVueParDefaut()
 
 	def selectedUnits = AnalecUtils.selectUnitsInSchema(debug, analecCorpus, corpus, schema_ursql, minimum_schema_size, Integer.MAX_VALUE,
-			unit_ursql, limit_distance_in_schema, limit_cql, strict_inclusion, limit_distance);
+			unit_ursql, position_in_schema, cql_limit, strict_inclusion, position);
 		
 	println " "+selectedUnits.size()+" units to annotate..."
 	def n = 0
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ConcordanceToUnitsMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ConcordanceToUnitsMacro.groovy	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ConcordanceToUnitsMacro.groovy	(revision 2094)
@@ -0,0 +1,112 @@
+// STANDARD DECLARATIONS
+package org.txm.macro.urs.edit
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcp.swt.widget.parameters.*
+import org.txm.rcp.editors.concordances.*
+import org.txm.searchengine.cqp.corpus.CQPCorpus
+import org.txm.searchengine.cqp.corpus.MainCorpus
+import org.txm.functions.concordances.*
+import org.txm.annotation.urs.*
+import org.txm.concordance.core.functions.Concordance
+import org.txm.concordance.rcp.editors.ConcordanceEditor
+import visuAnalec.elements.Unite
+
+// BEGINNING OF PARAMETERS
+
+@Field @Option(name="unit_type", usage="The unit type to create", widget="String", required=true, def="MENTION")
+def unit_type
+
+@Field @Option(name="create_only_if_new", usage="Create the unit if not already annotated", widget="Boolean", required=true, def="true")
+def create_only_if_new
+
+@Field @Option(name="prop", usage="prop", widget="String", required=true, def="REF")
+def prop
+
+@Field @Option(name="value", usage="default value", widget="String", required=true, def="NAME")
+def value
+
+// END OF PARAMETERS
+
+// get a Concordance from 1) current Concordance editor or 2) CorporaView selection
+Concordance concordance
+if (editor instanceof ConcordanceEditor) {
+	concordance = editor.getConcordance()
+} else if (corpusViewSelection instanceof Concordance) {
+	concordance = corpusViewSelection
+} else {
+	println "You must select a concordance or open a concordance result to run this macro."
+	return false
+}
+
+if (concordance == null) {
+	println "You must compute a concordance before."
+	return
+}
+
+// check the analec corpus is ready
+CQPCorpus corpus = concordance.getCorpus().getMainCorpus();
+String name = corpus.getID()
+if (!URSCorpora.isAnnotationStructureReady(corpus)) {
+	println "Annotation structure is not ready."
+	return
+}
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+// check the corpus structure has the unit_type provided
+def analecCorpus = URSCorpora.getCorpus(corpus)
+if (!analecCorpus.getStructure().getUnites().contains(unit_type)) {
+	//println "The corpus structure does not contains unit with type=$unit_type"
+	//return;
+	analecCorpus.getStructure().ajouterType(Unite.class, unit_type);
+}
+
+if (!analecCorpus.getStructure().getNomsProps(Unite.class, unit_type).contains(prop)) {
+	//println "The corpus structure does not contains unit with type=$unit_type"
+	//return;
+	analecCorpus.getStructure().ajouterProp(Unite.class, unit_type, prop)
+}
+
+if (!analecCorpus.getStructure().getValeursProp(Unite.class, unit_type, prop).contains(value)) {
+	//println "The corpus structure does not contains unit with type=$unit_type"
+	//return;
+	analecCorpus.getStructure().ajouterVal(Unite.class, unit_type, prop, value)
+}
+
+// browse lines and check
+def units = analecCorpus.getUnites(unit_type)
+def lines = concordance.getLines()
+
+int n = 0
+for (int iLine = 0 ; iLine < lines.size() ; iLine++) {
+	int iUnit = 0
+	def line = lines[iLine]
+	def m = line.getMatch()
+	def do_create = true
+	if (create_only_if_new && iUnit < units.size()) { // test only if create_only_if_new == true
+		def unit = null
+		//TODO don't iterates over all units
+		while (iUnit < units.size() ) { //&& units[iUnit].getDeb() < m.getStart()) {
+			if (iUnit < units.size()) {
+				unit = units[iUnit++]
+				if (unit.getDeb() == m.getStart() && unit.getFin() == m.getEnd()) { // skip and print the line
+					println("skiping concordance line '"+line.keywordToString()+"' at "+line.getViewRef().toString()+" ("+unit.getDeb()+ ", "+unit.getFin()+")")
+					do_create = false
+					continue
+				}
+			}
+		}
+	}
+	if (do_create) {
+		n++
+		def props = [:]
+		props[prop] = value
+		Unite u = analecCorpus.addUniteSaisie(unit_type, m.getStart(), m.getEnd(), props)
+		//	println "$props -> "+u.getProps()
+	}
+}
+println "$n $unit_type created."
+if (n > 0) corpus.setIsModified(true);
\ No newline at end of file
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/AnalecUtils.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/AnalecUtils.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/AnalecUtils.groovy	(revision 2094)
@@ -93,14 +93,14 @@
  * @param minimum_schema_size
  * @param maximum_schema_size
  * @param unit_ursql
- * @param limit_cql
+ * @param cql_limit
  * @param strict_inclusion
- * @param limit_distance
+ * @param position
  * @return
  */
 static def selectUnitsInSchema(def debug, Corpus analecCorpus, org.txm.searchengine.cqp.corpus.CQPCorpus corpus,
 		String schema_ursql, Integer minimum_schema_size, Integer maximum_schema_size,
-		String unit_ursql, Integer limit_distance_in_schema, CQLQuery limit_cql, Boolean strict_inclusion, int limit_distance) {
+		String unit_ursql, Integer position_in_schema, CQLQuery cql_limit, Boolean strict_inclusion, int position) {
 	def groupedUnits = []
 	if (schema_ursql != null && schema_ursql.length() > 0 || minimum_schema_size > 1) {
 		def allSchema = null;
@@ -114,7 +114,7 @@
 
 		groupedUnits = AnalecUtils.groupAllUnitesInElements(debug, allSchema, unit_ursql)
 		
-		if (limit_distance_in_schema >= 0) groupedUnits = AnalecUtils.filterUniteByInclusionInSchema(debug, groupedUnits, limit_distance_in_schema)
+		if (position_in_schema >= 0) groupedUnits = AnalecUtils.filterUniteByInclusionInSchema(debug, groupedUnits, position_in_schema)
 
 	} else {
 		groupedUnits = ["all":AnalecUtils.findAllInCorpus(debug, analecCorpus, Unite.class, unit_ursql)]
@@ -122,8 +122,8 @@
 	if (debug >= 2) println "groupedUnits=${groupedUnits.size()}"
 
 	def matches = null
-	if (limit_cql != null && !limit_cql.getQueryString().equals("\"\"")) {
-		Subcorpus limitssubcorpus = corpus.createSubcorpus(limit_cql, corpus.getID().toUpperCase())
+	if (cql_limit != null && !cql_limit.getQueryString().equals("\"\"")) {
+		Subcorpus limitssubcorpus = corpus.createSubcorpus(cql_limit, corpus.getID().toUpperCase())
 		matches = limitssubcorpus.getMatches();
 		limitssubcorpus.delete();
 	} else {
@@ -132,7 +132,7 @@
 	if (debug >= 2) println "matches=${matches}"
 	def allUnits = []
 	for (def k : groupedUnits.keySet()) {
-		def selectedUnits = AnalecUtils.filterUniteByInclusion(debug, groupedUnits[k], matches, strict_inclusion, limit_distance)
+		def selectedUnits = AnalecUtils.filterUniteByInclusion(debug, groupedUnits[k], matches, strict_inclusion, position)
 		allUnits.addAll(selectedUnits)
 	}
 	if (debug >= 2) println "selectedUnits=${allUnits.size()}"
@@ -306,22 +306,22 @@
 	return selectedUnitsPerMatch
 }
 
-static def filterUniteByInclusion(def debug, def allUnites, def matches, boolean strict_inclusion, int limit_distance) {
+static def filterUniteByInclusion(def debug, def allUnites, def matches, boolean strict_inclusion, int position) {
 
 	def selectedUnitsPerMatch = groupByMatch(debug, allUnites, matches, strict_inclusion);
 	//println "selectedUnitsPerMatch size="+selectedUnitsPerMatch.size()
 	def selectedUnits = []
-	if (limit_distance != 0) {
-		if (limit_distance > 0) limit_distance--
+	if (position != 0) {
+		if (position > 0) position--
 
 		for (def m : selectedUnitsPerMatch.keySet()) {
-			if (selectedUnitsPerMatch[m].size() > limit_distance && selectedUnitsPerMatch[m].size() > 0) {
+			if (selectedUnitsPerMatch[m].size() > position && selectedUnitsPerMatch[m].size() > 0) {
 				def units = selectedUnitsPerMatch[m]
 				//println "$m -> "+units.collect() {it -> it.getDeb()}
 				units = units.sort() { a, b -> a.getDeb() <=> b.getDeb() ?: a.getFin() <=> b.getFin() }
 				//println "$m -> "+units.collect() {it -> it.getDeb()}
-				selectedUnits << units[limit_distance]
-				if (debug >=3) println "dist select: "+units[limit_distance].getDeb()
+				selectedUnits << units[position]
+				if (debug >=3) println "dist select: "+units[position].getDeb()
 			}
 		}
 	} else {
@@ -387,17 +387,17 @@
 	int atidx = URSQL.indexOf("@");
 	int equalidx = URSQL.indexOf("=");
 
-	if (atidx >= 0 && equalidx >= 0 && atidx < equalidx) {
+	if (atidx >= 0 && equalidx >= 0 && atidx < equalidx) { // TYPE@PROP=VALUE
 		type = URSQL.substring(0, atidx)
 		prop = URSQL.substring(atidx+1, equalidx)
 		value = URSQL.substring(equalidx+1)
-	} else if (atidx >= 0) {
+	} else if (atidx >= 0) { // TYPE@PROP
 		type = URSQL.substring(0, atidx)
 		prop = URSQL.substring(atidx+1)
-	} else if (equalidx >= 0) {
+	} else if (equalidx >= 0) { // TYPE=VALUE -> not well formed
 		type = URSQL.substring(0, equalidx)
 		value = URSQL.substring(equalidx+1)
-	} else {
+	} else { // TYPE
 		type = URSQL;
 	}
 	//	println(["'"+type+"'", "'"+prop+"'", "'"+value+"'"])
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/check/CheckDuplicatesInSchemasMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/check/CheckDuplicatesInSchemasMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/check/CheckDuplicatesInSchemasMacro.groovy	(revision 2094)
@@ -96,7 +96,7 @@
 }
 
 if (duplicates.size() > 0) {
-	println "Duplicates found"
+	println "${duplicates.size()} duplicates found"
 	for (def unit : duplicates.keySet()) {
 		println AnalecUtils.toString(CQI, word, unit)+" in: "
 		for (Schema schema : duplicates[unit]) {
@@ -104,7 +104,7 @@
 		}
 	}
 } else {
-	println "No duplicates found in $schema_ursql units"
+	println "No duplicates found in $schema_ursql schema units"
 }
 
 return duplicates
\ No newline at end of file
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/RetoucheComplementDuNomMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/RetoucheComplementDuNomMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/RetoucheComplementDuNomMacro.groovy	(revision 2094)
@@ -5,8 +5,8 @@
 import org.kohsuke.args4j.*
 import groovy.transform.*
 import org.txm.*
-import org.txm.rcp.swt.widget.parameters.*
-import org.txm.annotation.urs.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.analec.*
 import org.txm.searchengine.cqp.*
 import org.txm.searchengine.cqp.corpus.*
 import visuAnalec.Message.*
@@ -16,33 +16,37 @@
 
 
 /*  MACRO pour corriger une erreur d'annotation
- Retirer le "De" du complément du nom
- Algo : 
- POUR CHAQUE MENTION dont le premier mot est "de" (en minuscules)
- SI     il existe une autre MENTION dans laquelle celle-ci est totalement incluse
- ALORS  incrémenter d'un mot la frontière gauche de la mention
- Ajouter la categorie CDN.CHECK pour qu'on puisse verifier facilement le job.
- */
+    Retirer le "de" ou le "d'" (forme élidée) du complément du nom
 
+   Algo : 
+   POUR CHAQUE MENTION dont le premier mot est "de" (en minuscules)
+   SI     il existe une autre MENTION dans laquelle celle-ci est totalement incluse
+   ALORS  incrémenter d'un mot la frontière gauche de la mention
+   Ajouter la categorie CDN.CHECK pour qu'on puisse verifier facilement le job.
+   
+   Cette macro ne s'appuie pas sur des catégories morphosyntaxiques. 
+   On peut donc la faire tourner avant les frpos2cattex ou fropos2cattex
+   
+   Auteur : Matthieu QUIGNARD
+   Date : 18 janvier 2019
+*/
+
 // BEGINNING OF PARAMETERS
-if (!(corpusViewSelection instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
-	println "Selection must be a Corpus: "+corpusViewSelection
-	return;
-}
+
 // Declare each parameter here
 // BEGINNING OF PARAMETERS
 @Field @Option(name="unit_type", usage="", widget="String", required=true, def="MENTION")
-		def unit_type
+def unit_type
 @Field @Option(name="category_name", usage="", widget="String", required=true, def="CATEGORIE")
-		def category_name
+def category_name
 if (!ParametersDialog.open(this)) return
 
-	corpus = corpusViewSelection.getMainCorpus()
-CQI = CQPSearchEngine.getCqiClient()
+corpus = corpusViewSelection
+CQI = Toolbox.getCqiClient()
 word = corpus.getWordProperty()
 
-analecCorpus = URSCorpora.getCorpus(corpus)
-vue = URSCorpora.getVue(corpus)
+analecCorpus = AnalecCorpora.getCorpus(corpus.getName())
+vue = AnalecCorpora.getVue(corpus.getName())
 structure = analecCorpus.getStructure()
 if (!structure.getUnites().contains(unit_type)) { // check if the structure contains the unit_type units
 	println "Error: corpus structure does not contains unit with name=$unit_type"
@@ -51,8 +55,8 @@
 
 
 // Si la structure d'annotation ne contient pas CATEGORIE, on la crée avec ses valeurs
-if (!structure.getUniteProperties(unit_type).contains(category_name)) {
-	structure.ajouterProp(Unite.class, unit_type, category_name)
+if (!structure.getUniteProperties(unit_type).contains(category_name)) { 
+   structure.ajouterProp(Unite.class, unit_type, category_name)
 }
 
 def check_cat = "CDN.CHECK"
@@ -69,49 +73,49 @@
 units.sort() { a, b -> a.getDeb() <=> b.getDeb() ?: a.getFin() <=> b.getFin() }
 
 /* Test sur la premiere mention :
- def debut1 = units[1].getDeb()
- def fin1 = units[1].getFin()
- println "$debut1 - $fin1"
- units[1].setDeb( debut1 + 1)
- units[1].setFin( fin1 + 1)
- URSCorpora.getVue(analecCorpus).retablirVueParDefaut()
- def debut2 = units[1].getDeb()
- def fin2 = units[1].getFin()
- println "$debut2 - $fin2"
- */
+def debut1 = units[1].getDeb()
+def fin1 = units[1].getFin()
+println "$debut1 - $fin1"
+units[1].setDeb( debut1 + 1)
+units[1].setFin( fin1 + 1)
+AnalecCorpora.getVue(analecCorpus).retablirVueParDefaut()
+def debut2 = units[1].getDeb()
+def fin2 = units[1].getFin()
+println "$debut2 - $fin2"
+*/
 
 
 for (Unite unit : units) { // process all units
-
+	
 	def debut = unit.getDeb()
 	def fin = unit.getFin()
 	def premierMot = CQI.cpos2Str(word.getQualifiedName(), debut)[0]
-
-	if (premierMot != "de") {
+		
+	if ((premierMot != "de") && (premierMot !="d'")) {
 		nIgnored1++
 		compteur++
 		continue
 	} else {
-		for (i = compteur-1; i >= 0 ; i--) {
+		for (i = compteur-1; i>=0 ; i--) {
 			def u = units[i]
 			def udeb = u.getDeb()
 			def ufin = u.getFin()
 			if (ufin >= fin) {
-				println "\nAVANT => Unit $compteur : $debut - $fin"
-				if (fin > debut) unit.setDeb( debut++ )
-				else println "not resizing"
-				def debut2 = unit.getDeb()
-				def fin2 = unit.getFin()
-				URSCorpora.getVue(analecCorpus).retablirVueParDefaut()
-				println "APRES => Unit $compteur : $debut2 - $fin2"
-				unit.getProps().put(category_name, check_cat)
-				break
+			   println "\nAVANT => Unit $compteur : $debut - $fin"
+			   if (fin > debut) unit.setDeb( ++debut ) 
+			   else println "not resizing"
+			   def debut2 = unit.getDeb()
+			   def fin2 = unit.getFin()
+			   AnalecCorpora.getVue(analecCorpus).retablirVueParDefaut()
+			   println "APRES => Unit $compteur : $debut2 - $fin2"
+			   unit.getProps().put(category_name, check_cat)
+			   break
 			}
 		}
-		if (i < 0) nIgnored2++
+		if (i <0) nIgnored2++
 		else nModified++
 		compteur++
-	}
+	} 
 }
 
 println "\nResult:"
@@ -121,5 +125,5 @@
 println "Total ($compteur)."
 
 // END OF PARAMETERS
-URSCorpora.getVue(analecCorpus).retablirVueParDefaut()
+AnalecCorpora.getVue(analecCorpus).retablirVueParDefaut()
 println "corpora selection: "+corpusViewSelection
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/VerificationsMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/VerificationsMacro.groovy	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/VerificationsMacro.groovy	(revision 2094)
@@ -0,0 +1,258 @@
+// Auteur Matthieu Quignard
+// Date : 14 janvier 2019
+
+/**********
+Vérifications automatiques
+1. Repère les mentions sans catégorie : CHECK > CAT
+2. Repère les mentions sans référent : CHECK > REF
+3. Supprime les ponctuations en début et en fin de mention : CHECK > BORNES
+4. Supprime les prépositions autres que 'de' en début de mention : CHECK > BORNES
+5. Supprime automatiquement toutes les mentions vides = sans aucun mot = de longueur 0
+6. Détecter les mentions qui ont exactement les mêmes bornes  : CHECK > DOUBLON
+7 (option). Détecter les pronoms hors mention : CHECK > NEW
+***********/
+
+package org.txm.macro.urs.democrat
+
+import org.apache.commons.lang.*
+import org.kohsuke.args4j.*
+import groovy.transform.*
+import org.txm.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.analec.*
+import org.txm.searchengine.cqp.*
+import org.txm.searchengine.cqp.corpus.*
+import visuAnalec.Message.*
+import visuAnalec.donnees.*
+import visuAnalec.elements.*
+import visuAnalec.vue.*
+
+// TODO : ajouter les étiquettes équivalentes issues du tagset TreeTagger
+// Ponctuations et Prépositions
+def interditsAuDebut = ["PONfbl", "PONfrt", "PONpxx", "PRE"]
+// Ponctuations
+def interditsALaFin = ["PONfbl", "PONfrt", "PONpxx"]
+// Pronoms en tous genres
+def listePronoms = ["PROadv", "PROcar", "PROdem", "PROimp", "PROind", "PROint", "PROper", "PROpos", "PROrel"]
+
+// CORPS DU SCRIPT
+
+if (!(corpusViewSelection instanceof MainCorpus)) {
+	println "Corpora selection is not a Corpus"
+	return
+}
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="unit_type", usage="Unité", widget="String", required=true, def="MENTION")
+def unit_type
+@Field @Option(name="pos_property_name", usage="Etiquette de morphosyntaxe", widget="String", required=true, def="frpos")
+def pos_property_name
+@Field @Option(name="cat_name", usage="Propriété CATEGORIE", widget="String", required=true, def="CATEGORIE")
+def cat_name
+@Field @Option(name="ref_name", usage="Propriété REF", widget="String", required=true, def="REF")
+def ref_name
+@Field @Option(name="checkPronouns", usage="Vérifier les pronoms oubliés", widget="Boolean", required=true, def="true")
+def checkPronouns
+
+if (!ParametersDialog.open(this)) return
+
+corpus = corpusViewSelection
+CQI = Toolbox.getCqiClient()
+word = corpus.getWordProperty()
+posProperty = corpus.getProperty(pos_property_name)
+if (posProperty == null) {
+	println "Error: CQP corpus does not contains the word property with name=$pos_property_name"
+	return
+}
+
+analecCorpus = AnalecCorpora.getCorpus(corpus.getName())
+vue = AnalecCorpora.getVue(corpus.getName())
+structure = analecCorpus.getStructure()
+
+if (!structure.getUnites().contains(unit_type)) { // check if the structure contains the unit_type units
+	println "Error: corpus structure does not contains unit with name=$unit_type"
+	return
+}
+
+if (!structure.getUniteProperties(unit_type).contains(cat_name)) { 
+	println "Erreur : les unités $unit_type n'ont pas de propriété $cat_name"
+	return
+}
+
+if (!structure.getUniteProperties(unit_type).contains(ref_name)) { 
+	println "Erreur : les unités $unit_type n'ont pas de propriété $ref_name"
+	return
+}
+
+println "Détection des pronoms oubliés : $checkPronouns"
+
+// Reinitialiser la propriété CHECK
+if (!structure.getUniteProperties(unit_type).contains("CHECK")) {
+	analecCorpus.ajouterProp(Unite.class, unit_type, "CHECK")
+} else {
+	println "Nettoyage des anciennes annotations CHECK"
+  	def tmpvalues = new HashSet()
+	tmpvalues.addAll(structure.getValeursProp(Unite.class, unit_type, "CHECK"));
+	for (String val : tmpvalues) {
+		structure.supprimerVal(Unite.class, unit_type, "CHECK", val);
+		//println "suppression de l'étiquette $val"
+	}
+}
+
+structure.ajouterVal(Unite.class, unit_type, "CHECK", "DONE")
+
+	
+
+def nModified = 0
+def nIgnored = 0
+def nDeleted = 0
+def nAdded = 0
+
+def garbageBin = []
+
+def nToks = corpus.getSize()
+def tokenIndex = new int[nToks]
+
+def i = 0
+for (i=0 ; i< nToks ; i++) tokenIndex[i] = 1
+
+errors = new HashMap()
+def units = analecCorpus.getUnites(unit_type)
+units.sort() { a, b -> a.getDeb() <=> b.getDeb() ?: a.getFin() <=> b.getFin() }
+
+// pour les doublons
+def lastUnit = null
+
+for (Unite unit : units) { // process all units
+	def erreur = ""
+	
+	// 1. Catégories vides
+	def cat = unit.getProp( cat_name );
+	if (cat == "") erreur += "CAT "
+	
+	// 2. Référents vides (plus grave) ; pas besoin de catégories
+	def ref = unit.getProp( ref_name );
+	if (ref == "") erreur += "REF "
+	
+	// 3. Suppression des erreurs initiales ; besoin de catégories
+	int[] positions = null
+	if (unit.getDeb() == unit.getFin()) positions = [unit.getDeb()]
+	else positions = (unit.getDeb()..unit.getFin())
+	def Mention = CQI.cpos2Str(posProperty.getQualifiedName(), positions)
+	
+	def isOK = false
+	while (isOK == false) {
+	   if (interditsAuDebut.contains(Mention[0])) {
+	      if (positions.size() == 1) {
+	         erreur += "SUPPR"
+	         isOK = true
+	      } else {
+	         def debut = unit.getDeb()
+	         unit.setDeb(  debut + 1 )
+	         
+	         if (unit.getDeb() == unit.getFin()) positions = [unit.getDeb()]
+			 else positions = (unit.getDeb()..unit.getFin())
+			 Mention = CQI.cpos2Str(posProperty.getQualifiedName(), positions)
+			 if (!erreur.contains("BORNESG")) erreur += "BORNESG "
+	      }
+	   } else { 
+	      isOK = true
+	   } 
+	}
+	
+	
+	// 4. Suppression des erreurs de borne de fin ; besoin de catégories
+	if (unit.getDeb() == unit.getFin()) positions = [unit.getDeb()]
+	else positions = (unit.getDeb()..unit.getFin())
+	Mention = CQI.cpos2Str(posProperty.getQualifiedName(), positions)
+	
+	isOK = false
+	while ((isOK == false) && (erreur != "remove")) {
+		def n = Mention.size()
+		if (interditsALaFin.contains(Mention[ n-1 ])) {
+			if (positions.size() == 1) {
+	         if (!erreur.contains("SUPPR")) erreur += "SUPPR"
+	         isOK = true
+	      } else {
+	         def fin = unit.getFin()
+	         unit.setFin(  fin - 1 )
+	         
+	         if (unit.getDeb() == unit.getFin()) positions = [unit.getDeb()]
+			 else positions = (unit.getDeb()..unit.getFin())
+			 Mention = CQI.cpos2Str(posProperty.getQualifiedName(), positions)
+			 if (!erreur.contains("BORNESD")) erreur += "BORNESD "
+	      }
+		} else isOK = true
+	}
+	
+	// 5. Suppression des unités problématiques (bornes incohérentes ou mot vide) ; pas besoin de catégories
+	def forme = CQI.cpos2Str(word.getQualifiedName(), positions)[0].trim().toLowerCase()
+	
+	if (erreur == "remove") {}
+	else if (unit.getFin() < unit.getDeb()) {
+	   println "ERREUR GRAVE : segmentation incohérente"
+	   erreur = "remove"
+	} else if ( forme.length() == 0 ) {
+	   println "ERREUR GRAVE : unité sans mot"
+	   erreur = "remove"
+	}
+	
+	// 6. Détection des doublons ; pas besoin de catégories
+	if (lastUnit != null) {
+	   if ((unit.getDeb() == lastUnit.getDeb()) && (unit.getFin() == lastUnit.getFin()) ) {
+	   		erreur += " DOUBLON "
+	   }
+	}
+	lastUnit = unit
+	
+	
+	erreur = erreur.trim()
+	if (erreur == "remove") {
+	    garbageBin.add( unit )
+		nDeleted++
+	} else if (erreur != "") {
+		vue.setValeurChamp(unit, "CHECK", erreur)
+		nModified++
+	} else {
+		nIgnored++
+	}
+	
+	// mise à jour des tokens couverts
+	for (int p=unit.getDeb() ; p <= unit.getFin() ; p++) {
+	   tokenIndex[p] = 0
+	}
+}
+
+// Suppression effective des unités incohérentes
+garbageBin.each {
+   analecCorpus.supUnite( it )
+}
+
+// 7. Ajouter les pronoms non couverts par une annotation ; besoin de catégories
+// Parcourir les tokens non couverts ; obtenir leur POS et créer une unité si c'est un pronom
+
+if (checkPronouns) {
+	println "Détection des pronoms oubliés"
+	for (i=0 ; i < nToks ; i++) {
+    	if (tokenIndex[i] > 0) {
+			Mention = CQI.cpos2Str(posProperty.getQualifiedName(), i)
+			if (listePronoms.contains(Mention[0])) {
+	    		def props = [:]
+        		props["CHECK"] = "NEW"
+        		Unite u = analecCorpus.addUniteSaisie(unit_type, i, i, props)
+        		vue.setValeurChamp(u, "CHECK", "NEW")
+	    		nAdded++
+	    	}
+		}
+	}
+}
+
+if (nAdded + nModified + nDeleted > 0) corpus.setIsModified(true);
+
+println "Result:"
+println "- $nModified units of type $unit_type have been modified."
+println "- $nDeleted units of type $unit_type have been deleted."
+println "- $nIgnored units of type $unit_type have not been modified."
+println "- $nAdded forgotten pronominal units of type $unit_type have been added.\n"
+
+AnalecCorpora.getVue(analecCorpus).retablirVueParDefaut()
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/SUJ-PARTINF.txt
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/SUJ-PARTINF.txt	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/SUJ-PARTINF.txt	(revision 2094)
@@ -0,0 +1,19 @@
+Macro  : SUJ-PARTINF
+Auteur : Matthieu QUIGNARD
+Date   : 05 Février 2019
+
+Recatégorise les mentions étiquetées en SUJ.ZERO pour distinguer les cas
+des verbes conjugués (qui restent en SUJ.ZERO) 
+des verbes à l'infinitif ou au participe passé/présent qui, eux, vont
+passer sous la catégorie SUJ.PARTINF
+
+Cette macro est réversible.
+Il suffit d'invoquer la macro ChercherRemplacer et substituer
+CATEGORIE=SUJ.PARTINF
+en 
+CATEGORIE=SUJ.ZERO
+
+NB : fonctionne avec le tagset fro (ancien français) et le tagset TreeTagger.
+Infinitif : VERinf  VER:infi
+Part.Pass : VERppa  VER:pper
+Part.Pres : VERppe   VER:ppre

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/SUJ-PARTINF.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/Verifications_alMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/Verifications_alMacro.groovy	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/Verifications_alMacro.groovy	(revision 2094)
@@ -0,0 +1,260 @@
+// Auteur Matthieu Quignard
+// Date : 14 janvier 2019
+
+/**********
+Vérifications automatiques
+1. Repère les mentions sans catégorie : CHECK > CAT
+2. Repère les mentions sans référent : CHECK > REF
+3. Supprime les ponctuations en début et en fin de mention : CHECK > BORNES
+4. Supprime les prépositions autres que 'de' en début de mention : CHECK > BORNES
+5. Supprime automatiquement toutes les mentions vides = sans aucun mot = de longueur 0
+6. Détecter les mentions qui ont exactement les mêmes bornes  : CHECK > DOUBLON
+7 (option). Détecter les pronoms hors mention : CHECK > NEW
+***********/
+
+package org.txm.macro.urs.democrat
+
+import org.apache.commons.lang.*
+import org.kohsuke.args4j.*
+import groovy.transform.*
+import org.txm.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.analec.*
+import org.txm.searchengine.cqp.*
+import org.txm.searchengine.cqp.corpus.*
+import visuAnalec.Message.*
+import visuAnalec.donnees.*
+import visuAnalec.elements.*
+import visuAnalec.vue.*
+
+// TODO : ajouter les étiquettes équivalentes issues du tagset TreeTagger
+// Ponctuations et Prépositions
+def interditsAuDebut = ["PONfbl", "PONfrt", "PONpxx", "PRE"]
+// Ponctuations
+def interditsALaFin = ["PONfbl", "PONfrt", "PONpxx"]
+// Pronoms en tous genres
+def listePronoms = ["PROadv", "PROcar", "PROdem", "PROind", "PROint", "PROper", "PROpos", "PROrel"]
+// AL: supprimé PROimp (non référentiel) de la liste des pronoms
+
+// CORPS DU SCRIPT
+
+if (!(corpusViewSelection instanceof MainCorpus)) {
+	println "Corpora selection is not a Corpus"
+	return
+}
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="unit_type", usage="Unité", widget="String", required=true, def="MENTION")
+def unit_type
+@Field @Option(name="pos_property_name", usage="Etiquette de morphosyntaxe", widget="String", required=true, def="frpos")
+def pos_property_name
+@Field @Option(name="cat_name", usage="Propriété CATEGORIE", widget="String", required=true, def="CATEGORIE")
+def cat_name
+@Field @Option(name="ref_name", usage="Propriété REF", widget="String", required=true, def="REF")
+def ref_name
+@Field @Option(name="checkPronouns", usage="Vérifier les pronoms oubliés", widget="Boolean", required=true, def="true")
+def checkPronouns
+
+if (!ParametersDialog.open(this)) return
+
+corpus = corpusViewSelection
+CQI = Toolbox.getCqiClient()
+word = corpus.getWordProperty()
+posProperty = corpus.getProperty(pos_property_name)
+if (posProperty == null) {
+	println "Error: CQP corpus does not contain the word property with name=$pos_property_name"
+	return
+}
+
+analecCorpus = AnalecCorpora.getCorpus(corpus.getName())
+vue = AnalecCorpora.getVue(corpus.getName())
+structure = analecCorpus.getStructure()
+
+if (!structure.getUnites().contains(unit_type)) { // check if the structure contains the unit_type units
+	println "Error: corpus structure does not contains unit with name=$unit_type"
+	return
+}
+
+if (!structure.getUniteProperties(unit_type).contains(cat_name)) { 
+	println "Erreur : les unités $unit_type n'ont pas de propriété $cat_name"
+	return
+}
+
+if (!structure.getUniteProperties(unit_type).contains(ref_name)) { 
+	println "Erreur : les unités $unit_type n'ont pas de propriété $ref_name"
+	return
+}
+
+println "Détection des pronoms oubliés : $checkPronouns"
+
+// Reinitialiser la propriété CHECK
+if (!structure.getUniteProperties(unit_type).contains("CHECK")) {
+	analecCorpus.ajouterProp(Unite.class, unit_type, "CHECK")
+} else {
+	println "Nettoyage des anciennes annotations CHECK"
+  	def tmpvalues = new HashSet()
+	tmpvalues.addAll(structure.getValeursProp(Unite.class, unit_type, "CHECK"));
+	for (String val : tmpvalues) {
+		structure.supprimerVal(Unite.class, unit_type, "CHECK", val);
+		//println "suppression de l'étiquette $val"
+	}
+}
+
+structure.ajouterVal(Unite.class, unit_type, "CHECK", "DONE")
+
+	
+
+def nModified = 0
+def nIgnored = 0
+def nDeleted = 0
+def nAdded = 0
+
+def garbageBin = []
+
+def nToks = corpus.getSize()
+def tokenIndex = new int[nToks]
+
+def i = 0
+for (i=0 ; i< nToks ; i++) tokenIndex[i] = 1
+
+errors = new HashMap()
+def units = analecCorpus.getUnites(unit_type)
+units.sort() { a, b -> a.getDeb() <=> b.getDeb() ?: a.getFin() <=> b.getFin() }
+
+// pour les doublons
+def lastUnit = null
+
+for (Unite unit : units) { // process all units
+	def erreur = ""
+	
+	// 1. Catégories vides
+	def cat = unit.getProp( cat_name );
+	if (cat == "") erreur += "CAT "
+	
+	// 2. Référents vides (plus grave) ; pas besoin de catégories
+	def ref = unit.getProp( ref_name );
+	if (ref == "") erreur += "REF "
+	
+	// 3. Suppression des erreurs initiales ; besoin de catégories
+	int[] positions = null
+	if (unit.getDeb() == unit.getFin()) positions = [unit.getDeb()]
+	else positions = (unit.getDeb()..unit.getFin())
+	def Mention = CQI.cpos2Str(posProperty.getQualifiedName(), positions)
+	
+	def isOK = false
+	while (isOK == false) {
+	   if (interditsAuDebut.contains(Mention[0])) {
+	      if (positions.size() == 1) {
+	         erreur += "SUPPR"
+	         isOK = true
+	      } else {
+	         def debut = unit.getDeb()
+	         unit.setDeb(  debut + 1 )
+	         
+	         if (unit.getDeb() == unit.getFin()) positions = [unit.getDeb()]
+			 else positions = (unit.getDeb()..unit.getFin())
+			 Mention = CQI.cpos2Str(posProperty.getQualifiedName(), positions)
+			 if (!erreur.contains("BORNESG")) erreur += "BORNESG "
+	      }
+	   } else { 
+	      isOK = true
+	   } 
+	}
+	
+	
+	// 4. Suppression des erreurs de borne de fin ; besoin de catégories
+	if (unit.getDeb() == unit.getFin()) positions = [unit.getDeb()]
+	else positions = (unit.getDeb()..unit.getFin())
+	Mention = CQI.cpos2Str(posProperty.getQualifiedName(), positions)
+	
+	isOK = false
+	while ((isOK == false) && (erreur != "remove")) {
+		def n = Mention.size()
+		if (interditsALaFin.contains(Mention[ n-1 ])) {
+			if (positions.size() == 1) {
+	         if (!erreur.contains("SUPPR")) erreur += "SUPPR"
+	         isOK = true
+	      } else {
+	         def fin = unit.getFin()
+	         unit.setFin(  fin - 1 )
+	         
+	         if (unit.getDeb() == unit.getFin()) positions = [unit.getDeb()]
+			 else positions = (unit.getDeb()..unit.getFin())
+			 Mention = CQI.cpos2Str(posProperty.getQualifiedName(), positions)
+			 if (!erreur.contains("BORNESD")) erreur += "BORNESD "
+	      }
+		} else isOK = true
+	}
+	
+	// 5. Suppression des unités problématiques (bornes incohérentes ou mot vide) ; pas besoin de catégories
+	def forme = CQI.cpos2Str(word.getQualifiedName(), positions)[0].trim().toLowerCase()
+	
+	if (erreur == "remove") {}
+	else if (unit.getFin() < unit.getDeb()) {
+	   println "ERREUR GRAVE : segmentation incohérente"
+	   erreur = "remove"
+	} else if ( forme.length() == 0 ) {
+	   println "ERREUR GRAVE : unité sans mot"
+	   erreur = "remove"
+	}
+	
+	// 6. Détection des doublons ; pas besoin de catégories
+	if (lastUnit != null) {
+	   if ((unit.getDeb() == lastUnit.getDeb()) && (unit.getFin() == lastUnit.getFin()) ) {
+	   		erreur += " DOUBLON "
+	   }
+	}
+	lastUnit = unit
+	
+	
+	erreur = erreur.trim()
+	if (erreur == "remove") {
+	    garbageBin.add( unit )
+		nDeleted++
+	} else if (erreur != "") {
+		vue.setValeurChamp(unit, "CHECK", erreur)
+		nModified++
+	} else {
+		nIgnored++
+	}
+	
+	// mise à jour des tokens couverts
+	for (int p=unit.getDeb() ; p <= unit.getFin() ; p++) {
+	   tokenIndex[p] = 0
+	}
+}
+
+// Suppression effective des unités incohérentes
+garbageBin.each {
+   analecCorpus.supUnite( it )
+}
+
+// 7. Ajouter les pronoms non couverts par une annotation ; besoin de catégories
+// Parcourir les tokens non couverts ; obtenir leur POS et créer une unité si c'est un pronom
+
+if (checkPronouns) {
+	println "Détection des pronoms oubliés"
+	for (i=0 ; i < nToks ; i++) {
+    	if (tokenIndex[i] > 0) {
+			Mention = CQI.cpos2Str(posProperty.getQualifiedName(), i)
+			mentionForme = CQI.cpos2Str(word.getQualifiedName(), i)
+			if (listePronoms.contains(Mention[0]) && mentionForme[0] != "s'" && mentionForme[0] != "se" && mentionForme[0] != "riens") {
+	    		def props = [:]
+        		props["CHECK"] = "NEW"
+        		Unite u = analecCorpus.addUniteSaisie(unit_type, i, i, props)
+        		vue.setValeurChamp(u, "CHECK", "NEW")
+	    		nAdded++
+	    	}
+		}
+	}
+}
+
+if (nAdded + nModified + nDeleted > 0) corpus.setIsModified(true);
+
+println "Result:"
+println "- $nModified units of type $unit_type have been modified."
+println "- $nDeleted units of type $unit_type have been deleted."
+println "- $nIgnored units of type $unit_type have not been modified."
+println "- $nAdded forgotten pronominal units of type $unit_type have been added.\n"
+
+AnalecCorpora.getVue(analecCorpus).retablirVueParDefaut()
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/Verification.txt
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/Verification.txt	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/Verification.txt	(revision 2094)
@@ -0,0 +1,26 @@
+Macro Verification
+auteur : matthieu quignard
+
+Se lance après l'annotation des mentions en référence et en catégories.
+On a besoin de catégories pour repérer les erreurs de type 1, 3, 4 et 7.
+
+Vérifie les erreurs les plus fréquentes :
+1. Repère les mentions sans catégorie : CHECK > CAT
+2. Repère les mentions sans référent : CHECK > REF
+3. Supprime les ponctuations en début et en fin de mention : CHECK > BORNES
+4. Supprime les prépositions autres que 'de' en début de mention : CHECK > BORNES
+5. Supprime automatiquement toutes les mentions vides = sans aucun mot = de longueur 0
+6. Détecter les mentions qui ont exactement les mêmes bornes  : CHECK > DOUBLON
+7 (option). Détecter les pronoms hors mention : CHECK > NEW
+
+Nécessite de renseigner : 
+- le nom des unités à vérifier (MENTION)
+- le nom de la propriété catégorie à vérifier (CATEGORIE)
+- le nom de la propriété référent à vérifier (REF)
+- le nom du champ qui porte l'étiquette morphosyntaxique (type, pos, frpos, fropos...)
+
+Cocher "checkPronouns" si on veut rajouter les éventuels pronoms oubliés (= hors mention).
+
+Le script ajoute une propriété CHECK en cas d'erreur.
+Cette propriété qui indique quel type d'erreur a été rencontré. 
+NB : il peut y avoir plusieurs erreurs pour une même mention.

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/Verification.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/SUJ-PARTINFMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/SUJ-PARTINFMacro.groovy	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/SUJ-PARTINFMacro.groovy	(revision 2094)
@@ -0,0 +1,102 @@
+package org.txm.macro.urs.democrat
+
+import org.apache.commons.lang.*
+import org.kohsuke.args4j.*
+import groovy.transform.*
+import org.txm.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.analec.*
+import org.txm.searchengine.cqp.*
+import org.txm.searchengine.cqp.corpus.*
+import visuAnalec.Message.*
+import visuAnalec.donnees.*
+import visuAnalec.elements.*
+import visuAnalec.vue.*
+
+/*
+   Retouche les sujets zéros pour les recatégoriser au besoin
+   en SUJ.PARTINF lorsque le verbe est au participe ou à 
+   l'infinitif
+   Auteur : Matthieu QUIGNARD
+   Date : 05 Février 2019
+ */
+
+def listePartInf = ["VER:pper", "VER:ppre", "VER:infi", "VERppe", "VERppa", "VERinf"]
+
+// CORPS DU SCRIPT
+
+if (!(corpusViewSelection instanceof MainCorpus)) {
+	println "Corpora selection is not a Corpus: "+corpusViewSelection
+	return
+}
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="unit_type", usage="", widget="String", required=true, def="MENTION")
+def unit_type
+@Field @Option(name="property_name", usage="", widget="String", required=true, def="CATEGORIE")
+def property_name
+@Field @Option(name="suj_zero_cat", usage="", widget="String", required=true, def="SUJ.ZERO")
+def suj_zero_cat
+@Field @Option(name="pos_property_name", usage="", widget="String", required=true, def="frpos")
+def pos_property_name
+if (!ParametersDialog.open(this)) return
+
+corpus = corpusViewSelection
+CQI = Toolbox.getCqiClient()
+word = corpus.getWordProperty()
+posProperty = corpus.getProperty(pos_property_name)
+if (posProperty == null) {
+	println "Error: CQP corpus does not contains the word property with name=$pos_property_name"
+	return
+}
+analecCorpus = AnalecCorpora.getCorpus(corpus.getName())
+vue = AnalecCorpora.getVue(corpus.getName())
+structure = analecCorpus.getStructure()
+if (!structure.getUnites().contains(unit_type)) { // check if the structure contains the unit_type units
+	println "Erreur : le corpus ne contient d'unité de type $unit_type"
+	println "Script terminé"
+	return
+}
+
+if (!structure.getUniteProperties(unit_type).contains(property_name)) { 
+	println "Erreur : les unités $unit_type n'ont pas de propriété $property_name"
+	println "Script terminé"
+	return
+}
+
+def nModified = 0
+def nIgnored = 0
+
+def units = analecCorpus.getUnites(unit_type)
+units.sort() { a, b -> a.getDeb() <=> b.getDeb() ?: a.getFin() <=> b.getFin() }
+
+for (Unite unit : units) { // process all units
+	def prop = unit.getProp(property_name)
+	
+	if (prop != suj_zero_cat) {
+		// On ne s'intéresse qu'aux SUJ.ZERO
+		// Les autres sont ignorés
+		nIgnored++
+	} else {
+		// Pour les mentions de type "GN.IND", on cherche le premier mot
+		int[] positions = null
+		if (unit.getDeb() == unit.getFin()) positions = [unit.getDeb()]
+		else positions = (unit.getDeb()..unit.getFin())
+	
+		// On récupère le POS du premier mot
+		def tags = CQI.cpos2Str(posProperty.getQualifiedName(), positions)
+		def firstTag = tags[0];
+			
+		if ( listePartInf.contains(firstTag) ) {
+			vue.setValeurChamp(unit, property_name, "SUJ.PARTINF")
+			nModified++
+		} else {
+			// Sinon on laisse tel quel
+			nIgnored++
+		}
+	}
+}
+
+println "Result:"
+println "- $nModified units of type $unit_type have been modified."
+println "- $nIgnored units of type $unit_type have not been modified.\n"
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/AccessibiliteMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/AccessibiliteMacro.groovy	(revision 2093)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/AccessibiliteMacro.groovy	(revision 2094)
@@ -27,7 +27,7 @@
  */
 
 def listeAccessibiliteForte=["PRO.PERA", "PRO.REL", "SUJ.ZERO", "DET.POS"]
-def listeAccessibiliteNulle=["PRO.PERD"]
+def listeAccessibiliteNulle=[]
 
 
 // CORPS DU SCRIPT
Index: tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherRemplacer.txt
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherRemplacer.txt	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherRemplacer.txt	(revision 2094)
@@ -0,0 +1,13 @@
+Macro ChercherRemplacer
+Auteur : Matthieu QUIGNARD
+Version : 05 Février 2019
+
+Retouche la valeur d'une propriété pour la remplacer par une autre.
+Par exemple : CATEGORIE=PRO.CHECK => CATEGORIE=ERREUR
+
+Possibilité d'inclure aussi les mentions dont la valeur initiale est vide.
+Par exemple : CATEGORIE=          => CATEGORIE=ERREUR
+
+NB : on peut utiliser cette macro pour retoucher le nom des référents.
+Exemple : REF=roi de france       => REF=Le Roi de France
+

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherRemplacer.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherSupprimerMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherSupprimerMacro.groovy	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherSupprimerMacro.groovy	(revision 2094)
@@ -0,0 +1,97 @@
+// ChercherSupprimer
+// Auteur Matthieu Quignard
+// Date : 14 janvier 2019
+
+/**********
+Sert à supprimer des mentions qui une valeur particulière attribuée
+Par exemple : CATEGORIE=ERREUR
+ou bien : REF=NON_REF
+ou encore : CHECK=
+
+ATTENTION : CETTE MACRO N'EST PAS REVERSIBLE
+***********/
+
+package org.txm.macroprototypes.urs.misc
+
+import org.apache.commons.lang.*
+import org.kohsuke.args4j.*
+import groovy.transform.*
+import org.txm.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.analec.*
+import org.txm.searchengine.cqp.*
+import org.txm.searchengine.cqp.corpus.*
+import visuAnalec.Message.*
+import visuAnalec.donnees.*
+import visuAnalec.elements.*
+import visuAnalec.vue.*
+
+// CORPS DU SCRIPT
+
+if (!(corpusViewSelection instanceof MainCorpus)) {
+	println "Corpora selection is not a Corpus"
+	return
+}
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="unit_type", usage="Unité", widget="String", required=true, def="MENTION")
+def unit_type
+@Field @Option(name="prop_name", usage="Propriété", widget="String", required=true, def="CATEGORIE")
+def prop_name
+@Field @Option(name="val_cherche", usage="Valeur recherchée", widget="String", required=true, def="")
+def val_cherche
+@Field @Option(name="inclureVides", usage="Inclure les valeurs vides", widget="Boolean", required=true, def="true")
+def inclureVides
+
+if (!ParametersDialog.open(this)) return
+
+corpus = corpusViewSelection
+analecCorpus = AnalecCorpora.getCorpus(corpus.getName())
+vue = AnalecCorpora.getVue(corpus.getName())
+structure = analecCorpus.getStructure()
+
+if (!structure.getUnites().contains(unit_type)) { // check if the structure contains the unit_type units
+	println "Erreur : le corpus ne contient d'unité de type $unit_type"
+	println "Script terminé"
+	return
+}
+
+if (!structure.getUniteProperties(unit_type).contains(prop_name)) { 
+	println "Erreur : les unités $unit_type n'ont pas de propriété $prop_name"
+	println "Script terminé"
+	return
+}
+
+println "Option 'inclure les valeurs vides' : $inclureVides"
+
+def nDeleted = 0
+def nIgnored = 0
+
+def units = analecCorpus.getUnites(unit_type)
+units.sort() { a, b -> a.getDeb() <=> b.getDeb() ?: a.getFin() <=> b.getFin() }
+
+def garbageBin = []
+
+for (Unite unit : units) { // process all units
+    def val = unit.getProp( prop_name )
+    
+    if ( (val == val_cherche) || ( inclureVides && (val == "")) ) {
+    	garbageBin.add( unit )
+    	nDeleted++
+    } else {
+    	nIgnored++
+    }
+}
+
+// Suppression effective des unités ciblées
+garbageBin.each {
+   analecCorpus.supUnite( it )
+}
+
+if (nDeleted > 0) corpus.setIsModified(true);
+
+println "Result:"
+println "- $nDeleted units of type $unit_type have been deleted."
+println "- $nIgnored units of type $unit_type have not been modified."
+
+AnalecCorpora.getVue(analecCorpus).retablirVueParDefaut()
Index: tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherRemplacerMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherRemplacerMacro.groovy	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherRemplacerMacro.groovy	(revision 2094)
@@ -0,0 +1,92 @@
+// ChercherRemplacer
+// Auteur Matthieu Quignard
+// Date : 14 janvier 2019
+
+/**********
+Sert à retoucher une valeur attribuée à une mention et la remplacer par une autre
+Par exemple : CATEGORIE=PRO.CHECK => CATEGORIE=PRO.PER
+ou bien : REF=roi de France => REF=Le Roi de France
+ou encore : REF=      => REF=<EMPTY>
+***********/
+
+package org.txm.macroprototypes.urs.misc
+
+import org.apache.commons.lang.*
+import org.kohsuke.args4j.*
+import groovy.transform.*
+import org.txm.*
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.analec.*
+import org.txm.searchengine.cqp.*
+import org.txm.searchengine.cqp.corpus.*
+import visuAnalec.Message.*
+import visuAnalec.donnees.*
+import visuAnalec.elements.*
+import visuAnalec.vue.*
+
+// CORPS DU SCRIPT
+
+if (!(corpusViewSelection instanceof MainCorpus)) {
+	println "Corpora selection is not a Corpus"
+	return
+}
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="unit_type", usage="Unité", widget="String", required=true, def="MENTION")
+def unit_type
+@Field @Option(name="prop_name", usage="Propriété", widget="String", required=true, def="CATEGORIE")
+def prop_name
+@Field @Option(name="val_cherche", usage="Valeur recherchée", widget="String", required=true, def="")
+def val_cherche
+@Field @Option(name="val_remplace", usage="Valeur de remplacement", widget="String", required=true, def="")
+def val_remplace
+@Field @Option(name="inclureVides", usage="Inclure les valeurs vides", widget="Boolean", required=true, def="true")
+def inclureVides
+
+if (!ParametersDialog.open(this)) return
+
+corpus = corpusViewSelection
+analecCorpus = AnalecCorpora.getCorpus(corpus.getName())
+vue = AnalecCorpora.getVue(corpus.getName())
+structure = analecCorpus.getStructure()
+
+if (!structure.getUnites().contains(unit_type)) { // check if the structure contains the unit_type units
+	println "Erreur : le corpus ne contient d'unité de type $unit_type"
+	println "Script terminé"
+	return
+}
+
+if (!structure.getUniteProperties(unit_type).contains(prop_name)) { 
+	println "Erreur : les unités $unit_type n'ont pas de propriété $prop_name"
+	println "Script terminé"
+	return
+}
+
+println "Option 'inclure les valeurs vides' : $inclureVides"
+
+def nModified = 0
+def nIgnored = 0
+
+def units = analecCorpus.getUnites(unit_type)
+units.sort() { a, b -> a.getDeb() <=> b.getDeb() ?: a.getFin() <=> b.getFin() }
+
+for (Unite unit : units) { // process all units
+    def val = unit.getProp( prop_name )
+    
+    if ( (val == val_cherche) || ( inclureVides && (val == "")) ) {
+    	vue.setValeurChamp(unit, prop_name, val_remplace)
+    	nModified++
+    } else {
+    	nIgnored++
+    }
+}
+
+
+
+if (nModified > 0) corpus.setIsModified(true);
+
+println "Result:"
+println "- $nModified units of type $unit_type have been modified."
+println "- $nIgnored units of type $unit_type have not been modified."
+
+AnalecCorpora.getVue(analecCorpus).retablirVueParDefaut()
Index: tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherSupprimer.txt
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherSupprimer.txt	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherSupprimer.txt	(revision 2094)
@@ -0,0 +1,15 @@
+Macro ChercherSupprimer
+Auteur : Matthieu QUIGNARD
+Version : 05 Février 2019
+
+Supprime de façon **DEFINITIVE** les mentions qui ont une certaine valeur de propriété.
+Comme pour ChercherRemplacer, on peut choisir d'inclure aussi 
+les mentions qui ont une valeur vide pour la propriété donnée.
+
+Par exemple : 
+    CATEGORIE=ERREUR
+    CHECK=
+    REF=NON_REF (suppression des mentions non référentielles)
+    REF=SI (suppression de tous les singletons)
+    
+    
\ No newline at end of file

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/macroprototypes/urs/misc/ChercherSupprimer.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain

