From bdd9d5bb60fb1975a49dd097a2f7bc98d5106e9d Mon Sep 17 00:00:00 2001 From: Mateusz Klimaszewski <mk.klimaszewski@gmail.com> Date: Tue, 29 Dec 2020 14:50:13 +0100 Subject: [PATCH] Fix mapping and path. --- combo/data/api.py | 4 ++++ scripts/train.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/combo/data/api.py b/combo/data/api.py index 10a3a72..ca8f75a 100644 --- a/combo/data/api.py +++ b/combo/data/api.py @@ -50,6 +50,10 @@ def sentence2conllu(sentence: Sentence, keep_semrel: bool = True) -> conllu.Toke for t in tokens: if type(t["id"]) == list: t["id"] = tuple(t["id"]) + if t["deps"]: + for dep in t["deps"]: + if type(dep[1]) == list: + dep[1] = tuple(dep[1]) return _TokenList(tokens=tokens, metadata=sentence.metadata) diff --git a/scripts/train.py b/scripts/train.py index 7ca0fce..9390888 100644 --- a/scripts/train.py +++ b/scripts/train.py @@ -135,7 +135,7 @@ def run(_): embeddings_dir = FLAGS.embeddings_dir embeddings_file = None if embeddings_dir: - embeddings_dir = embeddings_dir / language + embeddings_dir = pathlib.Path(embeddings_dir) / language embeddings_file = [f for f in embeddings_dir.iterdir() if "vectors" in f.name and ".vec.gz" in f.name] assert len(embeddings_file) == 1, f"Couldn't find embeddings file." embeddings_file = embeddings_file[0] -- GitLab