From d9248687b933960e4889c13657d09f1f54330910 Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Mon, 15 Jun 2020 17:03:51 +0200
Subject: [PATCH] updated pretrainEmbeddings script

---
 UD_any/data/pretrainEmbeddings.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/UD_any/data/pretrainEmbeddings.py b/UD_any/data/pretrainEmbeddings.py
index 3817567..7e1d9f1 100755
--- a/UD_any/data/pretrainEmbeddings.py
+++ b/UD_any/data/pretrainEmbeddings.py
@@ -18,10 +18,15 @@ if __name__ == "__main__" :
   splited = os.path.splitext(pathToFile)
   target = sys.argv[3]
 
-  if which("word2vec") is None or which("udpipe") is None :
+  if which("word2vec") is None :
+    print("word2vec not installed")
     exit(0)
 
-  p = subprocess.Popen("udpipe --output=horizontal none %s > in.text && rm in.text"%pathToFile, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+  if which("udpipe") is None :
+    print("udpipe not installed")
+    exit(0)
+
+  p = subprocess.Popen("udpipe --output=horizontal none %s > in.text"%pathToFile, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
   p.wait()
 
   args = [
@@ -38,6 +43,7 @@ if __name__ == "__main__" :
     "-min-count 2",
     "-train in.text",
     "-output %s"%target,
+    "&& rm in.text"
   ]
 
   p = subprocess.Popen(" ".join(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
-- 
GitLab