Cartus / AMR-Parser

Better Transition-Based AMR Parsing with a Refined Search Space (authors' DyNet implementation for the EMNLP18 paper)
https://aclweb.org/anthology/papers/D/D18/D18-1198/
MIT License
10 stars 0 forks source link

data/align.sh fails #1

Closed ButteredGroove closed 5 years ago

ButteredGroove commented 5 years ago

I managed to get past the JAMR alignment step.

However, when I run ./align.sh I get:

<snip>
Two edges to one child node
Two edges to one child node
Two edges to one child node
Traceback (most recent call last):
  File "preprocess/extract_pairs.py", line 10, in <module>
    with open(sent, 'w') as sent_file, open(graph, 'w') as node_file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/jovyan/AMR-Parser-master/data/unsupervised_align/eval/graph.txt'
<snip>

I fixed this issue by making the eval directory myself: mkdir -p unsupervised_align/eval

However, then I ran into these issues when I ran ./align.sh:

<snip>
Two edges to one child node
Two edges to one child node
Two edges to one child node
./align.sh: line 24: ./run.sh: No such file or directory
Traceback (most recent call last):
  File "preprocess/extract_align.py", line 10, in <module>
    with open(input) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'unsupervised_align/AMR_Aligned.keep'
Traceback (most recent call last):
  File "preprocess/convert_format.py", line 7, in <module>
    with open(ul_input) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'aligned.txt'
Traceback (most recent call last):
  File "preprocess/rearrange_align.py", line 471, in <module>
    with open(input) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'aligned_jamr.txt'
Traceback (most recent call last):
  File "preprocess/entity_align.py", line 632, in <module>
    with open(input) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'aligned_ra.txt'
Traceback (most recent call last):
  File "preprocess/merge_file.py", line 9, in <module>
    with open(hybrid_input) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'aligned_en.txt'
Traceback (most recent call last):
  File "preprocess/prune.py", line 7, in <module>
    with open(hybrid_input) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'hybrid.txt'
Traceback (most recent call last):
  File "preprocess/align2conll.py", line 1, in <module>
    import nltk
ImportError: No module named 'nltk'
Exception in thread "main" java.io.FileNotFoundException: train.txt (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at BasicFileReader.readFile(BasicFileReader.java:30)
        at ConllFileIO.readConllFile(ConllFileIO.java:21)
        at AMROracleRunner.main(AMROracleRunner.java:129)
Traceback (most recent call last):
  File "preprocess/align2conll.py", line 1, in <module>
    import nltk
ImportError: No module named 'nltk'
Exception in thread "main" java.io.FileNotFoundException: dev.txt (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at BasicFileReader.readFile(BasicFileReader.java:30)
        at ConllFileIO.readConllFile(ConllFileIO.java:21)
        at AMROracleRunner.main(AMROracleRunner.java:129)
Traceback (most recent call last):
  File "preprocess/align2conll.py", line 1, in <module>
    import nltk
ImportError: No module named 'nltk'
Exception in thread "main" java.io.FileNotFoundException: test.txt (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at BasicFileReader.readFile(BasicFileReader.java:30)
        at ConllFileIO.readConllFile(ConllFileIO.java:21)
        at AMROracleRunner.main(AMROracleRunner.java:129)

There are a couple of issues here:

  1. There is no file called unsupervised_align/run.sh
  2. nltk needs to be installed in python

The second point is easy enough to fix (I did pip install nltk), but not documented in the README.md. :)

The first point I'm not sure about. My guess is it has something to do with MGIZA++, which generates a run.sh in the install directory. Unfortunately, AMR-Parser's README.md isn't specific regarding what to name the install folder for MGIZA++. I tried installing it in the mgiza subdirectory without success. I installed MGIZA++ thusly:

cd mgiza-master/mgizapp
cmake . -DCMAKE_INSTALL_PREFIX=/home/jovyan/AMR-Parser-master/data/mgiza
make
make install

I haven't been able to find any reference to mgiza in the .sh nor .py scripts in data. But align.sh must want to do something with it.

What am I missing? Please help!

Another small correction: In the README.md the example arguments passed to train.py are train.pb.lemmas instead of train.txt.pb.lemmas.

ButteredGroove commented 5 years ago

Another thought. Is the repo missing the unsupervised alignment code? The README.md says:

The code of unsupervised aligning is adapted from this repository.

However, data/unsupervised_align is empty.

Cartus commented 5 years ago

Thank you so much for telling me about this issue.

Yes, you are right. I just find out this repository does not include all the code and it is not the latest version. The sad thing is my computer collapsed last week and I lost some of the codes.

I will fix this issue in these two weeks since I need to rewrite some of the codes. I am so sorry for the inconvenience caused.

ButteredGroove commented 5 years ago

You're welcome. I'm sorry to hear about your computer, and I hope you restore it quickly.

No apologies necessary. I'm happy to help. I'll try it out when you make your update.

ButteredGroove commented 5 years ago

Hi Cartus, Hope all is well. How goes the update? Let me know if I can do anything to help.

Cartus commented 5 years ago

Thanks for asking. Currently, I am rushing to meet the EMNLP deadline. I will continue fixing these bugs after the ddl. Sorry again. I will let you know as soon as I finish the update.

Cartus commented 5 years ago

Hi Cartus, Hope all is well. How goes the update? Let me know if I can do anything to help.

Hi, I have updated the repo. I guess it can be run now.