Skip to content

shagunsodhani/CNN-Sentence-Classifier

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
app
 
 
 
 
 
 
 
 
 
 

CNN-Sentence-Classifier

Simplified implementation of "Convolutional Neural Networks for Sentence Classification" paper DOI

Usage

  • Install Keras
  • Repository contains "Movie reviews with one sentence per review" (Pang and Lee, 2005) dataset in sample_dataset.
  • Alternatively, to use some other dataset, make two files
    • input.txt where each line is a sentence to be classified
    • label.txt where each line is the label for corresponding line in input.txt
  • Make model folder by running mkdir model
  • Refer this to train or download Glove embeddings and this for Word2Vec embeddings.
  • Run python3 app/train.py --data_dir=path_to_folder_containing_input.txt_and_label.txt --embedding_file_path=path_to_embedding_vectors_file --model_name=name_of_model_from_the_paper
  • For example, if data is in data folder, embedding file is vectors.txt and model is cnn_static, run python3 app/train.py --data_dir=data --embedding_file_path=vectors.txt --model_name=cnn_static
  • To define your own model, pass model_name as self, define your model in app/model/model.py and invoke from model_selector function (in model.py).
  • All supported arguments can be seen in here

References

About

Implementation of "Convolutional Neural Networks for Sentence Classification" paper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages