From 901b4ab2ba0af1ee3e8e9d55bf40fc92be986171 Mon Sep 17 00:00:00 2001 From: Franck Dary <franck.dary@lis-lab.fr> Date: Thu, 27 Feb 2020 17:40:29 +0100 Subject: [PATCH] Made the transitionsSet generation script to output expected state name --- UD_any/data/Makefile | 1 + UD_any/data/getTransitionSets.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/UD_any/data/Makefile b/UD_any/data/Makefile index 9fb308c..0216349 100644 --- a/UD_any/data/Makefile +++ b/UD_any/data/Makefile @@ -36,6 +36,7 @@ columns: all_no_test.conllu $(MCD) cat all_no_test.conllu | sed '/^#/ d' | cut -f$$number | sort --unique > col_$$number.txt ; \ done ./getTransitionSets.py $(MCD) col_*\.txt + cat tagger.ts parser.ts > taggerparser.ts texts: ./getRawText.py $(CONLL2TXT) $(TRAIN_FILES) $(DEV_FILEs) $(TEST_FILES) diff --git a/UD_any/data/getTransitionSets.py b/UD_any/data/getTransitionSets.py index 1ee4d74..7a98d7c 100755 --- a/UD_any/data/getTransitionSets.py +++ b/UD_any/data/getTransitionSets.py @@ -31,7 +31,7 @@ if __name__ == "__main__" : striped = line.strip() if len(striped) == 0 : continue - print("WRITE b.0 UPOS " + striped, file=output) + print("<tagger> WRITE b.0 UPOS " + striped, file=output) output.close() elif nameCol == "XPOS" : @@ -90,7 +90,7 @@ if __name__ == "__main__" : print("SHIFT", file=output) output.close() output = open("parser.ts", 'w', encoding='utf-8') - print("REDUCE", file=output) + print("<parser> REDUCE", file=output) labels = set() labelsList = [] for line in open(colFile, "r", encoding='utf-8') : @@ -103,8 +103,9 @@ if __name__ == "__main__" : labelsList.append(striped) labelsList.sort() for label in labelsList : - print("LEFT " + label, file=output) - print("RIGHT " + label, file=output) - print("SHIFT", file=output) + print("<parser> LEFT " + label, file=output) + print("<parser> RIGHT " + label, file=output) + print("<parser> EOS", file=output) + print("<parser> SHIFT", file=output) output.close() -- GitLab