Datasets:

Modalities:
Text
Formats:
parquet
Libraries:
Datasets
pandas
License:
Xenova HF staff commited on
Commit
8cf8015
·
verified ·
1 Parent(s): 8edb86d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +50 -3
README.md CHANGED
@@ -1,3 +1,50 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+
5
+ Data checkpoints from https://github.com/hexgrad/misaki for Grapheme To Phoneme (G2P) conversion.
6
+
7
+
8
+ ## Code to generate:
9
+ ```py
10
+ !git clone https://github.com/hexgrad/misaki
11
+ %cd misaki
12
+
13
+ import subprocess
14
+ import json
15
+ import pandas as pd
16
+ from misaki import __version__
17
+
18
+ def get_git_commit_hash():
19
+ result = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True, check=True)
20
+ return result.stdout.strip()
21
+
22
+ def get_rows(data, language):
23
+ rows = []
24
+ for key, values in data.items():
25
+ if not isinstance(values, dict):
26
+ values = dict(DEFAULT=values)
27
+ for pos, phonemes in values.items():
28
+ rows.append(dict(
29
+ language=language,
30
+ word=key,
31
+ pos=pos,
32
+ phonemes=phonemes,
33
+ ))
34
+ return rows
35
+
36
+ dictionaries = ["us_gold", "us_silver", "gb_gold", "gb_silver"]
37
+ data = {}
38
+ for dictionary in dictionaries:
39
+ with open(f"./misaki/data/{dictionary}.json") as f:
40
+ data[dictionary] = json.load(f)
41
+
42
+ rows = []
43
+ for dictionary, data in data.items():
44
+ rows.extend(get_rows(data, f"en-{'US' if dictionary.startswith('us_') else 'GB'}"))
45
+
46
+ df = pd.DataFrame(rows)
47
+ commit_hash = get_git_commit_hash()
48
+ dataset_name = f"{__version__}-{commit_hash}.parquet"
49
+ df.to_parquet(dataset_name)
50
+ ```