File size: 2,801 Bytes
51bad3d 3444dbc 51bad3d 3444dbc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
---
license: mit
language:
- fa
metrics:
- f1
- precision
- accuracy
library_name: transformers
pipeline_tag: text-classification
---
---
# Persian Poem Classifier Based on ParsBERT
## Model Description
This model, named "Persian Poem Classifier," is based on the ParsBERT architecture and has been fine-tuned to classify Persian poems. Specifically, the model can evaluate whether a given piece of text is poetic, whether it adheres to a valid poetic structure, and whether it captures the style of a specific poet.
### Features
- **Multi-task Classification**: Determines if the text is poetic, if it's a valid poem, and if it conforms to a certain poet's style.
- **Language Support**: Specialized for Persian language text.
- **High Accuracy**: Fine-tuned using a diverse dataset of Persian poems.
## Intended Use
This model is intended to be used by researchers, poets, and NLP enthusiasts who are interested in the automated analysis of Persian poetry. It can be utilized in applications ranging from educational platforms to advanced poetry-generating algorithms.
## Limitations
- The model has been trained on a specific set of poets and may not generalize well to other styles.
- It assumes that the input text is in Persian and adheres to the specific poetic structures it has been trained on.
## Installation & Usage
You can easily install the model using the Hugging Face `transformers` library as follows:
```bash
pip install transformers
```
To classify a poem, you can use the following code snippet:
```python
from transformers import AutoModelForSequenceClassification, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("jrazi/persian-poem-classifier")
model = AutoModelForSequenceClassification.from_pretrained("jrazi/persian-poem-classifier")
text = "Your Persian poem here"
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
```
## Data Source
The model is fine-tuned on a curated dataset of Persian poems featuring various poets. The dataset contains multi-label annotations to evaluate the poetic nature, structure, and style conformity of the text. For creating negative labels, the model uses some of the publicly available persian text corporas. In addition to that, we used data augmentation techniques to further diversify our model, in order to make it generalize better.
## Evaluation Metrics
The model has been evaluated using standard classification metrics like accuracy, F1-score, and ROC AUC for each of the multi-task objectives.
| Metric | Is Poetic | Is Valid Poem | Has Poet Style |
| ------ | --------- | ------------- | -------------- |
| F1 | 0.66 | 0.66 | 0.59 |
| Prec | 0.81 | 0.77 | 0.71 |
| Acc | 0.85 | 0.84 | 0.64 |
--- |