Browse Source

added msd-not-found exception

master
voje 2 years ago
parent
commit
406e88ade8
  1. 4
      dockerfiles/python-java/Makefile
  2. 3
      tools/parse_all.py
  3. 6
      tools/parser/msd/msdmap.py
  4. 2
      tools/tools.cfg

4
dockerfiles/python-java/Makefile

@ -8,12 +8,12 @@ build:
run:
docker run \
-it \
-it \
-v /home/${USER}:/home/${USER} \
--user $(shell id -u):$(shell id -g) \
-v /etc/passwd:/etc/passwd \
-v /etc/group:/etc/group \
-v $(shell pwd)/../../:/cjvt-srl-tagging \
-v $(shell pwd)/../../:/cjvt-srl-tagging \
-w /cjvt-srl-tagging \
-v /home/kristjan/kres_mount:/kres_mount:ro \
python-java \

3
tools/parse_all.py

@ -53,8 +53,9 @@ def handle_file(infile):
kres_out_str = ""
for _, sentence in res_dict.items():
kres_out_str += par.to_conll_2009_SRL(sentence)
except:
except Exception as exc:
logging.info("Failed processing file: {}".format(str(kres_file)))
logging.error(exc)
return False

6
tools/parser/msd/msdmap.py

@ -35,7 +35,11 @@ class Msdmap:
def slo_msd_to_eng_long(self, slo_msd):
# old, slow
# return (self.msd_table[self.msd_table["slo_msd"] == slo_msd]["eng_long"]).values[0]
return self.msd_table.query("slo_msd == '{}'".format(slo_msd))["eng_long"].values[0]
# return self.msd_table.query("slo_msd == '{}'".format(slo_msd))["eng_long"].values[0]
query = self.msd_table.query("slo_msd == '{}'".format(slo_msd))
if query.empty:
return "No-matching-msd-found"
return query["eng_long"].values[0]
def slo_msd_to_eng_pos(self, slo_msd):
# first letter in slo_msd == slo_pos

2
tools/tools.cfg

@ -1,5 +1,5 @@
[tools]
kres_orig = /kres_mount/kres_parsed/tei
kres_orig = ../data/kres_example
kres_tsv = ../data/kres_out/1_tsv
kres_srl = ../data/kres_out/2_srl
kres_json = ../data/kres_out/final_json

Loading…
Cancel
Save