A low-resource sentiment analysis project for African Languages
# semeval2023-afrisenti
A low-resource sentiment analysis project for African Languages
### Running the code
1. Clone the repo and `cd` to project directory
2. Install python -- version 3.8.12
2. Run the command `python -m venv .venv` to setup the virtual environment
3. Activate the virtual environment using `source .venv/bin/activate`
4. Install the requirements `pip install -r requirements.txt`
5. To run lexicon-based sentiment analysis for Igbo language, go to "Lexicon-based SA for Igbo" section below
### Training the model
The following commandline options are available for training the model
```
Usage: python -m src.models.train_model [OPTIONS]
Options:
--lang [am|dz|ha|ig|ma|pcm|pt|sw|yo]
--model [LinearSVM|NaiveBayes|naija-roberta-large|xlm-roberta-small]
--finetune_lm Finetune the language model as well
--finetune_classifier Finetune classification layer
--help Show this message and exit.
```
The `--model` option indicates which model to train.
The `--finetune_classifier` would fine tune the pretrained model on the training data. It is only applicable is the model is either `naija-roberta-large` or `xlm-roberta-small`. When `LinearSVC` or `NaiveBayes` is selected this option is ignored.
The `--finetune_lm` option will finetune the masked language model objective with the traning data for that particular model. It is always used with `--finetune_classifier`.
Example Usage: `python -m src.models.train_model --lang="pcm" --model="naija-roberta-large" --finetune_classifier --finetune_lm`
### Evaluating the model
The following commandline options are available for evaluating the model
```
Usage: python -m src.models.predict_model [OPTIONS]
Options:
--lang [am|dz|ha|ig|ma|pcm|pt|sw|yo]
--model [LinearSVM|NaiveBayes|naija-roberta-large|xlm-roberta-small]
--finetune_classifier Use finetuned classification layer
--help Show this message and exit.
```
The `--model` o …