-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_sample.py
More file actions
58 lines (56 loc) · 1.81 KB
/
make_sample.py
File metadata and controls
58 lines (56 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python3
# Creates data/sample_posts.jsonl (5 mock posts: AR + EN)
import json, pathlib
p = pathlib.Path("data")
p.mkdir(parents=True, exist_ok=True)
rows = [
{
"post_id": "p101",
"text": "I love the new phone update! Battery life is amazing 🚀 https://x.com/rel",
"lang_hint": "en",
"author_id": "u77",
"created_at": "2025-09-25T12:15:00Z",
"source": "x",
"domain": "tech",
},
{
"post_id": "p202",
"text": "كرهت خدمة العملاء اليوم، التجربة كانت سيئة جدًا. تواصلوا معي: 055-123-4567 أو email@domain.com",
"lang_hint": "ar",
"author_id": "u88",
"created_at": "2025-09-25T13:00:00Z",
"source": "ig",
"domain": "customer_service",
},
{
"post_id": "p203",
"text": "Great service!!! thanks @support contact me at john.doe@mail.com",
"lang_hint": "en",
"author_id": "u15",
"created_at": "2025-09-25T11:00:00Z",
"source": "fb",
"domain": "customer_service",
},
{
"post_id": "p204",
"text": "تحديث الكاميرا ممتاز جدااااا 🔥🔥 رابط: www.example.com",
"lang_hint": "ar",
"author_id": "u91",
"created_at": "2025-09-25T09:41:00Z",
"source": "x",
"domain": "tech",
},
{
"post_id": "p205",
"text": "Battery life still poor after the update :(",
"lang_hint": "en",
"author_id": "u77",
"created_at": "2025-09-25T12:25:00Z",
"source": "x",
"domain": "tech",
},
]
with open("data/sample_posts.jsonl", "w", encoding="utf-8") as f:
for r in rows:
f.write(json.dumps(r, ensure_ascii=False) + "\n")
print("Wrote data/sample_posts.jsonl")