{"id":13535511,"url":"https://github.com/malllabiisc/WordGCN","last_synced_at":"2025-04-02T01:31:00.962Z","repository":{"id":35188757,"uuid":"187145335","full_name":"malllabiisc/WordGCN","owner":"malllabiisc","description":"ACL 2019: Incorporating Syntactic and Semantic Information in Word Embeddings using Graph Convolutional Networks","archived":false,"fork":false,"pushed_at":"2023-03-24T23:07:25.000Z","size":5314,"stargazers_count":290,"open_issues_count":4,"forks_count":64,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-02T23:32:55.572Z","etag":null,"topics":["acl2019","deep-learning-tutorial","gcn","graph-convolutional-networks","natural-language-processing","tensorflow","word-embeddings"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/malllabiisc.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-17T04:15:25.000Z","updated_at":"2024-10-08T06:49:31.000Z","dependencies_parsed_at":"2024-11-02T23:31:37.192Z","dependency_job_id":"ea8f92d4-2e0a-434f-87d0-2fffdef2ab57","html_url":"https://github.com/malllabiisc/WordGCN","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/malllabiisc%2FWordGCN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malllabiisc%2FWordGCN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malllabiisc%2FWordGCN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malllabiisc%2FWordGCN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/malllabiisc","download_url":"https://codeload.github.com/malllabiisc/WordGCN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246738501,"owners_count":20825790,"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":["acl2019","deep-learning-tutorial","gcn","graph-convolutional-networks","natural-language-processing","tensorflow","word-embeddings"],"created_at":"2024-08-01T08:00:57.532Z","updated_at":"2025-04-02T01:31:00.102Z","avatar_url":"https://github.com/malllabiisc.png","language":"Python","funding_links":[],"categories":["Word Embedding:"],"sub_categories":[],"readme":"\n\u003ch1 align=\"center\"\u003e\n  WordGCN\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003eIncorporating Syntactic and Semantic Information in Word Embeddings using Graph Convolutional Networks \u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.aclweb.org/anthology/P19-1320/\"\u003e\u003cimg src=\"http://img.shields.io/badge/ACL-2019-4b44ce.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://arxiv.org/abs/1809.04283\"\u003e\u003cimg src=\"http://img.shields.io/badge/Paper-PDF-red.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://shikhar-vashishth.github.io/assets/pdf/wordgcn_supp.pdf\"\u003e\u003cimg src=\"http://img.shields.io/badge/Supplementary-PDF-B31B1B.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://shikhar-vashishth.github.io/assets/pdf/wordgcn_poster.pdf\"\u003e\u003cimg src=\"http://img.shields.io/badge/Poster-PDF-orange.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/malllabiisc/WordGCN/blob/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch2 align=\"center\"\u003e\n  Overview of WordGCN\n\u003c/h2\u003e\n\n\u003ch4 align=\"center\"\u003e\n \u003cimg align=\"center\"  src=\"./images/syngcn_model.png\" alt=\"...\"\u003e\n\u003c/h4\u003e\n\n*Overview of SynGCN: SynGCN employs Graph Convolution Network for utilizing dependency context for learning word embeddings. For each word in vocabulary, the model learns its representation by aiming to predict each word based on its dependency context encoded using GCNs. Please refer Section 5 of the paper for more details.*\n\n### Dependencies\n\n- Compatible with TensorFlow 1.x and Python 3.x.\n- Dependencies can be installed using `requirements.txt`.\n  - `pip3 install -r requirements.txt`\n- Install [word-embedding-benchmarks](https://github.com/kudkudak/word-embeddings-benchmarks) used for evaluating learned embeddings.\n  - The test and valid dataset splits used in the paper can be downloaded from [this link](https://drive.google.com/open?id=1VMyddIOgmkskAFN2BvI6c49Y63SHjNfF). Replace the original `~/web_data` folder with the provided one.  \n  - For switching between valid and test split execute `python switch_evaluation_data.py -split \u003cvalid/valid\u003e`\n\n### Dataset:\n\n* We used [Wikipedia corpus](https://dumps.wikimedia.org/enwiki/20180301/). The processed version can be downloaded from [here](https://drive.google.com/file/d/1iFpuKFpDnXCD9QpUw8wStG3ndKl7-KwX/view?usp=sharing)  or using the script below:\n\n  ```shell\n  pip install gdown\n  gdown --id 1iFpuKFpDnXCD9QpUw8wStG3ndKl7-KwX -O data.zip\n  unzip data.zip\n  rm data.zip\n  ```\n\n* The processed dataset includes:\n  * `voc2id.txt` mapping of words to to their unique identifiers.\n  * `id2freq.txt` contains frequency of words in the corpus.\n  * `de2id.txt` mapping of dependency relations to their unique identifiers. \n  * `data.txt` contains the entire Wikipedia corpus with each sentence of corpus stored in the following format:\n\n    ```java\n    \u003cnum_words\u003e \u003cnum_dep_rels\u003e tok1 tok2 tok3 ... tokn dep_e1 dep_e2 .... dep_em\n    ```\n\n    - Here, `num_words` is the number of words and `num_dep_rels`  denotes the number of dependency relations in the sentence.\n    - `tok_1, tok_2 ...` is the list of tokens in the sentence and `dep_e1, dep_e2 ...`is the list of dependency relations where each is of form `source_token|destination_token|dep_rel_label`.\n\n### Training SynGCN embeddings:\n- Download the processed Wikipedia corpus ([link](https://drive.google.com/file/d/1iFpuKFpDnXCD9QpUw8wStG3ndKl7-KwX/view?usp=sharing)) and extract it in `./data` directory.\n- Execute `make` to compile the C++ code for creating batches.\n- To start training run:\n  ```shell\n  python syngcn.py -name test_embeddings -gpu 0 -dump \n                   -maxsentlen \u003cmax_sentence_length in your data.txt\u003e \n                   -maxdeplen \u003cmax_dependency_length in your data.txt\u003e \n                   -embed_dim 300\n  ```\n\n* The trained embeddings will be stored in `./embeddings` directory with the provided name `test_embeddings` .\n* **Note:** As reported in TensorFlow issue [#13048](https://github.com/tensorflow/tensorflow/issues/13048). The current SynGCN's TF-based implementation is slow compared to [Mikolov's word2vec](https://github.com/tmikolov/word2vec) implementation. For training SynGCN on a very large corpus might require multi-GPU or C++ based implementation.\n\n### Fine-tuning embedding using SemGCN:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg align=\"center\" src=\"https://github.com/malllabiisc/WordGCN/blob/master/images/semgcn_model.png\" alt=\"...\"\u003e\n\u003c/p\u003e\n\n- Pre-trained 300-dimensional `SynGCN` embeddings can be downloaded from [here](https://drive.google.com/file/d/1wYgdyjIBC6nIC-bX29kByA0GwnUSR9Hh/view?usp=sharing). \n- For incorporating semantic information in given embeddings run:\n  ```shell\n  python semgcn.py -embed ./embeddings/pretrained_embed.txt \n                   -semantic synonyms -embed_dim 300 \n                   -name fine_tuned_embeddings -dump -gpu 0\n  ```\n* The fine-tuned embeddings will be saved in `./embeddings` directory with name `fine_tuned_embeddings`. \n\n### Extrinsic Evaluation:\n\nFor extrinsic evaluation of embeddings the models from the following papers were used:\n\n* NCR (Neural Co-reference Resolution): [Higher-order Coreference Resolution with Coarse-to-fine Inference](https://github.com/kentonl/e2e-coref).\n* NER (Named Entity Recognition): [NeuroNER: an easy-to-use program for named-entity recognition based on neural networks](https://github.com/Franck-Dernoncourt/NeuroNER).\n* POS (Part-of-speech tagging): [BiLSTM-CNN-CRF architecture for sequence tagging](https://github.com/UKPLab/emnlp2017-bilstm-cnn-crf).\n* SQuAD (Question Answering): [Simple and Effective Multi-Paragraph Reading Comprehension](https://github.com/allenai/document-qa/tree/master/docqa/elmo)\n\n### Citation:\nPlease cite the following paper if you use this code in your work.\n\n```bibtex\n@inproceedings{wordgcn2019,\n    title = \"Incorporating Syntactic and Semantic Information in Word Embeddings using Graph Convolutional Networks\",\n    author = \"Vashishth, Shikhar  and\n      Bhandari, Manik  and\n      Yadav, Prateek  and\n      Rai, Piyush  and\n      Bhattacharyya, Chiranjib  and\n      Talukdar, Partha\",\n    booktitle = \"Proceedings of the 57th Conference of the Association for Computational Linguistics\",\n    month = jul,\n    year = \"2019\",\n    address = \"Florence, Italy\",\n    publisher = \"Association for Computational Linguistics\",\n    url = \"https://www.aclweb.org/anthology/P19-1320\",\n    pages = \"3308--3318\"\n}\n```\nFor any clarification, comments, or suggestions please create an issue or contact [Shikhar](http://shikhar-vashishth.github.io).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalllabiisc%2FWordGCN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmalllabiisc%2FWordGCN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalllabiisc%2FWordGCN/lists"}