AMR-KELEG commited on
Commit
df4b780
1 Parent(s): 44fafaa

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +46 -1
README.md CHANGED
@@ -18,6 +18,29 @@ Sentence-ALDi (random seed: 50) | https://huggingface.co/AMR-KELEG/Sentence-ALDi
18
  Token-DI (random seed: 30) | https://huggingface.co/AMR-KELEG/ALDi-Token-DI-30
19
  Token-DI (random seed: 50) | https://huggingface.co/AMR-KELEG/ALDi-Token-DI-50
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  ### Model Description
22
 
23
  <!-- Provide a longer summary of what this model is. -->
@@ -28,4 +51,26 @@ Token-DI (random seed: 50) | https://huggingface.co/AMR-KELEG/ALDi-Token-DI-50
28
  <!--- **License:** [More Information Needed] -->
29
  - **Finetuned from model :** [MarBERT](https://huggingface.co/UBC-NLP/MARBERT)
30
 
31
- More information coming soon!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  Token-DI (random seed: 30) | https://huggingface.co/AMR-KELEG/ALDi-Token-DI-30
19
  Token-DI (random seed: 50) | https://huggingface.co/AMR-KELEG/ALDi-Token-DI-50
20
 
21
+ ### Usage
22
+
23
+ ```
24
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
25
+ model_name = "AMR-KELEG/Sentence-ALDi"
26
+
27
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
28
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
29
+
30
+ def compute_score(sentence):
31
+ inputs = tokenizer(sentence, return_tensors="pt")
32
+ outputs = model(**inputs)
33
+ logits = outputs.logits
34
+ return min(max(0, logits[0][0].item()), 1)
35
+
36
+ if __name__ == "__main__":
37
+ s1 = "الطقس جيد اليوم"
38
+ s2 = "الجو حلو النهاردة"
39
+
40
+ print(s1, round(compute_score(s1), 3)) # 0
41
+ print(22, round(compute_score(s1), 3)) # 0.951
42
+ ```
43
+
44
  ### Model Description
45
 
46
  <!-- Provide a longer summary of what this model is. -->
 
51
  <!--- **License:** [More Information Needed] -->
52
  - **Finetuned from model :** [MarBERT](https://huggingface.co/UBC-NLP/MARBERT)
53
 
54
+ ### Citation
55
+
56
+ If you find the model useful, please cite the following respective paper:
57
+ ```
58
+ @inproceedings{keleg-etal-2023-aldi,
59
+ title = "{ALD}i: Quantifying the {A}rabic Level of Dialectness of Text",
60
+ author = "Keleg, Amr and
61
+ Goldwater, Sharon and
62
+ Magdy, Walid",
63
+ editor = "Bouamor, Houda and
64
+ Pino, Juan and
65
+ Bali, Kalika",
66
+ booktitle = "Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing",
67
+ month = dec,
68
+ year = "2023",
69
+ address = "Singapore",
70
+ publisher = "Association for Computational Linguistics",
71
+ url = "https://aclanthology.org/2023.emnlp-main.655",
72
+ doi = "10.18653/v1/2023.emnlp-main.655",
73
+ pages = "10597--10611",
74
+ abstract = "Transcribed speech and user-generated text in Arabic typically contain a mixture of Modern Standard Arabic (MSA), the standardized language taught in schools, and Dialectal Arabic (DA), used in daily communications. To handle this variation, previous work in Arabic NLP has focused on Dialect Identification (DI) on the sentence or the token level. However, DI treats the task as binary, whereas we argue that Arabic speakers perceive a spectrum of dialectness, which we operationalize at the sentence level as the Arabic Level of Dialectness (ALDi), a continuous linguistic variable. We introduce the AOC-ALDi dataset (derived from the AOC dataset), containing 127,835 sentences (17{\%} from news articles and 83{\%} from user comments on those articles) which are manually labeled with their level of dialectness. We provide a detailed analysis of AOC-ALDi and show that a model trained on it can effectively identify levels of dialectness on a range of other corpora (including dialects and genres not included in AOC-ALDi), providing a more nuanced picture than traditional DI systems. Through case studies, we illustrate how ALDi can reveal Arabic speakers{'} stylistic choices in different situations, a useful property for sociolinguistic analyses.",
75
+ }
76
+ ```