Update README.md
Browse files
README.md
CHANGED
|
@@ -18,133 +18,46 @@ tags:
|
|
| 18 |
|
| 19 |
A state-of-the-art Arabic text style transfer model that transforms text into the writing style of 21 different Arabic authors using descriptive author tokens and prompt engineering.
|
| 20 |
|
| 21 |
-
##
|
| 22 |
-
|
| 23 |
-
- **BLEU Score:** 24.58
|
| 24 |
-
- **chrF Score:** 59.01
|
| 25 |
-
- **Competition:** First Place in AraGenEval 2024
|
| 26 |
-
- **Supported Authors:** 21 Arabic authors
|
| 27 |
-
|
| 28 |
-
## ๐ Quick Start
|
| 29 |
-
|
| 30 |
-
### Installation
|
| 31 |
-
|
| 32 |
-
```bash
|
| 33 |
-
pip install -r requirements.txt
|
| 34 |
-
```
|
| 35 |
-
|
| 36 |
-
### Basic Usage
|
| 37 |
-
|
| 38 |
-
```python
|
| 39 |
-
from inference_arabic_author_transfer import ArabicAuthorTextTransfer
|
| 40 |
|
| 41 |
-
|
| 42 |
-
model = ArabicAuthorTextTransfer()
|
| 43 |
|
| 44 |
-
|
| 45 |
-
text = "ุงูุชุนููู
ู
ูู
ุฌุฏุงู ูู ุญูุงุชูุง ุงูููู
ูุฉ"
|
| 46 |
-
target_author = "ููุณู ุฅุฏุฑูุณ"
|
| 47 |
-
|
| 48 |
-
result = model.transfer_style(text, target_author)
|
| 49 |
-
print(f"Original: {text}")
|
| 50 |
-
print(f"Transferred: {result}")
|
| 51 |
-
```
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
|
| 56 |
-
2. ูุฌูุจ ู
ุญููุธ
|
| 57 |
-
3. ุทู ุญุณูู
|
| 58 |
-
4. ุญุณู ุญููู
|
| 59 |
-
5. ุนุจุฏ ุงูุบูุงุฑ ู
ูุงูู
|
| 60 |
-
6. ุณูุงู
ุฉ ู
ูุณู
|
| 61 |
-
7. ุฃุญู
ุฏ ุดููู
|
| 62 |
-
8. ุฃุญู
ุฏ ุชูู
ูุฑ ุจุงุดุง
|
| 63 |
-
9. ุซุฑูุช ุฃุจุงุธุฉ
|
| 64 |
-
10. ุฌุจุฑุงู ุฎููู ุฌุจุฑุงู
|
| 65 |
-
11. ุฑูุจุฑุช ุจุงุฑ
|
| 66 |
-
12. ููููุงู
ุดููุณุจูุฑ
|
| 67 |
-
13. ุฃู
ูู ุงูุฑูุญุงูู
|
| 68 |
-
14. ุบูุณุชุงู ููุจูู
|
| 69 |
-
15. ุฃุญู
ุฏ ุฃู
ูู
|
| 70 |
-
16. ู
ุญู
ุฏ ุญุณูู ูููู
|
| 71 |
-
17. ุฌูุฑุฌู ุฒูุฏุงู
|
| 72 |
-
18. ุนุจุงุณ ู
ุญู
ูุฏ ุงูุนูุงุฏ
|
| 73 |
-
19. ูุคุงุฏ ุฒูุฑูุง
|
| 74 |
-
20. ูุงู
ู ูููุงูู
|
| 75 |
-
21. ููุงู ุงูุณุนุฏุงูู
|
| 76 |
-
|
| 77 |
-
## ๐ง Usage Examples
|
| 78 |
-
|
| 79 |
-
### 1. Command Line Interface
|
| 80 |
-
|
| 81 |
-
#### Interactive Mode
|
| 82 |
-
```bash
|
| 83 |
-
python inference_arabic_author_transfer.py --interactive
|
| 84 |
-
```
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
--output_file results.csv
|
| 98 |
-
```
|
| 99 |
|
| 100 |
-
### 2. Python API
|
| 101 |
|
| 102 |
-
|
| 103 |
-
```python
|
| 104 |
-
from inference_arabic_author_transfer import ArabicAuthorTextTransfer
|
| 105 |
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
-
# Transfer to single author
|
| 109 |
-
result = model.transfer_style(
|
| 110 |
-
text="ุงูุนูู
ููุฑ ูุงูุฌูู ุธูุงู
",
|
| 111 |
-
target_author="ูุฌูุจ ู
ุญููุธ"
|
| 112 |
-
)
|
| 113 |
-
```
|
| 114 |
|
| 115 |
-
|
| 116 |
-
```python
|
| 117 |
-
texts = [
|
| 118 |
-
"ุงูุญูุงุฉ ุฌู
ููุฉ",
|
| 119 |
-
"ุงูุนูู
ุฃุณุงุณ ุงูุชูุฏู
",
|
| 120 |
-
"ุงูุฃุฏุจ ุบุฐุงุก ุงูุฑูุญ"
|
| 121 |
-
]
|
| 122 |
-
|
| 123 |
-
results = model.batch_transfer_style(
|
| 124 |
-
texts=texts,
|
| 125 |
-
target_author="ุฃุญู
ุฏ ุดููู",
|
| 126 |
-
batch_size=4
|
| 127 |
-
)
|
| 128 |
-
```
|
| 129 |
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
print(f"Supported authors: {authors}")
|
| 134 |
-
```
|
| 135 |
|
| 136 |
-
### 3. Advanced Parameters
|
| 137 |
-
|
| 138 |
-
```python
|
| 139 |
-
result = model.transfer_style(
|
| 140 |
-
text="ุงููุต ุงูุฃุตูู",
|
| 141 |
-
target_author="ููุณู ุฅุฏุฑูุณ",
|
| 142 |
-
max_length=512, # Maximum generation length
|
| 143 |
-
num_beams=5, # Number of beams for beam search
|
| 144 |
-
temperature=1.0, # Sampling temperature
|
| 145 |
-
do_sample=False # Use deterministic generation
|
| 146 |
-
)
|
| 147 |
-
```
|
| 148 |
|
| 149 |
## ๐ Input File Format
|
| 150 |
|
|
@@ -153,34 +66,14 @@ For batch processing, your input file should have the following format:
|
|
| 153 |
### CSV Format
|
| 154 |
```csv
|
| 155 |
text,author
|
| 156 |
-
"ุงูุชุนููู
ู
ูู
ุฌุฏุงู ูู ุญูุงุชูุง ุงูููู
ูุฉ","ููุณู ุฅุฏุฑูุณ"
|
| 157 |
-
"ุงูุนูู
ููุฑ ูุงูุฌูู ุธูุงู
","ูุฌูุจ ู
ุญููุธ"
|
| 158 |
-
"ุงูุญูุงุฉ ุฌู
ููุฉ","ุทู ุญุณูู"
|
| 159 |
-
```
|
| 160 |
|
| 161 |
-
### Excel Format
|
| 162 |
-
Same structure as CSV but in Excel format.
|
| 163 |
|
| 164 |
-
## ๐๏ธ Model Architecture
|
| 165 |
|
| 166 |
-
- **Base Model:** UBC-NLP/AraT5v2-base-1024
|
| 167 |
-
- **Approach:** Descriptive Author Tokens + Prompt Engineering
|
| 168 |
-
- **Input Format:** `"ุงูุชุจ ุงููุต ุงูุชุงูู ุจุฃุณููุจ <author:name>: [text]"`
|
| 169 |
-
- **Training:** Fine-tuned with author-specific tokens
|
| 170 |
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
### Stylometric Analysis
|
| 174 |
-
The model incorporates comprehensive stylometric analysis including:
|
| 175 |
-
- **Lexical Features:** Sentence length, word length, vocabulary richness
|
| 176 |
-
- **Syntactic Patterns:** Definite articles, conjunctions, prepositions
|
| 177 |
-
- **Author-Specific Vocabulary:** TF-IDF based characteristic words
|
| 178 |
-
- **Style Classification:** Formality, complexity, emotional intensity
|
| 179 |
|
| 180 |
-
###
|
| 181 |
-
|
| 182 |
-
- **Author Tokens:** Descriptive tokens like `<author:ููุณู_ุฅุฏุฑูุณ>`
|
| 183 |
-
- **Target:** Generated text in author's style
|
| 184 |
|
| 185 |
## ๐ Performance Metrics
|
| 186 |
|
|
@@ -215,6 +108,18 @@ This model is released under the same license as the base AraT5v2 model.
|
|
| 215 |
|
| 216 |
For questions about the model or usage, please refer to the competition documentation or model repository.
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
---
|
| 219 |
|
| 220 |
**๐ First Place Winner at AraGenEval 2025 - Arabic Text Style Transfer Competition**
|
|
|
|
| 18 |
|
| 19 |
A state-of-the-art Arabic text style transfer model that transforms text into the writing style of 21 different Arabic authors using descriptive author tokens and prompt engineering.
|
| 20 |
|
| 21 |
+
## ๐ Paper Link (ACL Anthology)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
๐ **ANLPers at AraGenEval Shared Task: Descriptive Author Tokens for Transparent Arabic Authorship Style Transfer** [https://aclanthology.org/2025.arabicnlp-sharedtasks.8.pdf]
|
|
|
|
| 24 |
|
| 25 |
+
## ๐๏ธ Model Architecture
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
- **Base Model:** UBC-NLP/AraT5v2-base-1024
|
| 28 |
+
- **Approach:** Descriptive Author Tokens + Prompt Engineering
|
| 29 |
+
- **Input Format:** `"ุงูุชุจ ุงููุต ุงูุชุงูู ุจุฃุณููุจ <author:name>: [text]"`
|
| 30 |
+
- **Training:** Fine-tuned with author-specific tokens
|
| 31 |
|
| 32 |
+
## ๐ฌ Technical Details
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
### Stylometric Analysis
|
| 35 |
+
The model incorporates comprehensive stylometric analysis including:
|
| 36 |
+
- **Lexical Features:** Sentence length, word length, vocabulary richness
|
| 37 |
+
- **Syntactic Patterns:** Definite articles, conjunctions, prepositions
|
| 38 |
+
- **Author-Specific Vocabulary:** TF-IDF based characteristic words
|
| 39 |
+
- **Style Classification:** Formality, complexity, emotional intensity
|
| 40 |
|
| 41 |
+
### Prompt Engineering
|
| 42 |
+
- **Format:** `"ุงูุชุจ ุงููุต ุงูุชุงูู ุจุฃุณููุจ <author:ููุณู_ุฅุฏุฑูุณ>: [original_text]"`
|
| 43 |
+
- **Author Tokens:** Descriptive tokens like `<author:ููุณู_ุฅุฏุฑูุณ>`
|
| 44 |
+
- **Target:** Generated text in author's style
|
|
|
|
|
|
|
| 45 |
|
|
|
|
| 46 |
|
| 47 |
+
## ๐ฏ Model Performance
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
- **BLEU Score:** 24.58
|
| 50 |
+
- **chrF Score:** 59.01
|
| 51 |
+
- **Competition:** First Place in AraGenEval 2024
|
| 52 |
+
- **Supported Authors:** 21 Arabic authors
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
## ๐ Supported Authors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
+
<p align="center">
|
| 58 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/628f7a71dd993507cfcbe587/qDHUSa6ZvD1LjN9uJs-jp.png" width="600"/>
|
| 59 |
+
</p>
|
|
|
|
|
|
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
## ๐ Input File Format
|
| 63 |
|
|
|
|
| 66 |
### CSV Format
|
| 67 |
```csv
|
| 68 |
text,author
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
|
|
|
|
|
|
| 70 |
|
|
|
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
+
### Excel Format
|
| 76 |
+
Same structure as CSV but in Excel format.
|
|
|
|
|
|
|
| 77 |
|
| 78 |
## ๐ Performance Metrics
|
| 79 |
|
|
|
|
| 108 |
|
| 109 |
For questions about the model or usage, please refer to the competition documentation or model repository.
|
| 110 |
|
| 111 |
+
|
| 112 |
+
## BibTeX Citation
|
| 113 |
+
|
| 114 |
+
```bibtex
|
| 115 |
+
@inproceedings{nacar2025anlpers,
|
| 116 |
+
title={ANLPers at AraGenEval Shared Task: Descriptive Author Tokens for Transparent Arabic Authorship Style Transfer},
|
| 117 |
+
author={Nacar, Omer and Reda, Mahmoud and Sibaee, Serry and Alhabashi, Yasser and Ammar, Adel and Boulila, Wadii},
|
| 118 |
+
booktitle={Proceedings of The Third Arabic Natural Language Processing Conference: Shared Tasks},
|
| 119 |
+
pages={49--53},
|
| 120 |
+
year={2025}
|
| 121 |
+
}
|
| 122 |
+
```
|
| 123 |
---
|
| 124 |
|
| 125 |
**๐ First Place Winner at AraGenEval 2025 - Arabic Text Style Transfer Competition**
|