word2affect_spanish / README.md
hplisiecki's picture
Update README.md
0aa9258 verified
---
license: apache-2.0
language:
- es
pipeline_tag: text-classification
inference: false
---
# Affective Norms Extrapolation Model for Spanish Language
## Model Description
This transformer-based model is designed to extrapolate affective norms for Spanish words, including metrics such as valence, arousal, concreteness, imageability, and familiarity. It has been finetuned from the "bert-base-spanish-wwm-cased" model (https://huggingface.co/dccuchile/bert-base-spanish-wwm-cased), enhanced with additional layers to predict the affective dimensions. This model was first released as a part of the publication: "Extrapolation of affective norms using transformer-based neural networks and its application to experimental stimuli selection." (Plisiecki, Sobieszek; 2023) [ https://doi.org/10.3758/s13428-023-02212-3 ]
## Training Data
The model was trained on the Spanish affective norms dataset by Redondo et al. (2007) [ https://doi.org/10.3758/BF03193031 ], which includes 1400 words rated by participants on various emotional and semantic dimensions. The dataset was split into training, validation, and test sets in an 8:1:1 ratio.
## Performance
The model achieved the following Pearson correlations with human judgments on the test set:
- Valence: 0.89
- Arousal: 0.80
- Concreteness: 0.89
- Imageability: 0.86
- Familiarity: 0.71
## Usage
You can use the model and tokenizer as follows:
First run the bash code below to clone the repository (this will take some time). Because of the custom model class, this model cannot be run with the usual huggingface Model setups.
```bash
git clone https://huggingface.co/hplisiecki/word2affect_spanish
```
Proceed as follows:
```python
from word2affect_spanish.model_script import CustomModel # importing the custom model class
from transformers import BertTokenizer
model_directory = "word2affect_spanish" # path to the cloned repository
model = CustomModel.from_pretrained(model_directory)
tokenizer = BertTokenizer.from_pretrained(model_directory)
inputs = tokenizer("test", return_tensors="pt")
outputs = model(inputs['input_ids'], inputs['attention_mask'])
# Print out the emotion ratings
for emotion, rating in zip(['Valence', 'Arousal', 'Concreteness', 'Imageability', 'Familiarity'], outputs):
print(f"{emotion}: {rating.item()}")
```
## Citation
If you use this model please cite the following paper.
```sql
@article{Plisiecki_Sobieszek_2023,
title={Extrapolation of affective norms using transformer-based neural networks and its application to experimental stimuli selection},
author={Plisiecki, Hubert and Sobieszek, Adam},
journal={Behavior Research Methods},
year={2023},
pages={1-16}
doi={https://doi.org/10.3758/s13428-023-02212-3}
}
```