parquet-converter commited on
Commit
c9fc125
·
1 Parent(s): 2ef7df9

Update parquet files

Browse files
Open-Data-SM.py DELETED
@@ -1,103 +0,0 @@
1
- import json
2
-
3
- import datasets
4
- import pandas as pd
5
-
6
- class OpenDataSMConfig(datasets.BuilderConfig):
7
-
8
- def __init__(self, features, data_url, **kwargs):
9
- super(OpenDataSMConfig, self).__init__(**kwargs)
10
- self.features = features
11
- self.data_url = data_url
12
-
13
- class OpenDataSM(datasets.GeneratorBasedBuilder):
14
-
15
- BUILDER_CONFIGS = [
16
- OpenDataSMConfig(
17
- name="pairs",
18
- features={
19
- "column1": datasets.Value("string"),
20
- "column2": datasets.Value("string"),
21
- "label" : datasets.Value("bool")
22
- },
23
- data_url="https://huggingface.co/datasets/matchbench/Open-Data-SM/resolve/main/matches.txt"
24
- ),
25
- OpenDataSMConfig(
26
- name="source",
27
- features={
28
- "json": datasets.Value("string")
29
- },
30
- data_url="https://huggingface.co/datasets/matchbench/Open-Data-SM/resolve/main/open_data-sm-1.csv"
31
- ),
32
- OpenDataSMConfig(
33
- name="target",
34
- features={
35
- "json": datasets.Value("string")
36
- },
37
- data_url="https://huggingface.co/datasets/matchbench/Open-Data-SM/resolve/main/open_data-sm-2.csv"
38
- ),
39
- ]
40
-
41
- def _info(self):
42
- return datasets.DatasetInfo(
43
- features=datasets.Features(self.config.features)
44
- )
45
-
46
- def _split_generators(self, dl_manager):
47
- path = dl_manager.download(self.config.data_url)
48
- if self.config.name == "pairs":
49
- return [
50
- datasets.SplitGenerator(
51
- name=split,
52
- gen_kwargs={
53
- "file_path": path
54
- }
55
- )
56
- for split in [
57
- datasets.Split.TEST
58
- ]
59
- ]
60
- elif self.config.name == "source":
61
- return [
62
- datasets.SplitGenerator(
63
- name="source",
64
- gen_kwargs={
65
- "file_path": path
66
- }
67
- )
68
- ]
69
- elif self.config.name == "target":
70
- return [
71
- datasets.SplitGenerator(
72
- name="target",
73
- gen_kwargs={
74
- "file_path": path
75
- }
76
- )
77
- ]
78
-
79
- def _generate_examples(self, file_path):
80
- if self.config.name == "pairs":
81
- with open(file_path, "r") as f:
82
- md = {}
83
- for _, line in enumerate(f):
84
- t = line.strip().split(',')
85
- if t[0] not in md:
86
- md[t[0]] = {t[1]}
87
- else:
88
- md[t[0]].add(t[1])
89
- id = -1
90
- for k, v in md.items():
91
- for i in v:
92
- id = id + 1
93
- yield id, {"column1": k, "column2": i, "label": True}
94
- elif self.config.name == "source":
95
- with open(file_path, "r") as f:
96
- source = pd.read_csv(file_path)
97
- source = source.to_json()
98
- yield 0, {"json": source}
99
- elif self.config.name == "target":
100
- with open(file_path, "r") as f:
101
- target = pd.read_csv(file_path)
102
- target = target.to_json()
103
- yield 0, {"json": target}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
matches.txt DELETED
@@ -1,51 +0,0 @@
1
- 0_Fiscal year,1_Fiscal year
2
- 0_Project number,1_Project number
3
- 0_Status,1_Status
4
- 0_Maximum CIDA contribution (project-level),1_Maximum CIDA contribution (project-level)
5
- 0_Branch ID,1_Branch ID
6
- 0_Branch name,1_Branch name
7
- 0_Division ID,1_Division ID
8
- 0_Division name,1_Division name
9
- 0_Section ID,1_Section ID
10
- 0_Section name,1_Section name
11
- 0_Regional program (marker),1_Regional program (marker)
12
- 0_Fund centre ID,1_Fund centre ID
13
- 0_Fund centre name,1_Fund centre name
14
- 0_Untied amount(Project-level budget),1_Untied amount(Project-level budget)
15
- 0_FSTC percent,1_FSTC percent
16
- 0_IRTC percent,1_IRTC percent
17
- 0_CFLI (marker),1_CFLI (marker)
18
- 0_CIDA business delivery model (old),1_CIDA business delivery model (old)
19
- 0_Programming process (new),1_Programming process (new)
20
- 0_Bilateral aid (international marker),1_Bilateral aid (international marker)
21
- 0_PBA type,1_PBA type
22
- 0_Enviromental sustainability (marker),1_Enviromental sustainability (marker)
23
- 0_Climate change adaptation (marker),1_Climate change adaptation (marker)
24
- 0_Climate change mitigation (marker),1_Climate change mitigation (marker)
25
- 0_Desertification (marker),1_Desertification (marker)
26
- 0_Participatory development and good governance,1_Participatory development and good governance
27
- 0_Trade development (marker),1_Trade development (marker)
28
- 0_Biodiversity (marker),1_Biodiversity (marker)
29
- 0_Urban issues (marker),1_Urban issues (marker)
30
- 0_Children issues (marker),1_Children issues (marker)
31
- 0_Youth issues (marker),1_Youth issues (marker)
32
- 0_Indigenous issues (marker),1_Indigenous issues (marker)
33
- 0_Disability issues (marker),1_Disability issues (marker)
34
- 0_ICT as a tool for development (marker),1_ICT as a tool for development (marker)
35
- 0_Knowledge for development (marker),1_Knowledge for development (marker)
36
- 0_Gender equality (marker),1_Gender equality (marker)
37
- 0_Organisation ID,1_Organisation ID
38
- 0_Organisation name,1_Organisation name
39
- 0_Organisation type,1_Organisation type
40
- 0_Organisation class,1_Organisation class
41
- 0_Organisation sub-class,1_Organisation sub-class
42
- 0_Continent ID,1_Continent ID
43
- 0_Continent name,1_Continent name
44
- 0_Project Browser country ID,1_Project Browser country ID
45
- 0_CountryRegion ID,1_CountryRegion ID
46
- 0_CountryRegion name,1_CountryRegion name
47
- 0_CountryRegion percent,1_CountryRegion percent
48
- 0_Sector ID,1_Sector ID
49
- 0_Sector name,1_Sector name
50
- 0_Sector percent,1_Sector percent
51
- 0_Amount spent,1_Amount spent
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
open_data-sm-1.csv DELETED
The diff for this file is too large to render. See raw diff
 
open_data-sm-2.csv DELETED
The diff for this file is too large to render. See raw diff
 
pairs/open-data-sm-test.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b1c1fe849ed1beaec57a83d96fbc0b79dc6181a4cfb55d2df3d68e5411b6f2ca
3
+ size 3391
source/open-data-sm-source.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9706594d3e60442c6b942f1c6726a3f2ad08e18775c65df775522a5f138dd03f
3
+ size 5570648
target/open-data-sm-target.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:938c959e1271a62488ee9587b931d4287dcae916de05833f4d7c00f9b5b36660
3
+ size 2757577