cfmrp / mtool

Software to Manipulate Different Flavors of Semantic Graphs
http://mrp.nlpl.eu
GNU Lesser General Public License v3.0
51 stars 24 forks source link

mtool enters an infinite loop when converting from mrp to ucca #86

Closed lovodkin93 closed 3 years ago

lovodkin93 commented 3 years ago

Hello, I am working on a project involving an conversion between mrp files representing ucca graphs and xml files. I am trying to run the conversion script (python3 main.py --read mrp --write ucca /path/to/mrp_file /path/to/xml_file), and it appears the script enters an inifinite loop around the while loop in while loop. I have tried to understand its origin, but in vain. has anyone ever encountered such a problem? I have also attached the mrp file in question (in json mode). prediction_ucca_eng_424.json.tar.gz

thanks!

danielhers commented 3 years ago

Hi Aviv, this would happen if there is a cycle in the graph, I think. An easy way to avoid it is to only do these two lines if it is not already in id_to_unit: https://github.com/cfmrp/mtool/blob/4cee3a2590d4ec7648408cede05adfaeccc0c698/codec/ucca.py#L174-L175

lovodkin93 commented 3 years ago

I figured it occurs due to a cycle in the graph, but I couldn't understand how to avoid it. Great, I will give it a go! p.s by "it is not already in id_to_unit", you refer to child_unit, right?

danielhers commented 3 years ago

Yes.