Révision 3320

TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/cqp/CQPUtils.groovy (revision 3320)
150 150
	
151 151
}
152 152

  
153
def positionsList2positions(positionsList, maxMatches, pretty) {
154
	
155
	def res = ""
156

  
157
	if (positionsList.size() == 0) {
158
		return "<empty>"
159
	} else {
160
		def first = 1
161
		positionsList.take(maxMatches).each {
162
			if (first) { first = 0 } else {
163
				if (pretty) {
164
					res += ", "
165
				} else {
166
					res += ","
167
				}
168
			}
169
			// res += "["
170
			start = it[0]
171
			end = it[1]
172
			if (start < end) {
173
				res += start+"-"+end
174
			} else {
175
				res += start
176
			}
177
			// res += "]"
178
		}
179
	}
180

  
181
	if (positionsList.size() > maxMatches) {
182
		res += "..."
183
	}
184
	
185
	return res
186
}
187

  
153 188
def corpus2positions(def corpus, def maxMatches, def pretty = false) {
154 189
	
155 190
	def res = ""

Formats disponibles : Unified diff