Index: tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/UDPipeJavaUtils.java
===================================================================
--- tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/UDPipeJavaUtils.java	(revision 3263)
+++ tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/UDPipeJavaUtils.java	(revision 3264)
@@ -13,6 +13,7 @@
 import cz.cuni.mff.ufal.udpipe.OutputFormat;
 import cz.cuni.mff.ufal.udpipe.Sentence;
 import cz.cuni.mff.ufal.udpipe.Sentences;
+import cz.cuni.mff.ufal.udpipe.Version;
 import cz.cuni.mff.ufal.udpipe.Word;
 import cz.cuni.mff.ufal.udpipe.Words;
 
@@ -38,8 +39,10 @@
 		
 		for (int iSentence = 0; iSentence < sentences.size(); iSentence++) {
 			Sentence sent = sentences.get(iSentence);
+			
+			model.parse(sent, "");
 			model.tag(sent, "");
-			model.parse(sent, "");
+//			System.out.println(toString(sent));
 		}
 		
 		return sentences;
@@ -123,14 +126,25 @@
 	}
 	
 	public static void main(String[] args) {
-		try {
-			toConnluFile(new File("/tmp/result.connlu"), new File("/home/mdecorde/SOFTWARE/udpipe-1.2.0-bin/bin-linux64/french-gsd-ud-2.4-190531.udpipe"),
-					"Et un petit test... En deux phrases ? ou trois.");
+//		try {
+//			toConnluFile(new File("/tmp/result.connlu"), new File("/home/mdecorde/SOFTWARE/udpipe-1.2.0-bin/bin-linux64/french-gsd-ud-2.4-190531.udpipe"),
+//					"Et un petit test... En deux phrases ? ou trois.");
+//		}
+//		catch (UnsupportedEncodingException | FileNotFoundException e) {
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+		UDPipeEngine.initializeUDLib(new File("/home/mdecorde/workspace047/org.txm.libs.udpipe"));
+		System.out.println("VERSION: "+Version.current().toString());
+		// /usr/lib/UDPipe/models/fr.udpipe
+		// /home/mdecorde/SOFTWARE/udpipe-1.2.0-bin/bin-linux64/french-gsd-ud-2.4-190531.udpipe
+		for (String p : new String[] {"/home/mdecorde/SOFTWARE/udpipe-1.2.0-bin/bin-linux64/french-gsd-ud-2.4-190531.udpipe",
+				"/home/mdecorde/SOFTWARE/udpipe-1.2.0-bin/bin-linux64/french-partut-ud-2.4-190531.udpipe",
+				"/home/mdecorde/SOFTWARE/udpipe-1.2.0-bin/bin-linux64/french-sequoia-ud-2.4-190531.udpipe",
+				"/home/mdecorde/SOFTWARE/udpipe-1.2.0-bin/bin-linux64/french-spoken-ud-2.4-190531.udpipe"}) {
+			System.out.println("M="+p);
+		process(p, "Et un petit test... En deux phrases ? ou trois.");
 		}
-		catch (UnsupportedEncodingException | FileNotFoundException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
 	}
 	
 	public static void processSentences(String modelPath, Sentences sentences) {
@@ -138,11 +152,13 @@
 	}
 	
 	public static void processSentences(Model model, Sentences sentences) {
-		System.out.println("Model: " + model);
+		//System.out.println("Processing sent ("+sentences.size()+") with model: " + model);
 		for (int iSentence = 0; iSentence < sentences.size(); iSentence++) {
 			Sentence sent = sentences.get(iSentence);
-			System.out.println(sent.getWords().size());
-			// model.tag(sent, "");
+			
+			model.tag(sent, "");
+			model.parse(sent, "");
+			//System.out.println(toString(sent));
 		}
 	}
 	
@@ -155,6 +171,7 @@
 	 */
 	public static HashMap<String, String> wordToHashMap(Word word, String prefix) {
 		if (prefix == null) prefix = "";
+		
 		HashMap<String, String> properties = new HashMap<>();
 		properties.put(prefix + "id", Integer.toString(word.getId()));
 		properties.put(prefix + "form", word.getForm());
@@ -166,6 +183,7 @@
 		properties.put(prefix + "deprel", word.getDeprel());
 		properties.put(prefix + "deps", word.getDeps());
 		properties.put(prefix + "misc", word.getMisc());
-		return null;
+		
+		return properties;
 	}
 }
Index: tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/UDStringTokenizer.java
===================================================================
--- tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/UDStringTokenizer.java	(revision 3263)
+++ tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/UDStringTokenizer.java	(revision 3264)
@@ -18,6 +18,7 @@
 	
 	protected InputFormat tokenizer;
 	
+	
 	public UDStringTokenizer(String lang) {
 		File modelsDirectory = new File(UDPipePreferences.getInstance().getString(UDPipePreferences.MODELS_PATH)); // default models directory is set in the Toolbox
 		File modelFile = new File(modelsDirectory, lang + ".udpipe");
@@ -29,20 +30,32 @@
 	}
 	
 	@Override
-	public List<String> processText(String text) {
-		ArrayList<String> result = new ArrayList<>();
+	public List<List<String>> processText(String text) {
+		ArrayList<List<String>> result = new ArrayList<>();
 		
+		
 		tokenizer.setText(text);
 		Sentence sent = new Sentence();
 		while (tokenizer.nextSentence(sent)) {
+			List<String> sresult = new ArrayList<>();
 			Words words = sent.getWords();
 			for (int iWord = 0; iWord < words.size(); iWord++) {
-				result.add(words.get(iWord).getForm());
+				sresult.add(words.get(iWord).getForm());
 			}
+			if (sresult.size() > 0) {
+				sresult.remove(0); // remove the <root> element
+			}
+			if (sresult.size() > 0) {
+				result.add(sresult);
+			}
 		}
-		if (result.size() > 0) {
-			result.remove(0); // remove the <root> element
-		}
+		
 		return result;
 	}
+
+	@Override
+	public boolean doSentences() {
+		
+		return true;
+	}
 }
Index: tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/UDPipeEngine.java
===================================================================
--- tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/UDPipeEngine.java	(revision 3263)
+++ tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/UDPipeEngine.java	(revision 3264)
@@ -20,6 +20,8 @@
 import org.txm.utils.logger.Log;
 import org.txm.xml.xmltxm.XMLTXMWordPropertiesInjection;
 
+import cz.cuni.mff.ufal.udpipe.InputFormat;
+import cz.cuni.mff.ufal.udpipe.Model;
 import cz.cuni.mff.ufal.udpipe.Sentence;
 import cz.cuni.mff.ufal.udpipe.Sentences;
 import cz.cuni.mff.ufal.udpipe.Version;
@@ -45,16 +47,7 @@
 		Bundle bundle = BundleUtils.getBundle("org.txm.libs.udpipe");
 		File bundleDir = BundleUtils.getBundleFile("org.txm.libs.udpipe");
 		if (bundleDir.isDirectory()) {
-			if (OSDetector.isFamilyWindows()) {
-				libFile = new File(bundleDir, "lib/libudpipe_java.dll");
-			}
-			else if (OSDetector.isFamilyMac()) {
-				libFile = new File(bundleDir, "lib/libudpipe_java.dylib");
-			}
-			else if (OSDetector.isFamilyUnix()) {
-				libFile = new File(bundleDir, "lib/libudpipe_java.so");
-			}
-			udpipe_java.setLibraryPath(libFile.getAbsolutePath());
+			libFile = initializeUDLib(bundleDir);
 		}
 		else {
 			URL entry = bundle.getEntry("lib/libudpipe_java.so");
@@ -64,6 +57,21 @@
 		return getDetails() != null;
 	}
 	
+	public static File initializeUDLib(File bundleDir) {
+		File libFile;
+		if (OSDetector.isFamilyWindows()) {
+			libFile = new File(bundleDir, "lib/libudpipe_java.dll");
+		}
+		else if (OSDetector.isFamilyMac()) {
+			libFile = new File(bundleDir, "lib/libudpipe_java.dylib");
+		}
+		else {
+			libFile = new File(bundleDir, "lib/libudpipe_java.so");
+		}
+		udpipe_java.setLibraryPath(libFile.getAbsolutePath());
+		return libFile;
+	}
+	
 	@Override
 	public StringTokenizer getStringTokenizer(String lang) throws Exception {
 		return new UDStringTokenizer(lang);
@@ -150,6 +158,7 @@
 		
 		File modelsDirectory = new File(UDPipePreferences.getInstance().getString(UDPipePreferences.MODELS_PATH)); // default models directory is set in the Toolbox
 		File modelFile = new File(modelsDirectory, lang + ".udpipe");
+		//System.out.println("model="+modelFile.getAbsolutePath());
 		
 		try {
 			// get words
@@ -160,6 +169,7 @@
 			}
 			
 			Sentences sentences = wparser.getSentences();
+						
 			// System.out.println("SENTENCES PARSED: " + UDPipeJavaUtils.toString(sentences));
 			// tag
 			UDPipeJavaUtils.processSentences(modelFile.getAbsolutePath(), sentences);
@@ -168,6 +178,7 @@
 			
 			// update XML-TXM files
 			XMLTXMWordPropertiesInjection injector = new XMLTXMWordPropertiesInjection(xmlFile);
+			HashMap<String, HashMap<String, String>> rules = new HashMap<>();
 			for (int iSentence = 0; iSentence < sentences.size(); iSentence++) {
 				Sentence sentence = sentences.get(iSentence);
 				Words words = sentence.getWords();
@@ -181,11 +192,14 @@
 					int idx2 = misc.indexOf("|", idx + 6);
 					if (idx2 < 0) idx2 = misc.length();
 					String id = misc.substring(idx + 6, idx2);
-					HashMap<String, String> properties = UDPipeJavaUtils.wordToHashMap(word, "ud-");
-					injector.addProperty(id, properties);
+					if (id != null && id.length() > 0) {
+						HashMap<String, String> properties = UDPipeJavaUtils.wordToHashMap(word, "#ud-");
+						rules.put(id, properties);
+					}
 				}
 			}
 			File outFile = new File(binaryCorpusDirectory, xmlFile.getName() + ".tmp");
+			injector.setProperties(rules);
 			if (injector.process(outFile) && outFile.exists()) {
 				xmlFile.delete();
 				outFile.renameTo(xmlFile);
Index: tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/XMLTXMToUDPipeXMLParser.java
===================================================================
--- tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/XMLTXMToUDPipeXMLParser.java	(revision 3263)
+++ tmp/org.txm.udpipe.core/src/org/txm/udpipe/core/XMLTXMToUDPipeXMLParser.java	(revision 3264)
@@ -72,6 +72,8 @@
 	private Sentences sentences;
 	
 	private Sentence sentence;
+
+	private int nSentenceTagFound = 0;
 	
 	/**
 	 * Instantiates a new builds the tt src.
@@ -112,9 +114,20 @@
 		String form = ""; // the content of the form tag
 		String lastopenlocalname = "";
 		String localname = "";
+		boolean inS = false;
 		try {
 			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
 				switch (event) {
+					case XMLStreamConstants.PROCESSING_INSTRUCTION:
+						//System.out.println("PI target="+parser.getPITarget()+" data="+parser.getPIData());
+						if (!inS && "txm".equals(parser.getPITarget()) && "</s>".equals(parser.getPIData())) {
+							if (sentence != null && sentence.getWords().size() > 0) {
+								sentences.add(sentence);
+							}
+							sentence = new Sentence();
+							nSentenceTagFound ++;
+						}
+						break;
 					case XMLStreamConstants.START_ELEMENT:
 						localname = parser.getLocalName();
 						
@@ -144,6 +157,8 @@
 									sentences.add(sentence);
 								}
 								sentence = new Sentence();
+								nSentenceTagFound ++;
+								inS = true;
 								break;
 						}
 						break;
@@ -166,6 +181,7 @@
 								break;
 							
 							case "s":
+								inS = false;
 								break;
 						}
 						break;
@@ -194,6 +210,10 @@
 		return true;
 	}
 	
+	public int getNSentenceTagFound() {
+		return nSentenceTagFound;
+	}
+	
 	/**
 	 * The main method.
 	 *
Index: tmp/org.txm.tokenizer.core/src/org/txm/tokenizer/SimpleStringTokenizer.groovy
===================================================================
--- tmp/org.txm.tokenizer.core/src/org/txm/tokenizer/SimpleStringTokenizer.groovy	(revision 3263)
+++ tmp/org.txm.tokenizer.core/src/org/txm/tokenizer/SimpleStringTokenizer.groovy	(revision 3264)
@@ -77,6 +77,10 @@
 		this(new TokenizerClasses(lang))
 	}
 	
+	public boolean doSentences() {
+		return false;
+	}
+	
 	/**
 	 * Instantiates a new simple string tokenizer.
 	 *
@@ -133,17 +137,19 @@
 	/**
 	 * Process word.
 	 */
-	public ArrayList<String> processText(String text) {
-		ArrayList<String> result = new ArrayList<String>();
+	public ArrayList<ArrayList<String>> processText(String text) {
+		ArrayList<ArrayList<String>> result = new ArrayList<String>()
+		ArrayList<String> sresult = new ArrayList<String>()
 		if (regSplitWhiteSpaces != null) {
 			for (String s : regSplitWhiteSpaces.split(text)) {		// separate with unicode white spaces
 				// if (DEBUG){println "process $s"}
-				result.addAll(iterate(s));
+				sresult.addAll(iterate(s));
 			}
 		}
 		else {
-			result.addAll(iterate(text));
+			sresult.addAll(iterate(text));
 		}
+		result.add(sresult)
 		return result;
 	}
 	
Index: tmp/org.txm.tokenizer.core/src/org/txm/tokenizer/StringTokenizer.java
===================================================================
--- tmp/org.txm.tokenizer.core/src/org/txm/tokenizer/StringTokenizer.java	(revision 3263)
+++ tmp/org.txm.tokenizer.core/src/org/txm/tokenizer/StringTokenizer.java	(revision 3264)
@@ -4,5 +4,7 @@
 
 public interface StringTokenizer {
 	
-	List<String> processText(String text);
+	List<List<String>> processText(String text);
+	
+	boolean doSentences();
 }
