flexthink
commited on
Commit
·
e0e90b5
1
Parent(s):
a3cebb6
Fixed a sample with incorrect annotations
Browse files- dataset/homograph_valid.json +2 -2
- librig2p-nostress-space.py +7 -10
dataset/homograph_valid.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d06ae492e1a337694a14da231fd3e68b9b70beff6dedcb9e1cae4fbf82705cf2
|
| 3 |
+
size 697913
|
librig2p-nostress-space.py
CHANGED
|
@@ -19,7 +19,9 @@ _DATA_TYPES = ["lexicon", "sentence", "homograph"]
|
|
| 19 |
_SPLITS = [
|
| 20 |
f"{data_type}_{split_type}"
|
| 21 |
for data_type in _DATA_TYPES
|
| 22 |
-
for split_type in _SPLIT_TYPES
|
|
|
|
|
|
|
| 23 |
|
| 24 |
class GraphemeToPhoneme(datasets.GeneratorBasedBuilder):
|
| 25 |
def __init__(self, base_url=None, splits=None, *args, **kwargs):
|
|
@@ -50,21 +52,17 @@ class GraphemeToPhoneme(datasets.GeneratorBasedBuilder):
|
|
| 50 |
)
|
| 51 |
|
| 52 |
def _get_url(self, split):
|
| 53 |
-
return f
|
| 54 |
|
| 55 |
def _split_generator(self, dl_manager, split):
|
| 56 |
url = self._get_url(split)
|
| 57 |
path = dl_manager.download_and_extract(url)
|
| 58 |
return datasets.SplitGenerator(
|
| 59 |
-
name=split,
|
| 60 |
-
gen_kwargs={"datapath": path, "datatype": split},
|
| 61 |
)
|
| 62 |
|
| 63 |
def _split_generators(self, dl_manager):
|
| 64 |
-
return [
|
| 65 |
-
self._split_generator(dl_manager, split)
|
| 66 |
-
for split in self.splits
|
| 67 |
-
]
|
| 68 |
|
| 69 |
def _generate_examples(self, datapath, datatype):
|
| 70 |
with open(datapath, encoding="utf-8") as f:
|
|
@@ -81,7 +79,6 @@ class GraphemeToPhoneme(datasets.GeneratorBasedBuilder):
|
|
| 81 |
"homograph_char_start": item.get("homograph_char_start", 0),
|
| 82 |
"homograph_char_end": item.get("homograph_char_end", 0),
|
| 83 |
"homograph_phn_start": item.get("homograph_phn_start", 0),
|
| 84 |
-
"homograph_phn_end": item.get("homograph_phn_end", 0)
|
| 85 |
-
|
| 86 |
}
|
| 87 |
yield sentence_counter, resp
|
|
|
|
| 19 |
_SPLITS = [
|
| 20 |
f"{data_type}_{split_type}"
|
| 21 |
for data_type in _DATA_TYPES
|
| 22 |
+
for split_type in _SPLIT_TYPES
|
| 23 |
+
]
|
| 24 |
+
|
| 25 |
|
| 26 |
class GraphemeToPhoneme(datasets.GeneratorBasedBuilder):
|
| 27 |
def __init__(self, base_url=None, splits=None, *args, **kwargs):
|
|
|
|
| 52 |
)
|
| 53 |
|
| 54 |
def _get_url(self, split):
|
| 55 |
+
return f"{self.base_url}/{split}.json"
|
| 56 |
|
| 57 |
def _split_generator(self, dl_manager, split):
|
| 58 |
url = self._get_url(split)
|
| 59 |
path = dl_manager.download_and_extract(url)
|
| 60 |
return datasets.SplitGenerator(
|
| 61 |
+
name=split, gen_kwargs={"datapath": path, "datatype": split},
|
|
|
|
| 62 |
)
|
| 63 |
|
| 64 |
def _split_generators(self, dl_manager):
|
| 65 |
+
return [self._split_generator(dl_manager, split) for split in self.splits]
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
def _generate_examples(self, datapath, datatype):
|
| 68 |
with open(datapath, encoding="utf-8") as f:
|
|
|
|
| 79 |
"homograph_char_start": item.get("homograph_char_start", 0),
|
| 80 |
"homograph_char_end": item.get("homograph_char_end", 0),
|
| 81 |
"homograph_phn_start": item.get("homograph_phn_start", 0),
|
| 82 |
+
"homograph_phn_end": item.get("homograph_phn_end", 0),
|
|
|
|
| 83 |
}
|
| 84 |
yield sentence_counter, resp
|