Update README.md
Browse files
README.md
CHANGED
@@ -12,15 +12,39 @@ tags:
|
|
12 |
---
|
13 |
|
14 |
|
15 |
-
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
from sentence_transformers import CrossEncoder
|
|
|
|
|
18 |
model = CrossEncoder('oddadmix/arabic-reranker', max_length=512)
|
19 |
|
|
|
20 |
Query = 'كيف يمكن استخدام التعلم العميق في معالجة الصور الطبية؟'
|
21 |
Paragraph1 = 'التعلم العميق يساعد في تحليل الصور الطبية وتشخيص الأمراض'
|
22 |
Paragraph2 = 'الذكاء الاصطناعي يستخدم في تحسين الإنتاجية في الصناعات'
|
23 |
|
|
|
24 |
scores = model.predict([(Query, Paragraph1), (Query, Paragraph2)])
|
25 |
|
26 |
-
|
|
|
|
|
|
12 |
---
|
13 |
|
14 |
|
15 |
+
# Arabic Reranker Model
|
16 |
|
17 |
+
This is an Arabic reranker model, fine-tuned from the [Omartificial-Intelligence-Space/Arabic-Triplet-Matryoshka-V2](https://huggingface.co/Omartificial-Intelligence-Space/Arabic-Triplet-Matryoshka-V2), which itself is based on [aubmindlab/bert-base-arabertv02](https://huggingface.co/aubmindlab/bert-base-arabertv02). The model is designed to perform reranking tasks by scoring and ordering text options based on their relevance to a given query, specifically optimized for Arabic text.
|
18 |
+
|
19 |
+
This model was trained on a synthetic dataset of Arabic triplets generated using large language models (LLMs). It was refined using a scoring technique, making it ideal for ranking tasks in Arabic Natural Language Processing (NLP).
|
20 |
+
|
21 |
+
## Model Use
|
22 |
+
|
23 |
+
This model is well-suited for Arabic text reranking tasks, including:
|
24 |
+
- Information retrieval and document ranking
|
25 |
+
- Search engine results reranking
|
26 |
+
- Question-answering tasks requiring ranked answer choices
|
27 |
+
|
28 |
+
## Example Usage
|
29 |
+
|
30 |
+
Below is an example of how to use the model with the `sentence_transformers` library to rerank paragraphs based on relevance to a query.
|
31 |
+
|
32 |
+
### Code Example
|
33 |
+
|
34 |
+
```python
|
35 |
from sentence_transformers import CrossEncoder
|
36 |
+
|
37 |
+
# Load the model
|
38 |
model = CrossEncoder('oddadmix/arabic-reranker', max_length=512)
|
39 |
|
40 |
+
# Define the query and candidate paragraphs
|
41 |
Query = 'كيف يمكن استخدام التعلم العميق في معالجة الصور الطبية؟'
|
42 |
Paragraph1 = 'التعلم العميق يساعد في تحليل الصور الطبية وتشخيص الأمراض'
|
43 |
Paragraph2 = 'الذكاء الاصطناعي يستخدم في تحسين الإنتاجية في الصناعات'
|
44 |
|
45 |
+
# Score the paragraphs based on relevance to the query
|
46 |
scores = model.predict([(Query, Paragraph1), (Query, Paragraph2)])
|
47 |
|
48 |
+
# Output scores
|
49 |
+
print("Score for Paragraph 1:", scores[0])
|
50 |
+
print("Score for Paragraph 2:", scores[1])
|