{"id":21169759,"url":"https://github.com/andreasgrv/johnny","last_synced_at":"2025-07-09T19:32:02.154Z","repository":{"id":53535326,"uuid":"94341054","full_name":"andreasgrv/johnny","owner":"andreasgrv","description":"johnny - a neural network graph based DEPendency Parser","archived":false,"fork":false,"pushed_at":"2021-03-25T21:43:49.000Z","size":158,"stargazers_count":10,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-08-02T14:41:57.528Z","etag":null,"topics":["chainer","dependency-parsing","nlp","nlp-machine-learning","parsing","subword"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreasgrv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-14T14:39:10.000Z","updated_at":"2023-08-02T14:41:57.529Z","dependencies_parsed_at":"2022-09-09T09:50:36.884Z","dependency_job_id":null,"html_url":"https://github.com/andreasgrv/johnny","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasgrv%2Fjohnny","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasgrv%2Fjohnny/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasgrv%2Fjohnny/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreasgrv%2Fjohnny/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreasgrv","download_url":"https://codeload.github.com/andreasgrv/johnny/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225587808,"owners_count":17492632,"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":["chainer","dependency-parsing","nlp","nlp-machine-learning","parsing","subword"],"created_at":"2024-11-20T15:53:37.438Z","updated_at":"2024-11-20T15:53:38.150Z","avatar_url":"https://github.com/andreasgrv.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [![Build Status](https://api.travis-ci.org/andreasgrv/johnny.svg?branch=master)](https://travis-ci.org/andreasgrv/johnny) Johnny - DEPendency Parser\n\nFor a web visualisation for English and Greek see [here](http://johnny.overfit.xyz).\n\n### What is johnny?\n\nThis is an implementation of a graph based arc factored neural dependency parser implemented using [Chainer](https://chainer.org/). Note that the version of chainer used is v3.5.0 and cupy v2.5.0 if you want to train using a gpu (see requirements.txt).\nThere are 3 encoders that can be used with this parser.\n\n* [Word-BILSTM](blueprints/word-level.yaml),\na Bidirectional LSTM encoder that encodes words.\n* [Char-BILSTM](blueprints/lstm-char-level.yaml),\na Bidirectional LSTM encoder that encodes words on the character level.\n* [Char-CNN](blueprints/cnn-char-level.yaml), a Convolutional Neural network encoder that encodes words on the character level.\n\nThe implementation is based on the papers that can be found in the References section.\n\n### Installation\n\n``` bash\ngit clone https://github.com/andreasgrv/johnny\ncd johnny\n# virtualenv .env \u0026\u0026 source .env/bin/activate # optional but recommended\npip install -r requirements.txt\npip install .\n```\n\n### Training\n\nWhile the basic library was tested for on Debian: python2.7, python3.4, python3.5,\nthe train and test utility scripts will only work on **python \u003e= 3.3**.\n\nModels for dependency parsing can be trained on the\n[Universal Dependencies v2.0](http://universaldependencies.org/) dataset using\nthe **train.py** script.\n\nDownload and extract the contents to a folder of your choosing (we will refer\nto this as *UD_FOLDER*, the path to the folder containing the languages).\nThis will probably look something like \"ud-treebanks-v2.0\".\n\nTo train models you can use the default blueprints I used, similar to the ones\nused in my dissertation (For blueprints that use part of speech tags as input\nyou need to checkout v0.0.1). Alternatively, if you are in for a thrill, you can override the settings to see\nwhat happens. The blueprints can be found under the blueprints folder.\n\nAs an example, to train a parser using the Char-BILSTM encoder on the Universal Dependencies\nv2.0 dataset, you can follow this snippet:\n\n``` bash\nmkdir models # you can use a different folder if you like\npython train.py -i UD_FOLDER -o models --verbose --name mytest \\\n\t\t\t\t--load_blueprint blueprints/cnn-char-level.yaml\n\t\t\t\t--dataset.lang Russian # Unsurprisingly, English is the default\n```\n\nThis will write 3 files to a directory under the models folder. The directory depends\non the name of the dataset used. The 3 files should be:\n\n1. mytest.bp (a blueprint file)   # mytest is whatever you passed to --name\n2. mytest.vocab (a vocabulary file)\n3. mytest.model (the numpy matrices of the chainer model)\n\nYou can override the defaults specified in the blueprint on the\nfly from the command line using . notation. See [mlconf](https://github.com/andreasgrv/mlconf)\nfor details on how this works.\n\nNote that the above may take quite a few hours to train on cpu (To use the gpu version use *--gpu_id 0*,\nassuming gpu is the 0 device. See [here](https://docs.chainer.org/en/stable/tutorial/gpu.html) for\nmore advice on using gpus with chainer.). If you want to train for less time you can also specify\n*--max_epochs* or make the *--checkpoint.patience* parameter smaller.\n\n### Testing\n\nIn order to test a model, you need to provide the **test.py** script with the\nblueprint written during training (mytest.bp if you followed the previous step).\n\nYou can test the model on the development set by providing the path to the dev\n.conllu file after the --test_file option. If you want to evaluate on the\ntest set you need to first download it from the Universal Dependencies\n[website](http://universaldependencies.org/). Make sure you provide\nthe test file for the right language :)\n\n``` bash\npython test.py --blueprint models/conll2017_v2_0/russian/mytest.bp --test_file PATH_TO_CONLLU\n```\n\n### Terminal Visualisation\n\nBelow is a hacky terminal visualisation of the parser predictions during training on the\n[Universal Dependencies](http://universaldependencies.org/) dataset.\n\nThe white box in the Cur index row shows what word we are currently looking at in the sentence.\nThe number to the side is the index in the sentence - which reaches up to sentence length.\nThe number in |absolute value| is the distance of the real head from the current index.\n\nFor each word in the sentence the parser chooses one word to be its governor - head, to\nwhich it draws an arc to.\nThis is represented by the white box in the row labelled Pred head - the height of which\nroughly corresponds to the predicted probability (Can only represent few levels with a unicode box\n:) ).\n\nIt then labels the predicted arc with the relationship\nthe two words are predicted to have as can be seen in the row labelled Pred label.\n\nThe Real head and Real label rows show which word is the correct head and label for the\ntraining data - namely what the parser should have predicted.\n\n![A visualisation of the parser running in the terminal](http://grv.overfit.xyz/static/images/parser.gif)\n\nTo enable the above visualisation during training you can specify the *--visualise* option.\n\n\n### License\n\n3 clause BSD, see LICENSE.txt file\n\n### References\n\n#### Code\n\n[https://github.com/elikip/bist-parser](https://github.com/elikip/bist-parser)\n\n[https://github.com/XingxingZhang/dense_parser](https://github.com/XingxingZhang/dense_parser)\n\n#### Papers\n\n[Simple and Accurate Dependency Parsing Using Bidirectional LSTM Feature Representations](https://arxiv.org/abs/1603.04351)\n\n[Dependency Parsing as Head Selection](https://arxiv.org/abs/1606.01280)\n\n[Finding Function in Form: Compositional Character Models for Open Vocabulary Word Representation](https://arxiv.org/abs/1508.02096)\n\n[Character-Aware Neural Language Models](https://arxiv.org/abs/1508.06615)\n\n[From Characters to Words to in Between: Do We Capture Morphology?](https://arxiv.org/abs/1704.08352)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreasgrv%2Fjohnny","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreasgrv%2Fjohnny","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreasgrv%2Fjohnny/lists"}