diff --git a/UD_any/data/getActionSets.py b/UD_any/data/getActionSets.py index 57666e825d81b4a5ef32e8c1e9fcf0d8877f7d32..5e7be2adfb8b5e51a37c30720ac5ae962e5f3bb1 100755 --- a/UD_any/data/getActionSets.py +++ b/UD_any/data/getActionSets.py @@ -57,12 +57,17 @@ if __name__ == "__main__" : elif nameCol == "LABEL" : output = open("parser.as", 'w', encoding='utf-8') print("REDUCE", file=output) + labels = set() for line in open(colFile, "r", encoding='utf-8') : striped = line.strip() if len(striped) == 0 or striped == "root" or striped == "_" : continue - print("LEFT " + striped, file=output) - print("RIGHT " + striped, file=output) + label = striped.split(':')[0] + if label not in labels : + labels.add(striped) + for label in labels : + print("LEFT " + label, file=output) + print("RIGHT " + label, file=output) print("EOS", file=output) print("Default : SHIFT", file=output) output.close()