fastNLP/reproduction/LSTM+self_attention_sentiment_analysis
FengZiYjun 27e9453d19 * fix processor.py
* add code comments
* merge *_saver.py & *_loader.py in io/
* (ancient codes) rename Loss into LossFromTorch
2018-12-06 19:28:27 +08:00
..
config.cfg add self_attention for yelp classification example. 2018-09-15 17:19:56 +08:00
dataloader.py restructure module: 4 classes; add modules; move prototype and rename 2018-07-12 21:53:42 +08:00
example.py Updates to core, loader: 2018-08-22 19:10:12 +08:00
main.py * fix processor.py 2018-12-06 19:28:27 +08:00
predict.py restructure module: 4 classes; add modules; move prototype and rename 2018-07-12 21:53:42 +08:00
prepare.py restructure module: 4 classes; add modules; move prototype and rename 2018-07-12 21:53:42 +08:00
README.md restructure module: 4 classes; add modules; move prototype and rename 2018-07-12 21:53:42 +08:00
Word2Idx.py restructure module: 4 classes; add modules; move prototype and rename 2018-07-12 21:53:42 +08:00

Prototype

Word2Idx.py

A mapping model between words and indexes

embedding.py

embedding modules

Contains a simple encapsulation for torch.nn.Embedding

encoder.py

encoder modules

Contains a simple encapsulation for torch.nn.LSTM

aggregation.py

aggregation modules

Contains a self-attention model, according to paper "A Structured Self-attentive Sentence Embedding", https://arxiv.org/abs/1703.03130

predict.py

predict modules

Contains a two layers perceptron for classification

example.py

An example showing how to use above modules to build a model

Contains a model for sentiment analysis on Yelp dataset, and its training and testing procedures. See https://arxiv.org/abs/1703.03130 for more details.

prepare.py

A case of using Word2Idx to build Yelp datasets

dataloader.py

A dataloader for Yelp dataset

It is an iterable object, returning a zero-padded batch every iteration.