You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Text classification code described in "SoPa: Bridging CNNs, RNNs, and Weighted Finite-State Machines" by Roy Schwartz, Sam Thomson and Noah A. Smith, ACL 2018
The code is implemented in python3.6 using pytorch. To run, we recommend using conda. The following code creates a new conda environment and activates it:
./install.sh
source activate sopa
Data format
The training and test code requires a two files for training, development and test: a data file and a labels file.
Both files contain one line per sample. The data file contains the text, and the labels file contain the label.
In addition, a word vector file is required (plain text, standard format of one line per vector, starting with the word, followed by the vector).
For other paramteres, run the following commands using the --help flag.
The data/ folder contains sample files for training, development and testing.
The data comes from the SST dataset (with a 100 training samples).
Each fold X (train, dev, test) contains two file: X.data (plain text sentences, one sentence per line) and X.labels (one label per line).
Visualizing the Model
Under construction.
Sanity Tests
python -m unittest
References
If you make use if this code, please cite the following paper:
@inproceedings{Schwartz:2018,
author={Schwartz, Roy and Thomson, Sam and Smith, Noah A.},
title={{SoPa}: Bridging {CNNs}, {RNNs}, and Weighted Finite-State Machines},
booktitle={Proc. of ACL},
year={2018}
}
Text classification code described in "SoPa: Bridging CNNs, RNNs, and Weighted Finite-State Machines" by Roy Schwartz, Sam Thomson and Noah A. Smith, ACL 2018