Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
json
Sub-tasks:
topic-classification
Languages:
Ukrainian
Size:
1K - 10K
License:
Yehor Smoliakov
commited on
Commit
•
450a449
1
Parent(s):
114d1a6
Sync
Browse files- .gitignore +2 -0
- README.md +140 -0
- data/labels.json +1 -0
- data/raw_test.jsonl +0 -0
- data/raw_train.jsonl +0 -0
- data/test.jsonl +0 -0
- data/train.jsonl +0 -0
- extract_labels.py +31 -0
- generate_datasets.py +35 -0
- requirements-dev.txt +1 -0
- requirements.txt +1 -0
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
.venv/
|
2 |
+
.ruff_cache/
|
README.md
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- uk
|
4 |
+
license:
|
5 |
+
- proprietary
|
6 |
+
size_categories:
|
7 |
+
- 1K<n<100K
|
8 |
+
source_datasets:
|
9 |
+
- original
|
10 |
+
task_categories:
|
11 |
+
- text-classification
|
12 |
+
task_ids:
|
13 |
+
- topic-classification
|
14 |
+
pretty_name: UA-L Topics Corpus
|
15 |
+
dataset_info:
|
16 |
+
features:
|
17 |
+
- name: text
|
18 |
+
dtype: string
|
19 |
+
- name: label
|
20 |
+
dtype:
|
21 |
+
class_label:
|
22 |
+
names:
|
23 |
+
'0': kriminalnie_pravo
|
24 |
+
'1': pidpriemnicka_dialnist
|
25 |
+
'2': spadkove_pravo
|
26 |
+
'3': mizhnarodni_pravovidnosini
|
27 |
+
'4': zhitlovi_pravovidnosini
|
28 |
+
'5': korporativnie_pravo
|
29 |
+
'6': immighratsiia_iemighratsiia
|
30 |
+
'7': prava_spozhivachiv
|
31 |
+
'8': medicina
|
32 |
+
'9': pratsevlashtuvvannya
|
33 |
+
'10': bankivska_diialnist
|
34 |
+
'11': mytne_pravo
|
35 |
+
'12': doghovirni_vidnosini
|
36 |
+
'13': dovircha_vlastnist
|
37 |
+
'14': reklama
|
38 |
+
'15': viiskovie_pravo
|
39 |
+
'16': gospodarskie_pravo
|
40 |
+
'17': notarialni_pytanniia
|
41 |
+
'18': tsivilne_pravo
|
42 |
+
'19': litsienzuvannia
|
43 |
+
'20': ziemielnie_pravo
|
44 |
+
'21': nierukhomist
|
45 |
+
'22': opodatkuvannia
|
46 |
+
'23': sudova_praktika
|
47 |
+
'24': inshe
|
48 |
+
'25': piensiiata_sotsialni_viplati
|
49 |
+
'26': reyestraciya_likvidaciya_bankrutstvo
|
50 |
+
'27': ekologiya
|
51 |
+
'28': administrativnie_pravo
|
52 |
+
'29': gromadianski_pravovidnosini
|
53 |
+
'30': strakhuvannya
|
54 |
+
'31': vighotovliennia_produktsiyi_ta_nadannia_poslugh
|
55 |
+
'32': intieliektualna_vlasnist
|
56 |
+
'33': simejne_pravo
|
57 |
+
'34': dierzhavni_zakupivli
|
58 |
+
'35': prava_vnutrishno_pieriemishchienikh_osib
|
59 |
+
'36': sotsialnyj_zakhist
|
60 |
+
'37': investitsii
|
61 |
+
'38': avtovlasnykam
|
62 |
+
splits:
|
63 |
+
- name: train
|
64 |
+
num_bytes: 2092033
|
65 |
+
num_examples: 3021
|
66 |
+
- name: test
|
67 |
+
num_bytes: 122281
|
68 |
+
num_examples: 159
|
69 |
+
configs:
|
70 |
+
- config_name: default
|
71 |
+
data_files:
|
72 |
+
- split: train
|
73 |
+
path: data/train.jsonl
|
74 |
+
- split: test
|
75 |
+
path: data/test.jsonl
|
76 |
+
train-eval-index:
|
77 |
+
- config: default
|
78 |
+
task: text-classification
|
79 |
+
task_id: multi_class_classification
|
80 |
+
splits:
|
81 |
+
train_split: train
|
82 |
+
eval_split: test
|
83 |
+
col_mapping:
|
84 |
+
text: text
|
85 |
+
label: target
|
86 |
+
metrics:
|
87 |
+
- type: accuracy
|
88 |
+
name: Accuracy
|
89 |
+
- type: f1
|
90 |
+
name: F1 macro
|
91 |
+
args:
|
92 |
+
average: macro
|
93 |
+
- type: f1
|
94 |
+
name: F1 micro
|
95 |
+
args:
|
96 |
+
average: micro
|
97 |
+
- type: f1
|
98 |
+
name: F1 weighted
|
99 |
+
args:
|
100 |
+
average: weighted
|
101 |
+
- type: precision
|
102 |
+
name: Precision macro
|
103 |
+
args:
|
104 |
+
average: macro
|
105 |
+
- type: precision
|
106 |
+
name: Precision micro
|
107 |
+
args:
|
108 |
+
average: micro
|
109 |
+
- type: precision
|
110 |
+
name: Precision weighted
|
111 |
+
args:
|
112 |
+
average: weighted
|
113 |
+
- type: recall
|
114 |
+
name: Recall macro
|
115 |
+
args:
|
116 |
+
average: macro
|
117 |
+
- type: recall
|
118 |
+
name: Recall micro
|
119 |
+
args:
|
120 |
+
average: micro
|
121 |
+
- type: recall
|
122 |
+
name: Recall weighted
|
123 |
+
args:
|
124 |
+
average: weighted
|
125 |
+
---
|
126 |
+
|
127 |
+
# `ual-topics`
|
128 |
+
|
129 |
+
## Install
|
130 |
+
|
131 |
+
```shell
|
132 |
+
uv venv --python 3.12
|
133 |
+
|
134 |
+
source .venv/bin/activate
|
135 |
+
|
136 |
+
uv pip install -r requirements.txt
|
137 |
+
|
138 |
+
# in development mode
|
139 |
+
uv pip install -r requirements-dev.txt
|
140 |
+
```
|
data/labels.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"__label__kriminalnie_pravo": 0, "__label__pidpriemnicka_dialnist": 1, "__label__spadkove_pravo": 2, "__label__mizhnarodni_pravovidnosini": 3, "__label__zhitlovi_pravovidnosini": 4, "__label__korporativnie_pravo": 5, "__label__immighratsiia_iemighratsiia": 6, "__label__prava_spozhivachiv": 7, "__label__medicina": 8, "__label__pratsevlashtuvvannya": 9, "__label__bankivska_diialnist": 10, "__label__mytne_pravo": 11, "__label__doghovirni_vidnosini": 12, "__label__dovircha_vlastnist": 13, "__label__reklama": 14, "__label__viiskovie_pravo": 15, "__label__gospodarskie_pravo": 16, "__label__notarialni_pytanniia": 17, "__label__tsivilne_pravo": 18, "__label__litsienzuvannia": 19, "__label__ziemielnie_pravo": 20, "__label__nierukhomist": 21, "__label__opodatkuvannia": 22, "__label__sudova_praktika": 23, "__label__inshe": 24, "__label__piensiiata_sotsialni_viplati": 25, "__label__reyestraciya_likvidaciya_bankrutstvo": 26, "__label__ekologiya": 27, "__label__administrativnie_pravo": 28, "__label__gromadianski_pravovidnosini": 29, "__label__strakhuvannya": 30, "__label__vighotovliennia_produktsiyi_ta_nadannia_poslugh": 31, "__label__intieliektualna_vlasnist": 32, "__label__simejne_pravo": 33, "__label__dierzhavni_zakupivli": 34, "__label__prava_vnutrishno_pieriemishchienikh_osib": 35, "__label__sotsialnyj_zakhist": 36, "__label__investitsii": 37, "__label__avtovlasnykam": 38}
|
data/raw_test.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/raw_train.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/test.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/train.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
extract_labels.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import polars as pl
|
3 |
+
|
4 |
+
test = pl.read_ndjson("data/raw_test.jsonl")
|
5 |
+
train = pl.read_ndjson("data/raw_train.jsonl")
|
6 |
+
|
7 |
+
print(test)
|
8 |
+
print(train)
|
9 |
+
|
10 |
+
unique_test_labels = test.select("label").unique()
|
11 |
+
unique_train_labels = train.select("label").unique()
|
12 |
+
|
13 |
+
print("Unique labels in test data:", unique_test_labels)
|
14 |
+
print("Unique labels in train data:", unique_train_labels)
|
15 |
+
|
16 |
+
unique_concatenated = pl.concat([unique_test_labels, unique_train_labels]).unique()
|
17 |
+
|
18 |
+
print("Unique labels in both test and train data:", unique_concatenated)
|
19 |
+
|
20 |
+
print(unique_concatenated)
|
21 |
+
|
22 |
+
labels = {}
|
23 |
+
for idx, value in enumerate(unique_concatenated.rows()):
|
24 |
+
print(idx, value[0])
|
25 |
+
|
26 |
+
labels[value[0]] = idx
|
27 |
+
|
28 |
+
print(labels)
|
29 |
+
|
30 |
+
with open("data/labels.json", "w") as f:
|
31 |
+
json.dump(labels, f)
|
generate_datasets.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import polars as pl
|
3 |
+
|
4 |
+
with open("data/labels.json", "r") as f:
|
5 |
+
labels = json.load(f)
|
6 |
+
|
7 |
+
print(labels)
|
8 |
+
|
9 |
+
test = pl.read_ndjson("data/raw_test.jsonl")
|
10 |
+
train = pl.read_ndjson("data/raw_train.jsonl")
|
11 |
+
|
12 |
+
print(test)
|
13 |
+
print(train)
|
14 |
+
|
15 |
+
test_json = []
|
16 |
+
for value in test.rows():
|
17 |
+
label, text = value
|
18 |
+
|
19 |
+
print(labels[label], text)
|
20 |
+
|
21 |
+
test_json.append({"label": labels[label], "text": text})
|
22 |
+
|
23 |
+
train_json = []
|
24 |
+
for value in train.rows():
|
25 |
+
label, text = value
|
26 |
+
|
27 |
+
print(labels[label], text)
|
28 |
+
|
29 |
+
train_json.append({"label": labels[label], "text": text})
|
30 |
+
|
31 |
+
with open("data/test.jsonl", "w") as f:
|
32 |
+
f.writelines("\n".join(json.dumps(i) for i in test_json))
|
33 |
+
|
34 |
+
with open("data/train.jsonl", "w") as f:
|
35 |
+
f.writelines("\n".join(json.dumps(i) for i in train_json))
|
requirements-dev.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ruff
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
polars
|