Matilde commited on
Commit
b561bf4
1 Parent(s): 98ed5bd

Update Homo_ita.py

Browse files
Files changed (1) hide show
  1. Homo_ita.py +13 -1
Homo_ita.py CHANGED
@@ -10,7 +10,7 @@ _BASE_URL = "https://huggingface.co/datasets/Matilde/Homo_ita/resolve/main/gen_d
10
  _HOMEPAGE_URL = "https://huggingface.co/datasets/Matilde/Homo_ita"
11
  _NA = "N/A"
12
  _SPLIT_TYPES = ["train", "valid", "test"]
13
- _DATA_TYPES = ["lexicon", "sentence"]
14
  _SPLITS = [
15
  f"{data_type}_{split_type}"
16
  for data_type in _DATA_TYPES
@@ -34,6 +34,12 @@ class GraphemeToPhoneme(datasets.GeneratorBasedBuilder):
34
  "origin": datasets.Value("string"),
35
  "char": datasets.Value("string"),
36
  "phn": datasets.Sequence(datasets.Value("string")),
 
 
 
 
 
 
37
  },
38
  ),
39
  supervised_keys=None,
@@ -63,5 +69,11 @@ class GraphemeToPhoneme(datasets.GeneratorBasedBuilder):
63
  "origin": item["origin"],
64
  "char": item["char"],
65
  "phn": item["phn"],
 
 
 
 
 
 
66
  }
67
  yield sentence_counter, resp
 
10
  _HOMEPAGE_URL = "https://huggingface.co/datasets/Matilde/Homo_ita"
11
  _NA = "N/A"
12
  _SPLIT_TYPES = ["train", "valid", "test"]
13
+ _DATA_TYPES = ["lexicon", "sentence", "homograph"]
14
  _SPLITS = [
15
  f"{data_type}_{split_type}"
16
  for data_type in _DATA_TYPES
 
34
  "origin": datasets.Value("string"),
35
  "char": datasets.Value("string"),
36
  "phn": datasets.Sequence(datasets.Value("string")),
37
+ "homograph": datasets.Value("string"),
38
+ "homograph_wordid": datasets.Value("string"),
39
+ "homograph_char_start": datasets.Value("int32"),
40
+ "homograph_char_end": datasets.Value("int32"),
41
+ "homograph_phn_start": datasets.Value("int32"),
42
+ "homograph_phn_end": datasets.Value("int32"),
43
  },
44
  ),
45
  supervised_keys=None,
 
69
  "origin": item["origin"],
70
  "char": item["char"],
71
  "phn": item["phn"],
72
+ "homograph": item.get("homograph", _NA),
73
+ "homograph_wordid": item.get("homograph_wordid", _NA),
74
+ "homograph_char_start": item.get("homograph_char_start", 0),
75
+ "homograph_char_end": item.get("homograph_char_end", 0),
76
+ "homograph_phn_start": item.get("homograph_phn_start", 0),
77
+ "homograph_phn_end": item.get("homograph_phn_end", 0),
78
  }
79
  yield sentence_counter, resp