Daniel Duckworth commited on
Commit
585983d
1 Parent(s): b45a3ee

Update ISCO ESCO Occupations Taxonomy dataset

Browse files
Files changed (1) hide show
  1. isco_esco_occupations_taxonomy.py +14 -8
isco_esco_occupations_taxonomy.py CHANGED
@@ -1,10 +1,7 @@
1
- from typing import List
2
- from datasets.tasks import LanguageModeling, TextClassification, TaskTemplate
3
- import pandas as pd
4
- import csv
5
  import json
6
  import os
7
-
8
  import datasets
9
 
10
  logger = datasets.logging.get_logger(__name__)
@@ -17,7 +14,13 @@ taxonomy dataset, consisting of occupation groups from ISCO, \
17
  occupations from ESCO and definitions.
18
  """
19
 
20
- # TODO: Update license based on ILO and ESCO
 
 
 
 
 
 
21
  _LICENSE = """\
22
  By accessing ISCO ESCO Occupations Taxonomy Dataset, you indicate that you agree to the terms and conditions associated with their use. Please read the IEA Disclaimer and License Agreement for full details. [Disclaimer_and_License_Agreement.pdf (iea.nl)](https://www.iea.nl/sites/default/files/data-repository/Disclaimer_and_License_Agreement.pdf)
23
  """
@@ -25,9 +28,12 @@ By accessing ISCO ESCO Occupations Taxonomy Dataset, you indicate that you agre
25
  _HOMEPAGE = "https://iea.nl"
26
 
27
  _URL = "./data"
 
 
28
  _URLS = {
29
  "isco_taxonomy": _URL + "/isco_taxonomy.jsonl",
30
  "isco_occupations": _URL + "/isco_occupations.jsonl",
 
31
  }
32
 
33
 
@@ -69,7 +75,7 @@ class IscoTaxonomy(datasets.GeneratorBasedBuilder):
69
  {
70
  "text": datasets.features.Value("string"),
71
  "labels": datasets.features.ClassLabel(
72
- names_file="labels/isco_code_1.txt"
73
  ),
74
  }
75
  )
@@ -78,7 +84,7 @@ class IscoTaxonomy(datasets.GeneratorBasedBuilder):
78
  {
79
  "text": datasets.features.Value("string"),
80
  "labels": datasets.features.ClassLabel(
81
- names_file="labels/isco_codes.txt"
82
  ),
83
  # These are the features of your dataset like images, labels ...
84
  }
 
1
+ from datasets.utils import file_utils
2
+ from pathlib import Path
 
 
3
  import json
4
  import os
 
5
  import datasets
6
 
7
  logger = datasets.logging.get_logger(__name__)
 
14
  occupations from ESCO and definitions.
15
  """
16
 
17
+ # Define the path to the labels directory
18
+ _LABELS_DIR = Path(__file__).parent / "labels"
19
+
20
+ # Check if the labels directory exists, and create it if it doesn't
21
+ if not _LABELS_DIR.exists():
22
+ _LABELS_DIR.mkdir()
23
+
24
  _LICENSE = """\
25
  By accessing ISCO ESCO Occupations Taxonomy Dataset, you indicate that you agree to the terms and conditions associated with their use. Please read the IEA Disclaimer and License Agreement for full details. [Disclaimer_and_License_Agreement.pdf (iea.nl)](https://www.iea.nl/sites/default/files/data-repository/Disclaimer_and_License_Agreement.pdf)
26
  """
 
28
  _HOMEPAGE = "https://iea.nl"
29
 
30
  _URL = "./data"
31
+ _LABELS_URL = str(_LABELS_DIR / "isco_codes.txt")
32
+ # Alternative option is https://huggingface.co/datasets/ICILS/isco_esco_occupations_taxonomy/raw/main/labels/isco_codes.txt
33
  _URLS = {
34
  "isco_taxonomy": _URL + "/isco_taxonomy.jsonl",
35
  "isco_occupations": _URL + "/isco_occupations.jsonl",
36
+ "isco_labels": _LABELS_URL,
37
  }
38
 
39
 
 
75
  {
76
  "text": datasets.features.Value("string"),
77
  "labels": datasets.features.ClassLabel(
78
+ names_file=os.path.join(_LABELS_URL)
79
  ),
80
  }
81
  )
 
84
  {
85
  "text": datasets.features.Value("string"),
86
  "labels": datasets.features.ClassLabel(
87
+ names_file=os.path.join(_LABELS_URL)
88
  ),
89
  # These are the features of your dataset like images, labels ...
90
  }