nschneid/amr-hackathon

Python 3?

Closed this issue · 0 comments

I'm trying to use the code in Python 3. This is what I had to add in the preamble:

    import past
    past.autotranslate(["amr"])
    import os
    import importlib.util  # needed for amr.peg
    os.chdir(os.path.dirname(importlib.util.find_spec("src.amr").origin))
    from src import amr

Although it still fails with

TypeError: expected string or bytes-like object

Apparently because parsimonious tries to use match in a Python 2 way which is not compatible with Python 3.

Is there a version of the code to handle AMR data structure which is compatible with Python 3?

It would be best if there is also a version which is compatible with smatch (so I wouldn't have to write it to a string and then read it again with the smatch code), but that's optional :)