Improve README
Browse files- README.md +187 -19
- Readability.svg +588 -0
README.md
CHANGED
@@ -1,34 +1,202 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
tags:
|
5 |
-
-
|
6 |
-
|
7 |
-
- name: multilingual-e5-small-aligned-readability-20241214-new
|
8 |
-
results: []
|
9 |
---
|
10 |
|
11 |
-
|
12 |
-
should probably proofread and complete it, then remove this comment. -->
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
It achieves the following results on the evaluation set:
|
18 |
-
- Loss: 0.1234
|
19 |
-
- Mse: 0.1234
|
20 |
|
21 |
-
|
|
|
|
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
|
|
|
|
|
|
26 |
|
27 |
-
|
|
|
|
|
28 |
|
29 |
-
##
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
## Training procedure
|
34 |
|
|
|
1 |
---
|
2 |
+
license: mit
|
3 |
+
language:
|
4 |
+
- multilingual
|
5 |
+
- af
|
6 |
+
- am
|
7 |
+
- ar
|
8 |
+
- as
|
9 |
+
- az
|
10 |
+
- be
|
11 |
+
- bg
|
12 |
+
- bn
|
13 |
+
- br
|
14 |
+
- bs
|
15 |
+
- ca
|
16 |
+
- cs
|
17 |
+
- cy
|
18 |
+
- da
|
19 |
+
- de
|
20 |
+
- el
|
21 |
+
- en
|
22 |
+
- eo
|
23 |
+
- es
|
24 |
+
- et
|
25 |
+
- eu
|
26 |
+
- fa
|
27 |
+
- fi
|
28 |
+
- fr
|
29 |
+
- fy
|
30 |
+
- ga
|
31 |
+
- gd
|
32 |
+
- gl
|
33 |
+
- gu
|
34 |
+
- ha
|
35 |
+
- he
|
36 |
+
- hi
|
37 |
+
- hr
|
38 |
+
- hu
|
39 |
+
- hy
|
40 |
+
- id
|
41 |
+
- is
|
42 |
+
- it
|
43 |
+
- ja
|
44 |
+
- jv
|
45 |
+
- ka
|
46 |
+
- kk
|
47 |
+
- km
|
48 |
+
- kn
|
49 |
+
- ko
|
50 |
+
- ku
|
51 |
+
- ky
|
52 |
+
- la
|
53 |
+
- lo
|
54 |
+
- lt
|
55 |
+
- lv
|
56 |
+
- mg
|
57 |
+
- mk
|
58 |
+
- ml
|
59 |
+
- mn
|
60 |
+
- mr
|
61 |
+
- ms
|
62 |
+
- my
|
63 |
+
- ne
|
64 |
+
- nl
|
65 |
+
- 'no'
|
66 |
+
- om
|
67 |
+
- or
|
68 |
+
- pa
|
69 |
+
- pl
|
70 |
+
- ps
|
71 |
+
- pt
|
72 |
+
- ro
|
73 |
+
- ru
|
74 |
+
- sa
|
75 |
+
- sd
|
76 |
+
- si
|
77 |
+
- sk
|
78 |
+
- sl
|
79 |
+
- so
|
80 |
+
- sq
|
81 |
+
- sr
|
82 |
+
- su
|
83 |
+
- sv
|
84 |
+
- sw
|
85 |
+
- ta
|
86 |
+
- te
|
87 |
+
- th
|
88 |
+
- tl
|
89 |
+
- tr
|
90 |
+
- ug
|
91 |
+
- uk
|
92 |
+
- ur
|
93 |
+
- uz
|
94 |
+
- vi
|
95 |
+
- xh
|
96 |
+
- yi
|
97 |
+
- zh
|
98 |
+
datasets:
|
99 |
+
- agentlans/en-translations
|
100 |
+
base_model:
|
101 |
+
- agentlans/multilingual-e5-small-aligned
|
102 |
+
pipeline_tag: text-classification
|
103 |
tags:
|
104 |
+
- multilingual
|
105 |
+
- readability-assessment
|
|
|
|
|
106 |
---
|
107 |
|
108 |
+
# multilingual-e5-small-aligned-readability
|
|
|
109 |
|
110 |
+
This model is a fine-tuned version of [agentlans/multilingual-e5-small-aligned](https://huggingface.co/agentlans/multilingual-e5-small-aligned) designed for assessing text readability across multiple languages.
|
111 |
|
112 |
+
## Key Features
|
|
|
|
|
|
|
113 |
|
114 |
+
- Multilingual support
|
115 |
+
- Readability assessment for text
|
116 |
+
- Based on E5 small model architecture
|
117 |
|
118 |
+
## Intended Uses & Limitations
|
119 |
|
120 |
+
This model is intended for:
|
121 |
+
- Assessing the readability of multilingual text
|
122 |
+
- Filtering multilingual content
|
123 |
+
- Comparative analysis of corpus text readability across different languages
|
124 |
|
125 |
+
Limitations:
|
126 |
+
- Performance may vary for languages not well-represented in the training data
|
127 |
+
- Should not be used as the sole criterion for readability assessment
|
128 |
|
129 |
+
## Usage Example
|
130 |
|
131 |
+
```python
|
132 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
133 |
+
import torch
|
134 |
+
|
135 |
+
model_name = "agentlans/multilingual-e5-small-aligned-readability"
|
136 |
+
|
137 |
+
# Initialize tokenizer and model
|
138 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
139 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
140 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
141 |
+
model = model.to(device)
|
142 |
+
|
143 |
+
def readability(text):
|
144 |
+
"""Assess the readability of the input text."""
|
145 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True).to(device)
|
146 |
+
with torch.no_grad():
|
147 |
+
logits = model(**inputs).logits.squeeze().cpu()
|
148 |
+
return logits.tolist()
|
149 |
+
|
150 |
+
# Grade level conversion function
|
151 |
+
# Input: readability value
|
152 |
+
# Output: the equivalent U.S. education grade level
|
153 |
+
def grade_level(y):
|
154 |
+
lambda_, mean, sd = 0.8766912, 7.908629, 3.339119
|
155 |
+
y_unstd = (-y) * sd + mean
|
156 |
+
return np.power((y_unstd * lambda_ + 1), (1 / lambda_))
|
157 |
+
|
158 |
+
# Example
|
159 |
+
input_text = "The mitochondria is the powerhouse of the cell."
|
160 |
+
readability_score = readability(input_text)
|
161 |
+
grade = grade_level(readability_score)
|
162 |
+
print(f"Predicted score: {readability_score:.2f}\nGrade: {grade:.1f}")
|
163 |
+
```
|
164 |
+
|
165 |
+
## Performance Results
|
166 |
+
|
167 |
+
The model was evaluated on a diverse set of multilingual text samples:
|
168 |
+
|
169 |
+
- 10 English text samples of varying readability were translated into Arabic, Chinese, French, Russian, and Spanish.
|
170 |
+
- The model demonstrated consistent readability assessment across different languages for the same text.
|
171 |
+
|
172 |
+
<details>
|
173 |
+
<summary>Click here for the 10 original texts and their translations.</summary>
|
174 |
+
|
175 |
+
| **Text** | **English** | **French** | **Spanish** | **Chinese** | **Russian** | **Arabic** |
|
176 |
+
|---|---|---|---|---|---|---|
|
177 |
+
| A | In a world increasingly dominated by technology, the delicate balance between human connection and digital interaction has become a focal point of contemporary discourse. | Dans un monde de plus en plus dominé par la technologie, l’équilibre délicat entre la connexion humaine et l’interaction numérique est devenu un point central du discours contemporain. | En un mundo cada vez más dominado por la tecnología, el delicado equilibrio entre la conexión humana y la interacción digital se ha convertido en un punto focal del discurso contemporáneo. | 在一个日益受技术主导的世界里,人际联系和数字互动之间的微妙平衡已经成为当代讨论的焦点。 | В мире, где все больше доминируют технологии, тонкий баланс между человеческими свя��ями и цифровым взаимодействием стал центральным вопросом современного дискурса. | في عالم تهيمن عليه التكنولوجيا بشكل متزايد، أصبح التوازن الدقيق بين التواصل البشري والتفاعل الرقمي نقطة محورية في الخطاب المعاصر. |
|
178 |
+
| B | Despite the challenges they faced, the team remained resolute in their pursuit of excellence and innovation. | Malgré les défis auxquels elle a été confrontée, l’équipe est restée déterminée dans sa quête de l’excellence et de l’innovation. | A pesar de los desafíos que enfrentaron, el equipo se mantuvo firme en su búsqueda de la excelencia y la innovación. | 尽管面临挑战,该团队仍然坚定地追求卓越和创新。 | Несмотря на трудности, с которыми пришлось столкнуться, команда сохраняла решимость в своем стремлении к совершенству и инновациям. | وعلى الرغم من التحديات التي واجهوها، ظل الفريق مصمماً على سعيه لتحقيق التميز والابتكار. |
|
179 |
+
| C | As the storm approached, the sky turned a deep shade of gray, casting an eerie shadow over the landscape. | À l’approche de la tempête, le ciel prenait une teinte grise profonde, projetant une ombre étrange sur le paysage. | A medida que se acercaba la tormenta, el cielo se tornó de un gris profundo, proyectando una sombra inquietante sobre el paisaje. | 随着暴风雨的临近,天空变成了深灰色,给大地投下了一层阴森的阴影。 | По мере приближения шторма небо приобрело глубокий серый оттенок, отбрасывая на пейзаж жуткую тень. | ومع اقتراب العاصفة، تحولت السماء إلى لون رمادي غامق، مما ألقى بظلال مخيفة على المشهد الطبيعي. |
|
180 |
+
| D | After a long day at work, he finally relaxed with a cup of tea. | Après une longue journée de travail, il s'est enfin détendu avec une tasse de thé. | Después de un largo día de trabajo, finalmente se relajó con una taza de té. | 工作了一天之后,他终于可以喝杯茶放松一下了。 | После долгого рабочего дня он наконец расслабился за чашкой чая. | بعد يوم طويل في العمل، استرخى أخيرًا مع كوب من الشاي. |
|
181 |
+
| E | The quick brown fox jumps over the lazy dog. | Le renard brun rapide saute par-dessus le chien paresseux. | El rápido zorro marrón salta sobre el perro perezoso. | 这只敏捷的棕色狐狸跳过了那只懒狗。 | Быстрая бурая лиса перепрыгивает через ленивую собаку. | يقفز الثعلب البني السريع فوق الكلب الكسول. |
|
182 |
+
| F | She enjoys reading books in her free time. | Elle aime lire des livres pendant son temps libre. | A ella le gusta leer libros en su tiempo libre. | 她喜欢在空闲时间读书。 | В свободное время она любит читать книги. | إنها تستمتع بقراءة الكتب في وقت فراغها. |
|
183 |
+
| G | The sun is shining brightly today. | Le soleil brille fort aujourd'hui. | Hoy el sol brilla intensamente. | 今天阳光明媚。 | Сегодня ярко светит солнце. | الشمس مشرقة بقوة اليوم. |
|
184 |
+
| H | Birds are singing in the trees. | Les oiseaux chantent dans les arbres. | Los pájaros cantan en los árboles. | 鸟儿在树上唱歌。 | Птицы поют на деревьях. | الطيور تغرد في الأشجار. |
|
185 |
+
| I | The cat is on the mat. | Le chat est sur le tapis. | El gato está sobre la alfombra. | 猫在垫子上。 | Кот на коврике. | القطة على الحصيرة. |
|
186 |
+
| J | I like to eat apples. | J'aime manger des pommes. | Me gusta comer manzanas. | 我喜欢吃苹果。 | Я люблю есть яблоки. | أنا أحب أكل التفاح. |
|
187 |
+
|
188 |
+
</details>
|
189 |
+
|
190 |
+
<img src="Readability.svg" alt="Scatterplot of predicted readability scores grouped by text sample and language" width="100%"/>
|
191 |
+
|
192 |
+
## Training Data
|
193 |
+
|
194 |
+
The model was trained on the [Multilingual Parallel Sentences dataset](https://huggingface.co/datasets/agentlans/en-translations), which includes:
|
195 |
+
|
196 |
+
- Parallel sentences in English and various other languages
|
197 |
+
- Semantic similarity scores calculated using LaBSE
|
198 |
+
- Additional readability metrics
|
199 |
+
- Sources: JW300, Europarl, TED Talks, OPUS-100, Tatoeba, Global Voices, and News Commentary
|
200 |
|
201 |
## Training procedure
|
202 |
|
Readability.svg
ADDED