From 48207b011cd8958bcdfea06aa4009bbb9984a63f Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Tue, 15 Oct 2019 11:39:08 +0200
Subject: [PATCH] Added config file

---
 UD_any/config        | 1 +
 UD_any/data/Makefile | 3 ++-
 UD_any/train.sh      | 3 ++-
 tools/fplm2fP.py     | 3 +++
 4 files changed, 8 insertions(+), 2 deletions(-)
 create mode 100644 UD_any/config

diff --git a/UD_any/config b/UD_any/config
new file mode 100644
index 0000000..3930e60
--- /dev/null
+++ b/UD_any/config
@@ -0,0 +1 @@
+UD_ROOT=~/Downloads/ud/ud-treebanks-all/
diff --git a/UD_any/data/Makefile b/UD_any/data/Makefile
index 574ebf8..dbd64f5 100644
--- a/UD_any/data/Makefile
+++ b/UD_any/data/Makefile
@@ -1,5 +1,6 @@
+include ../config
+
 TOOLS=../../tools
-UD_ROOT=~/Downloads/ud/ud-treebanks-all/
 CONLL2TXT=$(TOOLS)/conll2text.py
 MCD=conllu.mcd
 
diff --git a/UD_any/train.sh b/UD_any/train.sh
index de8f519..dc9b25b 100755
--- a/UD_any/train.sh
+++ b/UD_any/train.sh
@@ -1,5 +1,7 @@
 #! /bin/bash
 
+source config
+
 function has_space {
   [[ "$1" != "${1%[[:space:]]*}" ]] && return 0 || return 1
 }
@@ -11,7 +13,6 @@ function print_usage_and_exit {
 
 LANG=UD_any
 LANGPATH=$MACAON_DIR/$LANG
-UD_ROOT=~/Downloads/ud/ud-treebanks-all/
 MCD=$LANGPATH/data/conllu.mcd
 KEYWORD=$1
 TEMPLATENAME=$2
diff --git a/tools/fplm2fP.py b/tools/fplm2fP.py
index 5a2c12e..e83a851 100755
--- a/tools/fplm2fP.py
+++ b/tools/fplm2fP.py
@@ -22,8 +22,11 @@ form2pos = {}
 int2form = {}
 pos2int = {}
 int2pos = {}
+
 while(len(line) != 4) :
   line = getLineAsList(fplm)
+  if len(line) == 0 :
+    exit(1)
 
 while(len(line) == 4) :
   form = line[0].strip()
-- 
GitLab