connl2009 output for kres

per-file
voje 5 years ago
parent 825f67a054
commit b3a39d74ef

@ -301,7 +301,7 @@ class Msdmap():
category = pos[2] category = pos[2]
attr = [self.pos_val_map(category, 1, m) attr = [self.pos_val_map(category, 1, m)
for m in msd[1:] if m != "-"] for m in msd[1:] if m != "-"]
return pos, attr return (pos, attr)
if __name__ == "__main__": if __name__ == "__main__":

File diff suppressed because it is too large Load Diff

@ -122,30 +122,35 @@ def to_conll09(sentence_entry):
for token in sentence_entry["tokens"]: for token in sentence_entry["tokens"]:
if token[0] != "w": if token[0] != "w":
continue continue
t_id = token[1]
msd = msdm.msd_from_slo(token[4]) msd = msdm.msd_from_slo(token[4])
fprd = fillpred("todo", "todo") fprd = fillpred("TODO", "todo")
"""
print(t_id)
print("msd:")
print(msd) print(msd)
print(token) print(token)
print(sentence_entry["links"]) print(sentence_entry["links"])
t_id = token[1] """
print(t_id)
# 1 3 4 5 6 7 8 9 10 11 12 13 14 # 1 3 4 5 6 7 8 9 10 11 12 13 14
out_str += "{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n".format( out_str += "{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n".format(
t_id, # id t_id, # id
token[2], # form token[2], # form
token[3], # lemma token[3], # lemma
token[3], # plemma token[3], # plemma
"todo", # pos (TODO) msd[0][3], # pos
"todo", # ppos (TODO) msd[0][3], # ppos
"todo", # feat (TODO) "|".join([msd[0][2]] + [el[4] for el in msd[1]]), # feat
"todo", # pfeat (TODO) "|".join([msd[0][2]] + [el[4] for el in msd[1]]), # pfeat
sentence_entry["links"][t_id][2], # head sentence_entry["links"][t_id][2], # head
sentence_entry["links"][t_id][2], # phead sentence_entry["links"][t_id][2], # phead
sentence_entry["links"][t_id][1], # deprel sentence_entry["links"][t_id][0], # deprel
sentence_entry["links"][t_id][1], # pdeprel sentence_entry["links"][t_id][0], # pdeprel
fprd, # fillpred fprd, # fillpred
(token[3] if fprd == "Y" else "_"), # pred (token[3] if fprd == "Y" else "_"), # pred
"todo" # apredn...
) )
out_str += "\n" out_str += "\n"
print(out_str)
return out_str return out_str

Loading…
Cancel
Save