All Projects → malllabiisc → Wordgcn

malllabiisc / Wordgcn

Licence: apache-2.0
ACL 2019: Incorporating Syntactic and Semantic Information in Word Embeddings using Graph Convolutional Networks

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Wordgcn

Machine Learning Notebooks
Machine Learning notebooks for refreshing concepts.
Stars: ✭ 222 (-3.48%)
Mutual labels:  natural-language-processing, deep-learning-tutorial
Kadot
Kadot, the unsupervised natural language processing library.
Stars: ✭ 108 (-53.04%)
Mutual labels:  natural-language-processing, word-embeddings
Textblob Ar
Arabic support for textblob
Stars: ✭ 60 (-73.91%)
Mutual labels:  natural-language-processing, word-embeddings
Text2vec
Fast vectorization, topic modeling, distances and GloVe word embeddings in R.
Stars: ✭ 715 (+210.87%)
Mutual labels:  natural-language-processing, word-embeddings
Gensim
Topic Modelling for Humans
Stars: ✭ 12,763 (+5449.13%)
Mutual labels:  natural-language-processing, word-embeddings
Syntree2vec
An algorithm to augment syntactic hierarchy into word embeddings
Stars: ✭ 9 (-96.09%)
Mutual labels:  natural-language-processing, word-embeddings
Easy Bert
A Dead Simple BERT API for Python and Java (https://github.com/google-research/bert)
Stars: ✭ 106 (-53.91%)
Mutual labels:  natural-language-processing, word-embeddings
Biosentvec
BioWordVec & BioSentVec: pre-trained embeddings for biomedical words and sentences
Stars: ✭ 308 (+33.91%)
Mutual labels:  natural-language-processing, word-embeddings
Scattertext
Beautiful visualizations of how language differs among document types.
Stars: ✭ 1,722 (+648.7%)
Mutual labels:  natural-language-processing, word-embeddings
Flair
A very simple framework for state-of-the-art Natural Language Processing (NLP)
Stars: ✭ 11,065 (+4710.87%)
Mutual labels:  natural-language-processing, word-embeddings
Nlp Notebooks
A collection of notebooks for Natural Language Processing from NLP Town
Stars: ✭ 513 (+123.04%)
Mutual labels:  natural-language-processing, word-embeddings
Vec4ir
Word Embeddings for Information Retrieval
Stars: ✭ 188 (-18.26%)
Mutual labels:  natural-language-processing, word-embeddings
Bert Embedding
🔡 Token level embeddings from BERT model on mxnet and gluonnlp
Stars: ✭ 424 (+84.35%)
Mutual labels:  natural-language-processing, word-embeddings
Coursera Natural Language Processing Specialization
Programming assignments from all courses in the Coursera Natural Language Processing Specialization offered by deeplearning.ai.
Stars: ✭ 39 (-83.04%)
Mutual labels:  natural-language-processing, word-embeddings
Chakin
Simple downloader for pre-trained word vectors
Stars: ✭ 323 (+40.43%)
Mutual labels:  natural-language-processing, word-embeddings
Magnitude
A fast, efficient universal vector embedding utility package.
Stars: ✭ 1,394 (+506.09%)
Mutual labels:  natural-language-processing, word-embeddings
Pytorch Sentiment Analysis
Tutorials on getting started with PyTorch and TorchText for sentiment analysis.
Stars: ✭ 3,209 (+1295.22%)
Mutual labels:  natural-language-processing, word-embeddings
Adaptnlp
An easy to use Natural Language Processing library and framework for predicting, training, fine-tuning, and serving up state-of-the-art NLP models.
Stars: ✭ 278 (+20.87%)
Mutual labels:  natural-language-processing, deep-learning-tutorial
Danlp
DaNLP is a repository for Natural Language Processing resources for the Danish Language.
Stars: ✭ 111 (-51.74%)
Mutual labels:  natural-language-processing, word-embeddings
Dive Into Dl Pytorch
本项目将《动手学深度学习》(Dive into Deep Learning)原书中的MXNet实现改为PyTorch实现。
Stars: ✭ 14,234 (+6088.7%)
Mutual labels:  natural-language-processing, deep-learning-tutorial

WordGCN

Incorporating Syntactic and Semantic Information in Word Embeddings using Graph Convolutional Networks

Overview of WordGCN

...

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.

Dependencies

  • Compatible with TensorFlow 1.x and Python 3.x.
  • Dependencies can be installed using requirements.txt.
    • pip3 install -r requirements.txt
  • Install word-embedding-benchmarks used for evaluating learned embeddings.
    • The test and valid dataset splits used in the paper can be downloaded from this link. Replace the original ~/web_data folder with the provided one.
    • For switching between valid and test split execute python switch_evaluation_data.py -split <valid/valid>

Dataset:

  • We used Wikipedia corpus. The processed version can be downloaded from here or using the script below:

    pip install gdown
    gdown --id 1iFpuKFpDnXCD9QpUw8wStG3ndKl7-KwX -O data.zip
    unzip data.zip
    rm data.zip
    
  • The processed dataset includes:

    • voc2id.txt mapping of words to to their unique identifiers.

    • id2freq.txt contains frequency of words in the corpus.

    • de2id.txt mapping of dependency relations to their unique identifiers.

    • data.txt contains the entire Wikipedia corpus with each sentence of corpus stored in the following format:

      <num_words> <num_dep_rels> tok1 tok2 tok3 ... tokn dep_e1 dep_e2 .... dep_em
      
      • Here, num_words is the number of words and num_dep_rels denotes the number of dependency relations in the sentence.
      • 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.

Training SynGCN embeddings:

  • Download the processed Wikipedia corpus (link) and extract it in ./data directory.
  • Execute make to compile the C++ code for creating batches.
  • To start training run:
    python syngcn.py -name test_embeddings -gpu 0 -dump 
                     -maxsentlen <max_sentence_length in your data.txt> 
                     -maxdeplen <max_dependency_length in your data.txt> 
                     -embed_dim 300
    
  • The trained embeddings will be stored in ./embeddings directory with the provided name test_embeddings .
  • Note: As reported in TensorFlow issue #13048. The current SynGCN's TF-based implementation is slow compared to Mikolov's word2vec implementation. For training SynGCN on a very large corpus might require multi-GPU or C++ based implementation.

Fine-tuning embedding using SemGCN:

...

  • Pre-trained 300-dimensional SynGCN embeddings can be downloaded from here.
  • For incorporating semantic information in given embeddings run:
    python semgcn.py -embed ./embeddings/pretrained_embed.txt 
                     -semantic synonyms -embed_dim 300 
                     -name fine_tuned_embeddings -dump -gpu 0
    
  • The fine-tuned embeddings will be saved in ./embeddings directory with name fine_tuned_embeddings.

Extrinsic Evaluation:

For extrinsic evaluation of embeddings the models from the following papers were used:

Citation:

Please cite the following paper if you use this code in your work.

@inproceedings{wordgcn2019,
    title = "Incorporating Syntactic and Semantic Information in Word Embeddings using Graph Convolutional Networks",
    author = "Vashishth, Shikhar  and
      Bhandari, Manik  and
      Yadav, Prateek  and
      Rai, Piyush  and
      Bhattacharyya, Chiranjib  and
      Talukdar, Partha",
    booktitle = "Proceedings of the 57th Conference of the Association for Computational Linguistics",
    month = jul,
    year = "2019",
    address = "Florence, Italy",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/P19-1320",
    pages = "3308--3318"
}

For any clarification, comments, or suggestions please create an issue or contact Shikhar.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].