ArgStance is a research project focused on Argumentative Stance Classification using emotion lexicons, with a particular emphasis on the extended NRC Emotion Lexicon. The project lies at the intersection of Argumentation Mining (AM) and Emotion Analysis, with a specific focus on the stance classification subtask within AM.
Extensive preprocessing was conducted to prepare the corpora. The results can be found in the data folder.
-
Clone the repository
git clone <repository-url> cd ArgStanceNRC
-
Create conda environment from environment.yml
conda env create -f environment.yml
-
Activate the environment
conda activate enrc
The preprocessed datasets are located in the data/ directory:
dfIBM_stance-v1.jsondfMT1_stance-v1.jsondfMT2_stance-v1.jsondfMT3_stance.jsondfPE_stance-v2.jsondfUKB_stance-v1.json
The main training script is src/train_stance_classifier.py. It supports various configurations:
# Train on UKB dataset with default settings
cd src
python train_stance_classifier.py --dataset UKB
# Train on PE dataset
python train_stance_classifier.py --dataset PE# Train with standard NRC features
python train_stance_classifier.py --dataset PE --use-nrc
# Train with expandNRC features
python train_stance_classifier.py --dataset PE --use-enrc --threshold 0.8# Train without emotion features (baseline BERT)
python train_stance_classifier.py --dataset PE --no-nrc# Full configuration example
python train_stance_classifier.py \
--dataset PE \
--use-enrc \
--threshold 0.8 \
--batch-size 16 \
--epochs 50 \
--lr 2e-5 \
--test-size 0.1 \
--val-size 0.1 \
--use-focal-loss \
--use-data-augmentation \
--include-topic-in-text
# Freeze BERT weights (train only classifier head)
python train_stance_classifier.py --dataset PE --freeze-bert
# Disable wandb logging
python train_stance_classifier.py --dataset PE --no-wandb| Argument | Type | Default | Description |
|---|---|---|---|
--dataset |
str | UKB | Dataset to use: IBM, IBM_v2, MT1, MT2, MT3, PE, UKB |
--use-nrc |
flag | False | Use standard NRC emotion features |
--use-enrc |
flag | False | Use expandNRC emotion features (enhanced) |
--no-nrc |
flag | False | Disable NRC features (baseline) |
--threshold |
float | 0.8 | Threshold for expandNRC features |
--batch-size |
int | 8 | Batch size for training |
--epochs |
int | 50 | Number of training epochs |
--lr |
float | 1e-5 | Learning rate |
--test-size |
float | 0.1 | Test set size (fraction) |
--val-size |
float | 0.1 | Validation set size (fraction) |
--device |
str | auto | Device: cpu, cuda, or mps |
--freeze-bert |
flag | False | Freeze BERT weights |
--use-focal-loss |
flag | False | Use focal loss for class imbalance |
--use-data-augmentation |
flag | False | Enable data augmentation |
--include-topic-in-text |
flag | False | Include topic in input text |
--no-wandb |
flag | False | Disable wandb logging |
Training results are saved in results/<experiment_name>/:
model_<timestamp>.pt- Trained model checkpointmodel_<timestamp>_predictions.csv- Test set predictionstraining_history.json- Training metrics historytraining_plots.png- Loss and F1 score plotsexperiment_config.json- Experiment configuration
For LLM-based stance classification using Qwen:
cd src
# Evaluate on all datasets
python qwen_stance_classification.py --dataset all
# Evaluate on specific dataset
python qwen_stance_classification.py --dataset PE
# With NRC features
python qwen_stance_classification.py --dataset PE --use-nrc
# With expandNRC features
python qwen_stance_classification.py --dataset PE --use-enrc --threshold 0.8
# Custom results directory
python qwen_stance_classification.py --dataset all --results-dir ./my_qwen_resultsNote: Qwen classification requires significant GPU memory (recommended: 16GB+ VRAM for 7B model).
Results are saved in qwen_results/:
qwen_<dataset>_predictions_<timestamp>.csv- Predictionsqwen_<dataset>_metrics_<timestamp>.json- Metricsqwen_<dataset>_report_<timestamp>.txt- Classification reportqwen_summary_<timestamp>.csv- Summary across all datasets
[Specify your license here]
[Your contact information]