{"id":13675627,"url":"https://github.com/Cartus/AMR-Parser","last_synced_at":"2025-04-28T23:31:05.023Z","repository":{"id":101045074,"uuid":"158050922","full_name":"Cartus/AMR-Parser","owner":"Cartus","description":"Better Transition-Based AMR Parsing with a Refined Search Space (authors' DyNet implementation for the EMNLP18 paper)","archived":false,"fork":false,"pushed_at":"2019-06-13T13:38:13.000Z","size":6707,"stargazers_count":10,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-03T12:15:50.098Z","etag":null,"topics":["aligner","amr-parser","nlp","semantic-parsing","transition-based-parser"],"latest_commit_sha":null,"homepage":"https://aclweb.org/anthology/papers/D/D18/D18-1198/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cartus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-11-18T04:49:57.000Z","updated_at":"2024-03-09T02:13:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"876860a3-84ab-4655-a8ae-34cd045705d7","html_url":"https://github.com/Cartus/AMR-Parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cartus%2FAMR-Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cartus%2FAMR-Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cartus%2FAMR-Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cartus%2FAMR-Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cartus","download_url":"https://codeload.github.com/Cartus/AMR-Parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224137184,"owners_count":17261964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aligner","amr-parser","nlp","semantic-parsing","transition-based-parser"],"created_at":"2024-08-02T12:00:50.699Z","updated_at":"2024-11-11T16:30:47.819Z","avatar_url":"https://github.com/Cartus.png","language":"Python","readme":"# Better Transition-Based AMR Parsing with a Refined Search Space\n\n[DyNet](https://github.com/clab/dynet) implementation of the transition-based AMR parser. We provide the code for aligner and the parser. You can find all the details in the following paper:\n\n- [ Better Transition-Based AMR Parsing with a Refined Search Space](http://www.statnlp.org/research/sp/zhijiang18emnlp.pdf). (Zhijiang Guo and Wei Lu. EMNLP 2018)\n\nSee below for an example for this transition-based AMR parser:\n\n![Parsing Example](fig/example.png \"Parsing Example\")\n\n## Requirements\n\nIn order to train the parser, you will need to have the following installed:\n\n- Python 3.5.2\n- [DyNet 2.0](https://github.com/clab/dynet)\n- [JAMR](https://github.com/jflanigan/jamr)\n- [MGIZA++](https://github.com/moses-smt/mgiza)\n- [NLTK](https://www.nltk.org/)\n\nNotice that we do not support DyNet version higher than 2.0.\n\n### MGIZA++ Installation (Ubuntu)\n\n- Preparation:\n```\nsudo apt-get install cmake\nsudo apt-get install libboost-all-dev\n```\n\n- Installing: clone the AMR-Parser first, then put the MGIZA++ inside the data folder\n```\ncd data\ngit clone https://github.com/moses-smt/mgiza.git\ncd mgiza/mgizapp\ncmake .\nmake\nmake install\n```\n\n### NLTK Tagger Installation\n\n- Installing (under the python3 environment):\n```\nimport nltk\nnltk.download('averaged_perceptron_tagger')\nnltk.download('wordnet')\n```\n\n## Usage \n\n### Hybrid Aligner\nGet the AMR corpus (LDC2014T12/LDC2015E86/LDC2017T10). We can't distribute them because them paid. Put the train/dev/test folder of the corresponding AMR corpus (under the split folder) to the folder /data/amr/data/amrs/split. Then we run the preprocess script. \n\n- For LDC2014T12 corpus, run the bash script:\n```\n./preprocess_14.sh\n```\n\n- For LDC2015E86, run the bash script:\n```\n./preprocess_15.sh\n```\n\n- For LDC2017T10 corpus, run the bash script:\n```\n./preprocess_17.sh\n```\n\nAftering running the script, you can find preprocessed AMR files under the amr/tmp_amr folder, which contains train, dev and test three folders. Before using our Hybrid Aligner, we need the output files of [JAMR Aligner](https://github.com/jflanigan/jamr). \n\nYou can get the aligned train file simply by using the JAMR aligner:\n```\n. scripts/config.sh\nscripts/ALIGN.sh \u003c amr.txt \u003e train.txt\n```\n\nThen we put three aligned files into one folder called jamr_ouput inside the data folder. Then you can run the bash script of the Hybrid Aligner to get the transition sequences for training the AMR parser:\n\n```\n./align.sh\n```\n\nFinally, we get four new files: train.transtions, dev.transitions, test.transitions and train.txt.pb.lemmas. train.txt.pb.lemmas is the look-up table for predicate and lemma concept (look at the paper for more details.)\n\n### AMR Parser\nNow we are ready for train our own AMR parser.\n#### Train a new AMR parser\n```\npython3 train.py\n```\n\nLink to the word vectors that we used in the ACL 2015 paper for English: [sskip.100.vectors](https://drive.google.com/file/d/0B8nESzOdPhLsdWF2S1Ayb1RkTXc/view?usp=sharing). The training process should be stopped when the development SMATCH score does not substantially improve anymore (around epoch 14-16).\n\n#### Parsing with a trained parser\n\nIf you want to use a pretrained parser, just put the pretrain model under the result folder. Then run the script (here we use the pretrained model for the AMR2014 corpus as an example):\n```\npython3 train.py --load_model 1 --model result/pretrain14.model --dev_file data/test.transitions --gold_AMR_dev data/amr/tmp_amr/test/amr.txt \n```\n\nPretrained models can be downloaded:\n- [pretrain14.model](https://drive.google.com/open?id=1yZZfb7ba4o8Xx5bjozbUXABKszvVlrOd): Parser trained on AMR2014 corpus.\n- [pretrain15.model](https://drive.google.com/open?id=15B94w28AWsFE3Wx9ZfiuNxbK7phqP6O_): Parser trained on AMR2015 corpus.\n\n### Related Repo\nThe code of the unsupervised aligning is adapted from this [repository](https://github.com/melanietosik/string-to-amr-alignment).\n\n### Citation\n\nIf you make use of this software, please cite the following:\n\n    @InProceedings{D18-1198,\n    author = \"Guo, Zhijiang and Lu, Wei\",\n    title = \"Better Transition-Based AMR Parsing with a Refined Search Space\",\n    booktitle = \"Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing\",\n    year = \"2018\"\n    }\n","funding_links":[],"categories":["Papers and Models","Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCartus%2FAMR-Parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCartus%2FAMR-Parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCartus%2FAMR-Parser/lists"}