Datasets:
Tasks:
Token Classification
Formats:
parquet
Sub-tasks:
named-entity-recognition
Languages:
Arabic
Size:
10K - 100K
License:
Updated split philosophy, relaxed prune_overlap threshold to 0.50 for better F1. Regenerated splits.
Browse files- README.md +37 -29
- iaa_A.parquet +2 -2
- iaa_B.parquet +2 -2
- load.py +3 -0
- make_split.py +93 -21
- non-arb-spans.py +33 -0
- non-arb-spans.txt +2 -0
- sanity_check_split.py +65 -0
- test.jsonl +0 -0
- test.parquet +2 -2
- train.jsonl +0 -0
- train.parquet +2 -2
- validation.jsonl +0 -0
- validation.parquet +2 -2
README.md
CHANGED
@@ -1,48 +1,56 @@
|
|
1 |
---
|
2 |
pretty_name: ShamNER
|
3 |
license: cc-by-4.0
|
4 |
-
|
5 |
task_categories:
|
6 |
-
|
7 |
-
|
8 |
language:
|
9 |
-
|
10 |
-
|
11 |
data_files:
|
12 |
train: train.parquet
|
13 |
validation: validation.parquet
|
14 |
test: test.parquet
|
15 |
-
|
16 |
dataset_info:
|
17 |
features:
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
dtype: string
|
22 |
-
- name:
|
23 |
dtype: int64
|
24 |
-
- name:
|
25 |
-
dtype: int64
|
26 |
-
- name: round
|
27 |
-
dtype: string
|
28 |
-
- name: annotator
|
29 |
dtype: string
|
|
|
|
|
30 |
- name: text
|
31 |
dtype: string
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
- name: text
|
45 |
-
dtype: string
|
46 |
---
|
47 |
|
48 |
# ShamNER – Spoken Arabic Named‑Entity Recognition Corpus (Levantine v1.1)
|
|
|
1 |
---
|
2 |
pretty_name: ShamNER
|
3 |
license: cc-by-4.0
|
|
|
4 |
task_categories:
|
5 |
+
- token-classification
|
|
|
6 |
language:
|
7 |
+
- ar
|
|
|
8 |
data_files:
|
9 |
train: train.parquet
|
10 |
validation: validation.parquet
|
11 |
test: test.parquet
|
|
|
12 |
dataset_info:
|
13 |
features:
|
14 |
+
- name: doc_id
|
15 |
+
dtype: int64
|
16 |
+
- name: doc_name
|
17 |
+
dtype: string
|
18 |
+
- name: sent_id
|
19 |
+
dtype: int64
|
20 |
+
- name: orig_ID
|
21 |
+
dtype: int64
|
22 |
+
- name: round
|
23 |
+
dtype: string
|
24 |
+
- name: annotator
|
25 |
+
dtype: string
|
26 |
+
- name: text
|
27 |
+
dtype: string
|
28 |
+
- name: source_type
|
29 |
+
dtype: string
|
30 |
+
- name: spans
|
31 |
+
list:
|
32 |
+
- name: annotator
|
33 |
dtype: string
|
34 |
+
- name: end
|
35 |
dtype: int64
|
36 |
+
- name: label
|
|
|
|
|
|
|
|
|
37 |
dtype: string
|
38 |
+
- name: start
|
39 |
+
dtype: int64
|
40 |
- name: text
|
41 |
dtype: string
|
42 |
+
splits:
|
43 |
+
- name: train
|
44 |
+
num_bytes: 5148727
|
45 |
+
num_examples: 19783
|
46 |
+
- name: validation
|
47 |
+
num_bytes: 328887
|
48 |
+
num_examples: 1795
|
49 |
+
- name: test
|
50 |
+
num_bytes: 313228
|
51 |
+
num_examples: 1844
|
52 |
+
download_size: 2302809
|
53 |
+
dataset_size: 5790842
|
|
|
|
|
54 |
---
|
55 |
|
56 |
# ShamNER – Spoken Arabic Named‑Entity Recognition Corpus (Levantine v1.1)
|
iaa_A.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:00fe56924e97a99c965e0cb4d091d73444328046257bb6162a88c27c4b07c7c6
|
3 |
+
size 585997
|
iaa_B.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:887475cc9149ca43c81d8c86e5eb28b05ba804851194a0928a1ac50e36bd24fa
|
3 |
+
size 582722
|
load.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from datasets import load_dataset
|
2 |
+
sham = load_dataset("HebArabNlpProject/ShamNER")
|
3 |
+
train_ds = sham["train"]
|
make_split.py
CHANGED
@@ -3,20 +3,20 @@
|
|
3 |
make_split.py – Create **train / validation / test** splits for the
|
4 |
**ShamNER final release** and serialise **both JSONL and Parquet** versions.
|
5 |
|
6 |
-
Philosophy
|
7 |
----------------------
|
8 |
-
* **No duplicate documents** –
|
9 |
-
|
|
|
10 |
* **Rounds** – Six annotation iterations:
|
11 |
`pilot`, `round1`‑`round5` = manual (improving quality), `round6` = synthetic
|
12 |
post‑edited. Early rounds feed *train*, round5 + (filtered) round6 populate
|
13 |
*test*.
|
14 |
-
* **
|
15 |
-
Therefore:
|
16 |
* `test` ∶ span‑novel bundles from round5 **plus** span‑novel bundles from
|
17 |
-
round6 (synthetic see README).
|
18 |
-
* **Span novelty rule** – Normalise every entity string (lower‑case, strip
|
19 |
-
Arabic diacritics & leading «ال», collapse whitespace).
|
20 |
to *train* if **any** of its normalised spans already exists in train.
|
21 |
* **Tokeniser‑agnostic** – Data carries only raw `text` and character‑offset
|
22 |
`spans`. No BIO arrays.
|
@@ -33,8 +33,42 @@ dataset_info.json
|
|
33 |
```
|
34 |
A **post‑allocation cleanup** moves any *validation* or *test* sentence whose
|
35 |
normalised spans already appear in *train* back into **train**. This enforces
|
36 |
-
strict span‑novelty for evaluation, even if an early bundle introduced a name
|
37 |
and a later bundle reused it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
"""
|
39 |
from __future__ import annotations
|
40 |
import json, re, unicodedata, pathlib, collections, random
|
@@ -69,12 +103,25 @@ AL_PREFIX_RE = re.compile(r"^ال(?=[\u0621-\u064A])")
|
|
69 |
MULTISPACE_RE = re.compile(r"\s+")
|
70 |
|
71 |
def normalise_span(text: str) -> str:
|
72 |
-
"""
|
|
|
|
|
|
|
|
|
73 |
t = AR_DIACRITICS_RE.sub("", text)
|
74 |
t = AL_PREFIX_RE.sub("", t)
|
|
|
|
|
75 |
t = unicodedata.normalize("NFKC", t).lower()
|
76 |
-
t = MULTISPACE_RE.sub(" ", t)
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
def read_jsonl(path: pathlib.Path) -> List[Row]:
|
80 |
with path.open(encoding="utf-8") as fh:
|
@@ -117,16 +164,35 @@ def harmonise_id_types(rows: List[Row]):
|
|
117 |
|
118 |
# --------------------------- main -------------------------------------------
|
119 |
|
120 |
-
def prune_overlap(split_name: str, splits: Dict[str, List[Row]], lexicon: set[str]):
|
121 |
-
|
122 |
-
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
kept, moved = [], 0
|
125 |
for r in splits[split_name]:
|
126 |
sent = r["text"]
|
127 |
-
spans_here = {
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
130 |
splits["train"].append(r)
|
131 |
lexicon.update(spans_here)
|
132 |
moved += 1
|
@@ -183,8 +249,14 @@ def main():
|
|
183 |
train_span_lex.update(spans)
|
184 |
|
185 |
# 2a. post‑pass cleanup to guarantee span novelty ------------------------
|
186 |
-
mv_val = prune_overlap("validation", splits, train_span_lex)
|
187 |
-
mv_test = prune_overlap("test", splits, train_span_lex)
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
print(f"Moved {mv_val} val and {mv_test} test rows back to train due to span overlap.")
|
189 |
|
190 |
# 2b. iaa views unchanged ----------------------------------------------
|
|
|
3 |
make_split.py – Create **train / validation / test** splits for the
|
4 |
**ShamNER final release** and serialise **both JSONL and Parquet** versions.
|
5 |
|
6 |
+
Philosophy
|
7 |
----------------------
|
8 |
+
* **No duplicate documents** – Originally a *document* was `(doc_name, round)`; each bundle
|
9 |
+
went to exactly one split. You can still see this in our commented code.
|
10 |
+
This rule is slightly relaxed now by post-allocation pruning, see below.
|
11 |
* **Rounds** – Six annotation iterations:
|
12 |
`pilot`, `round1`‑`round5` = manual (improving quality), `round6` = synthetic
|
13 |
post‑edited. Early rounds feed *train*, round5 + (filtered) round6 populate
|
14 |
*test*.
|
15 |
+
* **test set** –
|
|
|
16 |
* `test` ∶ span‑novel bundles from round5 **plus** span‑novel bundles from
|
17 |
+
round6 (synthetic see README).
|
18 |
+
* **Span novelty rule (Relaxed)** – Normalise every entity string (lower‑case, strip
|
19 |
+
Arabic diacritics & leading «ال», collapse whitespace). A bundle is initially forced
|
20 |
to *train* if **any** of its normalised spans already exists in train.
|
21 |
* **Tokeniser‑agnostic** – Data carries only raw `text` and character‑offset
|
22 |
`spans`. No BIO arrays.
|
|
|
33 |
```
|
34 |
A **post‑allocation cleanup** moves any *validation* or *test* sentence whose
|
35 |
normalised spans already appear in *train* back into **train**. This enforces
|
36 |
+
(nearly) strict span‑novelty for evaluation, even if an early bundle introduced a name
|
37 |
and a later bundle reused it.
|
38 |
+
|
39 |
+
A **post‑allocation cleanup** moves any *validation* or *test* sentence back into
|
40 |
+
**train** if a significant portion of its normalised spans already appear in
|
41 |
+
the `train` span set. This ensures a challenging evaluation set, though the strictness
|
42 |
+
has been relaxed from previous versions to allow for more learning examples in dev/test.
|
43 |
+
The current threshold for overlap is `0.50` (meaning a sentence is moved only if >50% of its
|
44 |
+
spans are already in train).
|
45 |
+
|
46 |
+
Current Results (with `prune_overlap` threshold 0.50):
|
47 |
+
------------------------------------------------------
|
48 |
+
* **Validation rows moved to train**: ~411 (from previous ~553)
|
49 |
+
* **Test rows moved to train**: ~383 (from previous ~506)
|
50 |
+
* **Resulting Split Counts**:
|
51 |
+
* train: 19,532 rows (approx. 83.3%)
|
52 |
+
* validation: 1,931 rows (approx. 8.2%)
|
53 |
+
* test: 1,959 rows (approx. 8.4%)
|
54 |
+
* **Document bundles in >1 split**: 61 (a consequence of relaxed pruning)
|
55 |
+
* **Overall Test Set F1 (Top 5 labels)**: ~0.5225 (improved from ~0.42)
|
56 |
+
|
57 |
+
The revsion for novelty and overlap
|
58 |
+
-----------------------------
|
59 |
+
ROUND_ORDER controls processing order (earlier rounds fill quotas first).
|
60 |
+
DEV_FRAC / TEST_FRAC set target ratios.
|
61 |
+
normalise_span() holds the string-unification rules—easy to extend.
|
62 |
+
prune_overlap(threshold=0.10) is the soft cleanup; raise/lower the threshold to tighten or loosen leakage.
|
63 |
+
For this version, `prune_overlap` is called with `threshold=0.50`.
|
64 |
+
All file writing happens at the end.
|
65 |
+
|
66 |
+
---------------
|
67 |
+
Keeps evaluation tough (mostly unseen names) without starving dev/test.
|
68 |
+
Guarantees no duplicate documents across splits.
|
69 |
+
Tokeniser-agnostic: any Arabic-BERT flavour can regenerate BIO tags on the fly.
|
70 |
+
One-file tweak regenerates looser or stricter splits on demand.
|
71 |
+
|
72 |
"""
|
73 |
from __future__ import annotations
|
74 |
import json, re, unicodedata, pathlib, collections, random
|
|
|
103 |
MULTISPACE_RE = re.compile(r"\s+")
|
104 |
|
105 |
def normalise_span(text: str) -> str:
|
106 |
+
"""
|
107 |
+
Normalise a span string for novelty comparison only
|
108 |
+
(raw data remains unchanged).
|
109 |
+
"""
|
110 |
+
# remove Arabic diacritics and leading definite article
|
111 |
t = AR_DIACRITICS_RE.sub("", text)
|
112 |
t = AL_PREFIX_RE.sub("", t)
|
113 |
+
|
114 |
+
# Unicode normalise, lower-case, collapse runs of spaces
|
115 |
t = unicodedata.normalize("NFKC", t).lower()
|
116 |
+
t = MULTISPACE_RE.sub(" ", t)
|
117 |
+
|
118 |
+
# additional unification rules
|
119 |
+
t = re.sub(r"[أإآ]", "ا", t) # hamza forms → bare alef
|
120 |
+
t = re.sub(r"ه\b", "ة", t) # final ha → ta-marbuta
|
121 |
+
t = re.sub(r"ى", "ي", t) # maqsūra → yā’
|
122 |
+
t = re.sub(r"\u0640", "", t) # strip tatweel
|
123 |
+
|
124 |
+
return t.strip()
|
125 |
|
126 |
def read_jsonl(path: pathlib.Path) -> List[Row]:
|
127 |
with path.open(encoding="utf-8") as fh:
|
|
|
164 |
|
165 |
# --------------------------- main -------------------------------------------
|
166 |
|
167 |
+
# def prune_overlap(split_name: str, splits: Dict[str, List[Row]], lexicon: set[str]):
|
168 |
+
# """A post-procession cautious step: move sentences from *split_name* into *train* if any of their spans
|
169 |
+
# already exist in the `lexicon` (train span set). Updates `splits` in
|
170 |
+
# place and returns the number of rows moved."""
|
171 |
+
# kept, moved = [], 0
|
172 |
+
# for r in splits[split_name]:
|
173 |
+
# sent = r["text"]
|
174 |
+
# spans_here = {normalise_span(sp.get("text") or sent[sp["start"]:sp["end"]])
|
175 |
+
# for sp in r["spans"]}
|
176 |
+
# if spans_here & lexicon:
|
177 |
+
# splits["train"].append(r)
|
178 |
+
# lexicon.update(spans_here)
|
179 |
+
# moved += 1
|
180 |
+
# else:
|
181 |
+
# kept.append(r)
|
182 |
+
# splits[split_name] = kept
|
183 |
+
# return moved
|
184 |
+
|
185 |
+
|
186 |
+
def prune_overlap(split_name, splits, lexicon, threshold=0.10):
|
187 |
kept, moved = [], 0
|
188 |
for r in splits[split_name]:
|
189 |
sent = r["text"]
|
190 |
+
spans_here = {
|
191 |
+
normalise_span(sp.get("text") or sent[sp["start"]:sp["end"]])
|
192 |
+
for sp in r["spans"]
|
193 |
+
}
|
194 |
+
overlap_ratio = len(spans_here & lexicon) / max(1, len(spans_here))
|
195 |
+
if overlap_ratio > threshold:
|
196 |
splits["train"].append(r)
|
197 |
lexicon.update(spans_here)
|
198 |
moved += 1
|
|
|
249 |
train_span_lex.update(spans)
|
250 |
|
251 |
# 2a. post‑pass cleanup to guarantee span novelty ------------------------
|
252 |
+
# mv_val = prune_overlap("validation", splits, train_span_lex)
|
253 |
+
# mv_test = prune_overlap("test", splits, train_span_lex)
|
254 |
+
# mv_val = prune_overlap("validation", splits, train_span_lex, 0.10)
|
255 |
+
# mv_test = prune_overlap("test", splits, train_span_lex, 0.10)
|
256 |
+
mv_val = prune_overlap("validation", splits, train_span_lex, threshold=0.50) # New threshold
|
257 |
+
mv_test = prune_overlap("test", splits, train_span_lex, threshold=0.50) # New threshold
|
258 |
+
|
259 |
+
|
260 |
print(f"Moved {mv_val} val and {mv_test} test rows back to train due to span overlap.")
|
261 |
|
262 |
# 2b. iaa views unchanged ----------------------------------------------
|
non-arb-spans.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json, re, pathlib, unicodedata, itertools
|
2 |
+
|
3 |
+
# helper regexes
|
4 |
+
AR = re.compile(r'[\u0600-\u06FF]') # Arabic block
|
5 |
+
EMOJI = re.compile('['
|
6 |
+
'\U0001F600-\U0001F64F' # emoticons
|
7 |
+
'\U0001F300-\U0001F5FF' # symbols & pictographs
|
8 |
+
'\U0001F680-\U0001F6FF' # transport & map symbols
|
9 |
+
'\U0001F1E0-\U0001F1FF' # flags
|
10 |
+
']', flags=re.UNICODE)
|
11 |
+
|
12 |
+
def is_flagged(txt):
|
13 |
+
if EMOJI.search(txt) or any(c in '@#' for c in txt):
|
14 |
+
return True
|
15 |
+
non_ar = sum(1 for c in txt if not AR.match(c))
|
16 |
+
return len(txt) and non_ar / len(txt) >= 0.8
|
17 |
+
|
18 |
+
files = ['train.jsonl', 'validation.jsonl', 'test.jsonl']
|
19 |
+
tot = flagged = 0
|
20 |
+
examples = []
|
21 |
+
|
22 |
+
for fn in files:
|
23 |
+
for row in map(json.loads, pathlib.Path(fn).read_text().splitlines()):
|
24 |
+
for sp in row['spans']:
|
25 |
+
txt = sp.get('text') or row['text'][sp['start']:sp['end']]
|
26 |
+
tot += 1
|
27 |
+
if is_flagged(txt):
|
28 |
+
flagged += 1
|
29 |
+
if len(examples) < 2000:
|
30 |
+
examples.append(txt)
|
31 |
+
|
32 |
+
print(f"{flagged}/{tot} spans flagged ({flagged/tot:.2%})")
|
33 |
+
print("sample:", examples)
|
non-arb-spans.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
1078/15335 spans flagged (7.03%)
|
2 |
+
sample: ['2011 ', '2015 ', '2015', '2011 ', '2011 ', '2015 ', '2015 ', '2015 ', '2015', '2015', '2015', '2011', '2012', '2013', '2011', '2020', '2016', '2016 ', '2017', '2021', '2012', '2013', '2014', '2015 ', '2017', '2011', '2011', '2011', '2010', '2011', '2000', '2000', '2010', '2010', '2010', '2000', '2010', '2011', '2011', '2011 ', '2010', '2011', '2019', '2004', '2000', '48', '48', '99', '99', '99', '2009', '2009', '2009', '2021', '2000', '96', '2000', '2000', '2016', '2016', '2017', '96', '2000', '2000', '2009', '2009', '2000', '2009', '2000', '2005', '2008', '2008', '2009', ' 2010', '2005', '2016', '2015', '1800', '2000', '2000', '2009', '2010', '2009', '17.3', 'jberabdallh', 'Gaza', 'قطاع #غزة ', 'قطاع #غزة ', '2017/10/28', 'bks2828', 'AseelSbaih', 'khalidshami6', 'BasharKhasawne3', 'Tahaluf_Aou', 'AOU', 'AOUKW', 'AOU', 'AOUKW', 'aou', 'aoukw', 'AOU', 'AOUKW', 'AOU', 'AOUKW', 'Basel Abugosh', 'Palestine ', 'January 31st', 'Oakland', 'Ahed Tamimi', 'Zotchka M Albaraa N', 'Wedad Abu Hana', 'DM0000000000', 'Ibtissam_ayash', '244_asal', 'miosha1005', 'MohammedAssaf89', 'arabidol', 'MohammedAssaf89', 'Jamal94pal', 'MohammedAssaf', 'BAMA2015GoldenEdition', 'MohammedAssaf89', 'Salwa_Queen12', 'HajBara', 'FPL', 'Gaza', 'AJAGAZA', 'Gaza', 'AJAGAZA', 'Gaza', '2012', 'unfalert', 'Yacoub_Shaheen', 'Anghami', 'araabidol ', 'Rebecca_abisaad ', 'Rebecca ', 'najwakaram ', 'najwakaram ', 'najwakaram', 'MBCTheVoiceSenior', 'MBC', 'najwakaram', 'najwakaram', 'najwakaram', 'NajwaKaram', 'najwakaram', 'najwakaram', 'najwakaram', 'najwakaram', 'TiaElBaroud', 'tia', 'GhinaAzizeh', 'najwakaram', 'najwakaram', 'najwakaram', 'najwakaram', 'najwakaram', 'najwakaram', 'najwakaram', 'najwakaram', 'najwakaram', 'najwakaram', 'CyrineAbdlNour', 'Cyrine', 'najwakaram', 'suzaan', 'najwakaram', 'najwakaram', 'najwakaram', 'najwa', 'Mariam', 'elissa', 'najwakaram', 'Gaza', 'GAZA ', 'SoundCloud', 'Omnia Sadat', 'TheXFactor', 'gaza', 'ArabIdol', 'ArabIdol', 'ArabIdol', 'Messi', 'Miral', 'NourhanAbuLebd', 'Mohammedsaqr', 'Gaza', 'Gaza', 'Palestine', 'Israel', 'gaza', 'Gaza', 'Gaza', 'Gaza', 'Palestine', 'Gaza', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'Apple', 'LaithAbuJoda', 'Laithabujoda', '100lown', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'nationalefeestdag', 'LaithAbuJoda', '100lown', 'Laithabujoda', 'LaithAbuJoda', 'LaithAbuJoda', 'LaithAbuJoda', 'HassanAyesh', 'AboraHaseebRaie', 'hayaghalayini', 'mahosh_sameer', 'bananshaheen', 'MaryamTlulu', 'أيام #العشر', 'AlaaRaie1', 'HanaTaysear', '2015', 'HanaTaysear', 'IEEE', 'Facebook', 'Cairo', 'Cairo Airport', 'Israeli', 'Palestinian', '32/7', 'Ishak Ahmaro', 'Ishak Ahmaro ', 'Ishak Ahmaro', 'Ishak Ahmaro', 'YouTube', 'NaDoSh', 'Bilal', 'NaDoSh', 'Bilal', 'Bilal', 'Bilal', 'NaDosh', 'Jiyeon', 'Nadosh', 'jeyoin', 'Jeyoin', 'Nadosh', 'Bilal', 'Jeyoin', 'Nadosh', 'Gaza', 'Alaa_Abu_Hassan', 'IUG40', "Ala'a Taher ALhasanat", 'Anthony norcia', 'co2', '2016', '1947', '1948', '1948', '1993 ', '48 ', '67', '67', '2002', '2022', '2014', '2000', '2004', '2004', '2004', '2009', '2019', '48', '2018', '2010', '2018', '2018', '2010', '2018', '2008 ', 'ل2008', '2000 ', '2012', '2012', '2014', '2015 ', '2007 ', '2008 ', '2018 ', '2014', '2015', '2017', '2014 ', '2015 ', '2013', '2012 ', '2013', '2008', '2008', '2010', '2010', '2010', '2010', '2010', '2012', '2013', '48', '48', '48', '2017', '2008', '8/10', '2005', '2009', ' Muhammed Abu Shadi', 'AJAGAZA', 'جنوب شرق #خانيونس', 'BDS', 'Palestine', '2014', 'قسام #البرغوثي', 'Palestine', 'Palestine', 'Palestine', 'جامعة #الأزهر', 'قطاع #غزة', 'سماء قطاع #غزة', 'islam', 'قطاع #غزة', ' قطاع #غزة', 'قطاع #غزة ', 'المسجد #الأقصى', 'ﻧﺘﻨﻴﺎﻫﻮ ', '27/8/2020 ', 'Faiayounan ', 'Rihan', 'NoorMAbuTaha ', 'baraa_anas ', 'hamodi ', 'habboshi_hc ', 'GAZA', 'Jordan ', 'Gaza', 'GAZA', 'GAZA ', 'GAZA', 'GAZA', 'QDS', 'Facebook ', 'جنوب #لبنان', 'الحكومة في #غزة ', '2014 ', 'Gaza', 'Gaza', 'rdooan', 'Rafah', '2016', 'Saedzkh', 'ﺍﻟﻘﺪﺱ', 'ibrahemzourob', 'ibrahemzourob', 'ibrahemzourob', 'bollywod', '2006 ', '2015 ', '1705', '2013', '2004 ', '2004', "Aldi's", 'foot locker', 'Jordan', 'Israel', 'Palestine', '8/1/22', '2010 ', '2011', '2007', '2006', '2011 ', '2012', '2010', '2006', '2006', '2011', '2011', '2011', '2011', '2011', '2011', '2011', '2008', '2011', '2011', '2011', '2011', '2011', '2011', '2011', '2011', '2011', '2011', '2011', '2006', '2007', '2011', '2011', '2011', '2011', '2011', '2011', '2011', '2011', '2014', '2013', '2014', '2011', '2012', '2011', '2011', '2011', '2011', '2011', '2011', '2015', '2000', '2015', '2000', ' 2014', '2011', '2011 ', '2006', '6/6/2006 ', '48', '48', '48', '48', '48', '2000', '48', '48', '48', '48', '48', '48', '48', '48', '48', '48', '48', '2015 ', '2015', '2011', '2012 ', '48', '48', '2011', '48', '48', '48', '48', '48', '48', '48', '2012', '2013 ', '93 ', '2011', '2014', '2016', '2017', '2020', '2021', '2011', '2012', '2011', '48', '48', '99', '99', '99', '2021', '2003', '2003', '2008', '1903', '2004', '2014', '2014', '2020', '2014', '2021', '2012', '2014', '2012', '2008', '2007 ', '2022', ' 25-1', 'AdilAbdAlMahdi', '67', 'mhmad_sheen', '2022', '2022', '2022', 'MohammedAssaf89', 'SheikhJarrah', 'MohammedAssaf89', 'MohammedAssaf89', 'MohammedAssaf89', '2020', 'MohammedAssaf89', 'ay_ota', 'شهر #رمضان المبارك', 'Mona740068670', 'مخيم #المية_ومية', 'MohammedAssaf89', 'MohammedAssaf89', 'MohammedAssaf89', 'mohammed_assaf', 'dafbamaawards', 'dafbama', '2018', 'Assaf', '2018', 'DAFBAMA2018 ', 'شهر #رمضان', 'MohammedAssaf89', 'MohammedAssaf89', 'MohammedAssaf89', 'MohammedAssaf89', 'MohammedAssaf89', 'MohammedAssaf89', 'assafm89', 'MohammedAssaf89', 'MohammedAssaf89', 'MohammedAssaf89', 'MohammedAssaf89', 'MohammedAssaf89', 'MohammedAssaf89', 'MohammedAssaf89', 'SeyoufElezz', 'MohammedAssaf89', 'AhmedJarad90', 'شهر #رمضان', 'MohammedAssaf89', 'bouhayat', 'MohammedAssaf89', '2016', 'BAMA2016PlatinumEdition', 'MohammedAssaf', 'Mona740068670 ', 'Assaf', 'Gaza', 'Mustafasamir12', 'lotuspal2014', '2015', 'BAMA2015GoldenEdition', 'MohammedAssaf', '2015', 'BAMA2015GoldenEdition', 'MohammedAssaf', 'ekram442', '2015', 'BAMA2015GoldenEdition', 'MohammedAssaf', '2015', 'BAMA2015GoldenEdition', 'MohammedAssaf ', '2015', 'BAMA2015GoldenEtdition', 'MohammedAssaf ', '2015', 'BAMA2015GoldenEdition', 'MohammedAssaf', '2015', 'BAMA2015GoldenEdition', 'MohammedAssaf', 'ASSAF', '7-7-2014', '26-8-2014 ', 'ArabsGotTalent', 'ASSAF', 'ASSAF', 'ASSAF', 'ArabIdol', 'gad719888', 'Mona740068670', 'شمال #رفح', 'Gaza', 'مدينة #غزة', 'Assaf', 'JoelleMardinian', 'ﻷغنية #ياحلالي_يامالي', 'Assaf360', 'Assaf360', '1111111111aa11A', 'maryamh57803201', 'HibaMoshail', 'palestine9876', 'ahmedasqoul', 'Gaza', 'Anon', 'مدارس #الشويفات', 'Jimin', 'Armys', 'GaonChartAwards', 'armyl', 'bts', '🇯🇴', '🇵🇸', 'RAEDZUROB', 'RAEDZUROB', 'RAEDZUROB', 'Palestine', 'SheikhJarrah', 'Silwan', 'yaffa', 'Israel', 'Aqsa', 'ahm3d_g3za', 'Gaza', ' iphone 7', '1948', 'Jaffa', 'Israel', 'linda_wael', 'Madrid', 'Madrid', 'Madrid', 'Madrid', 'Madrid', 'Madrid', 'Madrid', 'Madrid', 'Madrid ', 'Madrid', 'RealMadrid', 'amanimushtaha', 'Gaza', 'Heba', 'RANIASABAA ', 'H1N1', 'Red boull ', ' Fadi Abu Hassan', '1948 ', 'Waleed Sobhi ', 'Avichay Adraee ', 'Quds', 'UNGA', 'Napoli ', 'Italy', 'Italy', 'Donald', 'SheikhJarrahh', '1/9/2014 ', 'YaraNabil', '7anen_elwalah_', '1934', '2022', 'Twitter', 'Netflix', 'Salma', 'AljamalSalma', 'mbc', 'nawaranegm', 'قناة #النهار', 'Nakba', '66', 'Al Nakba', 'Rafah', 'Gaza', 'Sara', 'sara', 'careemnowksa', 'Gaza', 'Palestine', 'Israel', 'Israel', 'Gaza', 'פלסטינה', 'פלסטינה', 'SANAA', 'Gaza', 'Hamada', '2021', '2019', '2021 ', '3/2', '2019', 'YouTube channels', 'italki', 'English', 'LEGO', 'LEGO', 'ligo', '1922', '1991', '1997', '2014', '2014', '2021 ', 'Paternoster', '67', '71', '71', '93', '91', '67', '71', '75', '75', '94', '94', '2006 ', '2007', '94', '94', '94', '2006 ', '2007', '2006', '2006', '2005', '2011', '2012', '2017', '2012', '2013', '2012', '2011', '2012', '2014', '2019', '2017', '82', '83', '84', '2018', '2012', '2013', '2008', '2008', '2007', '48', '67', '2012', '2018', '2000', '2000', '2003 ', '2011 ', '2011 ', '2011', '2003 ', '2011', '2011 ', '2013', '2013 ', '2019', '2019 ', '2019 ', '2009 ', '2003', '2019', '2006 ', '2006 ', '2006 ', '2001', '2006', '2011', '2011', '2011', '2011', '2012 ', '2011 ', '2012 ', '2012 ', '2013 ', '2012 ', '2013 ', '2015 ', '2018 ', '2019 ', '2003 ', '4 1', '2004 ', '2021', '2019', '2021 ', '2014 ', '2015', '2014', '15 ', '2020', '2021', '2000', '1958 ', '1961', '1966', '16', 'EnoughisEnough', 'Believewomen', 'MeToo', '2006', '2017', '2016', 'honda', 'civic', 'johnnydepp', 'johnnydepp', 'mberturd', 'Safe Horizon', 'Bogus Content', 'Neo', 'GLOW HUB', '20.9.2017', '16.10.2012', '25.10.2012', 'Kinderdijk', '04.07.18', 'Carole a la chandelle', '28.11', 'Re-Nutriv', 'Aerin', '2018', '2019', 'A380', 'A330NEO', 'A350', '787', 'X777', '29/10', 'The Fowl River', 'Aerin', 'Blockbuster', 'Asmara', 'Bronx Zoo', 'Zoom', 'Huécar Gorge', 'Calle Obispo Valero', 'Huécar', 'iPlace', 'GPS', '17/10/21', 'Cherry Blossom', 'M16', 'M16', 'CX16', 'XK', 'XK', 'Aerospace Bristol', '1078', 'KartlisDeda', 'APPLE', 'Unpacked', 'Unpacked', 'IATA', 'Glass Igloo Hotel', 'MSD', 'Sitagliptin', '2011', '2008 و2009', '94', '95', '2009', '2009', '2010', '2010', '20019', '2019', '19', '20', '2019', '2018', 'YouTube', 'NISSIM KING', '2023', '2011', '2017', 'منتخب #السعودي', 'نهائيات كأس العالم #روسيا2018', '2018', '2021 ', '2022', '2024 ', '25', '1974', '1974', '2020', '1889', '2003', '2003', '2003', '2021', '2005', ' منتخب #البرازيل', '2014/9/21]', '🇵🇸', 'العلم 🇵🇸', 'ayatiker23 ', 'Twitter', 'SoompiAwards ', 'EXO', 'EXO', 'Twitter', 'SoompiAwards ', 'EXO', 'EXO', 'Darwish Mammo', 'SoundCloud', 'Israel', 'facebook', 'Palestine', 'facebook', 'Palestine', 'نادي #ريال_مدريد', 'انتفاضة_القدس #فلسطين', 'انتفاضة_القدس #فلسطين', 'مدينة #القدس', 'Palestine', 'Allan', 'Allan', 'Israel', 'Mohammed Allan', 'KhaderAdnan', 'قطاع #غزة', 'معبر #رفح', 'جمهورية #مصر', 'بحر #غزة', 'شهيد #رائد_سلم', 'GAZA', 'Palestine', 'Gaza', 'waelkfoury', 'waelkfoury', 'WaelKfoury', 'EMP', 'Emperor', 'Facebook', 'YouTube', 'oussama13dz', '2015', 'YouTube', 'YouTube', 'kfourywael', '94', 'YouTube', 'Ultras MouniRian', 'YouTube', 'kfourywael', 'EMPwaelkfoury', 'kfourywael', 'EMPwaelkfoury', 'kfourywael', 'kfourywael', 'EMPwaelkfoury', 'DrRana12_', 'Ahlam_Alshamsi', 'kfourywael', 'EMPwaelkfoury', 'kfourywael', 'EMPwaelkfoury', 'kfourywael', 'kfourywael', 'EMPwaelkfoury', '2017', '2017', 'MohammedAssaf89', 'MBC25', 'Gaza', 'Gaza', 'arab48website', 'arab48website', 'Tide', '2012', '2018', '2019', '48', 'Hala', 'hala', '2022', '2003', '2003', '75', '1950', '93', '2003', '2008', '2003', '48', '48', 'hussainalnawras', '@RaNaSaFa4', '13\\1', 'יינות ביתן', 'Tupperware', 'Mnwsh87', 'Minto', 'Jean', 'dandanie', 'levanter ', 'Stray_Kids', 'MnetApologise', "I'll be your man", 'Han', 'skcoolee54', 'Chan', 'Changbin', 'Monday', 'Hyunjin', ' Hanie', 'cbx', 'president', 'xingdae Nation', 'weareoneEXO', 'sajedaa9', 'mexol04', 'And years Too', 'CHEN', 'EXO', 'CHEN', 'TeenChoice', 'ChoiceInternationalArtist', 'EXO', 'weareoneEXO', 'cbx', 'cry', 'Benzema', 'Palestino', 'world cup', 'Ahmed Abu Jalala', 'iOS 9', 'KareenaKapoorKhan', 'ELLE India', 'ELLEINDIA', 'SayeghCyrine', 'Nizar Francis', 'kfourywael', 'NizarFrancis1', 'zalfa ramadan', 'kfourywael', 'zalfaramadan', 'Wael_K_Fans', 'ghanemeddy', 'EMPwaelkfoury', 'WaelKfouryWorld', 'bataleh', 'Cristiano Ronaldo', 'Cristiano Ronaldo', 'Rita_Harb', 'Rita_Harb ', 'asma2_kamel', 'RoyaJordanStar', 'RoyaTV', 'Maher Zain', 'Maher Zain', 'nana_a_ashour', 'yafaahoby', 'NadeenOdeh2', 'TheOriginals', 'Aya', 'Aya', '10/12/2016']
|
sanity_check_split.py
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# sanity_check_split.py (overwrite previous)
|
2 |
+
|
3 |
+
from pathlib import Path
|
4 |
+
import json, re, unicodedata, collections
|
5 |
+
from datasets import load_dataset
|
6 |
+
from itertools import chain
|
7 |
+
|
8 |
+
# ---------- helpers ----------------------------------------------------------
|
9 |
+
AR_DIACRITICS_RE = re.compile(r"[\u0610-\u061A\u064B-\u065F\u06D6-\u06ED]")
|
10 |
+
AL_PREFIX_RE = re.compile(r"^ال(?=[\u0621-\u064A])")
|
11 |
+
MULTISPACE_RE = re.compile(r"\s+")
|
12 |
+
|
13 |
+
def norm(txt):
|
14 |
+
t = AR_DIACRITICS_RE.sub("", txt)
|
15 |
+
t = AL_PREFIX_RE.sub("", t)
|
16 |
+
t = unicodedata.normalize("NFKC", t).lower()
|
17 |
+
return MULTISPACE_RE.sub(" ", t).strip()
|
18 |
+
|
19 |
+
def read_jsonl(p):
|
20 |
+
with open(p, encoding="utf-8") as fh:
|
21 |
+
for line in fh:
|
22 |
+
yield json.loads(line)
|
23 |
+
|
24 |
+
def span_strings(row):
|
25 |
+
sent = row["text"]
|
26 |
+
for sp in row["spans"]:
|
27 |
+
raw = sp.get("text") or sent[sp["start"]: sp["end"]]
|
28 |
+
if raw:
|
29 |
+
yield norm(raw)
|
30 |
+
|
31 |
+
# ---------- 1. size check ----------------------------------------------------
|
32 |
+
splits = {"train": "train.jsonl",
|
33 |
+
"validation": "validation.jsonl",
|
34 |
+
"test": "test.jsonl"}
|
35 |
+
|
36 |
+
sizes = {k: sum(1 for _ in read_jsonl(Path(v))) for k, v in splits.items()}
|
37 |
+
print("Sentence counts:", sizes)
|
38 |
+
|
39 |
+
# ---------- 2. doc leakage ---------------------------------------------------
|
40 |
+
seen = {}
|
41 |
+
dups = []
|
42 |
+
for split, path in splits.items():
|
43 |
+
for row in read_jsonl(Path(path)):
|
44 |
+
key = (row["doc_name"], row["round"])
|
45 |
+
if key in seen and seen[key] != split:
|
46 |
+
dups.append((key, seen[key], split))
|
47 |
+
seen[key] = split
|
48 |
+
print("Document bundles in >1 split:", len(dups))
|
49 |
+
|
50 |
+
# ---------- 3. span novelty --------------------------------------------------
|
51 |
+
train_spans = set(chain.from_iterable(span_strings(r) for r in read_jsonl(Path("train.jsonl"))))
|
52 |
+
overlaps = collections.Counter()
|
53 |
+
for split in ["validation", "test"]:
|
54 |
+
for row in read_jsonl(Path(f"{split}.jsonl")):
|
55 |
+
if any(n in train_spans for n in span_strings(row)):
|
56 |
+
overlaps[split] += 1
|
57 |
+
print("Sentences in dev/test with SEEN spans:", dict(overlaps))
|
58 |
+
|
59 |
+
# ---------- 4. HF Datasets smoke-load ---------------------------------------
|
60 |
+
ds = load_dataset("parquet",
|
61 |
+
data_files={"train": "train.parquet",
|
62 |
+
"validation": "validation.parquet",
|
63 |
+
"test": "test.parquet"},
|
64 |
+
split=None)
|
65 |
+
print("load_dataset OK:", {k: len(v) for k, v in ds.items()})
|
test.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
test.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:400b88a2c87dcdce09c9be80736472b4156558dfef0739372c4071721ed11492
|
3 |
+
size 132824
|
train.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
train.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7a17d6c40ba01706fca728ce88d828ad1e8b7cd6633ea71ef114eb3c9af07f11
|
3 |
+
size 2010347
|
validation.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
validation.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:23973340c3dffdb0b2196072141a80a177d0e2e15954814427a5e5eb59dcaa9c
|
3 |
+
size 165826
|