Creating emotion lexicons for 250+ low-resource languages
# emo_lex
Experiment runner for paper Cross-Lingual Emotion Lexicon Induction using Representation Alignment in Low-Resource Settings.
# Usage
### Setup
1. Clone this repo
2. Clone fastText, multilingual-nlm and vecmap.
3. Install python packages `numpy`, `cupy`, `torch` and pot
## Embedding Alignment
Some conventions:
- Languages are referred to by their 3 letter ISO code.
- Each bible file should be named ` .txt`, e.g. Spanish would be `spa.txt`.
- Each line in a Bible file should contain 1 sentence/verse. The text should be pre-processed to be lowercased and contain space-separated words (no punctuation unless it's in the middle of a word, e.g. hypenation).
The 3 algorithms used for embedding alignment:
### Wasserstein-Procrustes
```
python align.py \
--langs \
--bible_dir \
--align_dir \
--emb_dir \
--num_gpus \
--algorithm fb \
--fasttext_dir
```
### Neural Language Model
```
python align.py \
--langs \
--bible_dir \
--align_dir \
--num_gpus \
--algorithm nlm \
--nlm_dir \
--nlm_preproc_dir \
--nlm_preprocess \
--nlm_modified
```
### Orthogonal Refinement
```
python align.py \
--langs \
--bible_dir \
--sid_bible_dir \
--align_dir \
--emb_dir \
--num_gpus \
--algorithm vecmap \
--vecmap_dir \
--fasttext_dir
```
The sentence ID Bibles are like the normal Bibles, except each line is prefixed with a sentence ID followed by a tab. Sentence ID for translations of the same sentence across different language should be the same.
Omit the `--sid_bible_dir` argument to run the original vecmap algorithm.
## Emotion Lexicon Induction and Evaluation
```
python eval.py \
--langs \
--align_dir \
--exp_id \
--trans_dir \
--emo_lex_dir \
--nns_dir \
--reports_dir
```
- The path provided to `nns_dir` and `reports_dir` is suffixed by `exp_id` so that multiple runs can share the same paths and just have different experiment IDs.
- The ground-truth word translation files should be named ` _ .txt`, e.g. `spa_eng.t …