Spaces:
Running
on
Zero
Running
on
Zero
File size: 130,559 Bytes
6faeba1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 |
import glob
import json
import os
import random
import xml.etree.ElementTree as ET
from csv import DictReader
from pathlib import Path
import torch
# HELPER FUNCTIONS
def split_dictionary_into_chunks(input_dict, split_n):
res = []
new_dict = {}
elements_per_dict = (len(input_dict.keys()) // split_n) + 1
for k, v in input_dict.items():
if len(new_dict) < elements_per_dict:
new_dict[k] = v
else:
res.append(new_dict)
new_dict = {k: v}
res.append(new_dict)
return res
def limit_to_n(path_to_transcript_dict, n=40000):
# deprecated, we now just use the whole thing always, because there's a critical mass of data
limited_dict = dict()
if len(path_to_transcript_dict.keys()) > n:
for key in random.sample(list(path_to_transcript_dict.keys()), n):
limited_dict[key] = path_to_transcript_dict[key]
return limited_dict
else:
return path_to_transcript_dict
def build_path_to_transcript_dict_multi_ling_librispeech_template(root):
"""
https://arxiv.org/abs/2012.03411
"""
path_to_transcript = dict()
with open(os.path.join(root, "transcripts.txt"), "r", encoding="utf8") as file:
lookup = file.read()
for line in lookup.split("\n"):
if line.strip() != "":
fields = line.split("\t")
wav_folders = fields[0].split("_")
wav_path = f"{root}/audio/{wav_folders[0]}/{wav_folders[1]}/{fields[0]}.flac"
path_to_transcript[wav_path] = fields[1]
return path_to_transcript
def build_path_to_transcript_dict_hui_template(root):
"""
https://arxiv.org/abs/2106.06309
"""
path_to_transcript = dict()
for el in os.listdir(root):
if os.path.isdir(os.path.join(root, el)):
with open(os.path.join(root, el, "metadata.csv"), "r", encoding="utf8") as file:
lookup = file.read()
for line in lookup.split("\n"):
if line.strip() != "":
norm_transcript = line.split("|")[1]
wav_path = os.path.join(root, el, "wavs", line.split("|")[0] + ".wav")
if os.path.exists(wav_path):
path_to_transcript[wav_path] = norm_transcript
return path_to_transcript
def indic_voices_template(root, lang):
path_to_transcript = dict()
transcripts = list()
import json
for jpath in [f"{root}/{lang}/metadata_test.json",
f"{root}/{lang}/metadata_train.json"]:
with open(jpath, encoding='utf-8', mode='r') as jfile:
for line in jfile.read().split("\n"):
if line.strip() != "":
transcripts.append(json.loads(line))
for transcript in transcripts:
path = f"{root}/{lang}/{lang}/wavs/{transcript['filepath']}"
norm_text = transcript["normalized"]
path_to_transcript[path] = norm_text
return path_to_transcript
# ENGLISH
def build_path_to_transcript_dict_ears(re_cache=False):
transcript_for_ears = {
"emo_adoration_sentences" : "You're just the sweetest person I know and I am so happy to call you my friend. I had the best time with you, I just adore you. I love this gift, thank you!",
"emo_amazement_sentences" : "I just love how you can play guitar. You're so impressive. I admire your abilities so much.",
"emo_amusement_sentences" : "The sound that baby just made was quite amusing. I liked that stand up comic, I found her pretty funny. What a fun little show to watch!",
"emo_anger_sentences" : "I'm so mad right now I could punch a hole in the wall. I can't believe he said that, he's such a jerk! There's a stop sign there and parents are just letting their kids run around!",
"emo_confusion_sentences" : "Huh, what is going on over here? What is this? Where are we going?",
"emo_contentment_sentences" : "I really enjoyed dinner tonight, it was quite nice. Everything is working out just fine. I'm good either way.",
"emo_cuteness_sentences" : "Look at that cute little kitty cat! Oh my goodness, she's so cute! That's the cutest thing I've ever seen!",
"emo_desire_sentences" : "Mmm that chocolate fudge lava cake looks divine. I want that car so badly. I can't wait to see you again.",
"emo_disappointment_sentences": "I'm so disappointed in myself. I wish I had worked harder. I had such higher expectations for you. I really was hoping you were better than this.",
"emo_disgust_sentences" : "I have never seen anything grosser than this in my entire life. This is the worst dinner I've ever had. Yuck, I can't even look at that.",
"emo_distress_sentences" : "Oh god, I am not sure if we are going to make this flight on time. This is all too stressful to handle right now. I don't know where anything is and I'm running late.",
"emo_embarassment_sentences" : "I don't know what happened, I followed the recipe perfectly but the cake just deflated. I'm so embarrassed. I hope no one saw that, I'd be mortified if they did.",
"emo_extasy_sentences" : "This is the most exciting thing I've ever seen in my life! I can't believe I got to see that. I'm so excited, I've never been there before.",
"emo_fear_sentences" : "Did you hear that sound? I'm afraid someone or something is outside. Oh my gosh, what is that? What do you think is going to happen if we don't run?",
"emo_guilt_sentences" : "I'm sorry I did that to you. I really didn't mean to hurt you. I feel horrible that happened to you.",
"emo_interest_sentences" : "Hmm, I wonder what that cookie tastes like. Oh, what is that over there? So what exactly is it that you do?",
"emo_neutral_sentences" : "That wall in the living room is white. There is one more piece of bread in the pantry. The store closes at 8pm tonight.",
"emo_pain_sentences" : "Oh, this headache is the worst one I've ever had! My foot hurts so badly right now! I'm in terrible pain from that medication.",
"emo_pride_sentences" : "That was all me, I'm the one who found the project, created the company and made it succeed. I have worked hard to get here and I deserve it. I'm really proud of how well you did.",
"emo_realization_sentences" : "Wow, I never know that the body was made up of 75% water. Did you know that a flamingo is actually white but turns pink because it eats too many shrimp? Apparently dolphins sleep with one eye open.",
"emo_relief_sentences" : "I'm so relieved my taxes are done. That was so stressful. I'm so relieved that is over with. Thank goodness that's all done.",
"emo_sadness_sentences" : "I am so upset by the state of the world. I hope it gets better soon. I really miss her, life isn't the same without her. I'm sorry for your loss.",
"emo_serenity_sentences" : "This has been the most peaceful day of my life. I am very calm right now. I'm going to relax and take a nap here on the beach.",
"rainbow_01_fast" : "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow. The rainbow is a division of white light into many beautiful colors.",
"rainbow_01_highpitch" : "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow. The rainbow is a division of white light into many beautiful colors.",
"rainbow_01_loud" : "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow. The rainbow is a division of white light into many beautiful colors.",
"rainbow_01_lowpitch" : "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow. The rainbow is a division of white light into many beautiful colors.",
"rainbow_01_regular" : "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow. The rainbow is a division of white light into many beautiful colors.",
"rainbow_01_slow" : "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow. The rainbow is a division of white light into many beautiful colors.",
"rainbow_01_whisper" : "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow. The rainbow is a division of white light into many beautiful colors.",
"rainbow_02_fast" : "These take the shape of a long round arch, with its path high above, and its two ends apparently beyond the horizon. There is, according to legend, a boiling pot of gold at one end.",
"rainbow_02_highpitch" : "These take the shape of a long round arch, with its path high above, and its two ends apparently beyond the horizon. There is, according to legend, a boiling pot of gold at one end.",
"rainbow_02_loud" : "These take the shape of a long round arch, with its path high above, and its two ends apparently beyond the horizon. There is, according to legend, a boiling pot of gold at one end.",
"rainbow_02_lowpitch" : "These take the shape of a long round arch, with its path high above, and its two ends apparently beyond the horizon. There is, according to legend, a boiling pot of gold at one end.",
"rainbow_02_regular" : "These take the shape of a long round arch, with its path high above, and its two ends apparently beyond the horizon. There is, according to legend, a boiling pot of gold at one end.",
"rainbow_02_slow" : "These take the shape of a long round arch, with its path high above, and its two ends apparently beyond the horizon. There is, according to legend, a boiling pot of gold at one end.",
"rainbow_02_whisper" : "These take the shape of a long round arch, with its path high above, and its two ends apparently beyond the horizon. There is, according to legend, a boiling pot of gold at one end.",
"rainbow_03_fast" : "People look, but no one ever finds it. When a man looks for something beyond his reach, his friends say he is looking for the pot of gold at the end of the rainbow. Throughout the centuries people have explained the rainbow in various ways.",
"rainbow_03_highpitch" : "People look, but no one ever finds it. When a man looks for something beyond his reach, his friends say he is looking for the pot of gold at the end of the rainbow. Throughout the centuries people have explained the rainbow in various ways.",
"rainbow_03_loud" : "People look, but no one ever finds it. When a man looks for something beyond his reach, his friends say he is looking for the pot of gold at the end of the rainbow. Throughout the centuries people have explained the rainbow in various ways.",
"rainbow_03_lowpitch" : "People look, but no one ever finds it. When a man looks for something beyond his reach, his friends say he is looking for the pot of gold at the end of the rainbow. Throughout the centuries people have explained the rainbow in various ways.",
"rainbow_03_regular" : "People look, but no one ever finds it. When a man looks for something beyond his reach, his friends say he is looking for the pot of gold at the end of the rainbow. Throughout the centuries people have explained the rainbow in various ways.",
"rainbow_03_slow" : "People look, but no one ever finds it. When a man looks for something beyond his reach, his friends say he is looking for the pot of gold at the end of the rainbow. Throughout the centuries people have explained the rainbow in various ways.",
"rainbow_03_whisper" : "People look, but no one ever finds it. When a man looks for something beyond his reach, his friends say he is looking for the pot of gold at the end of the rainbow. Throughout the centuries people have explained the rainbow in various ways.",
"rainbow_04_fast" : "Some have accepted it as a miracle without physical explanation. To the Hebrews it was a token that there would be no more universal floods. The Greeks used to imagine that it was a sign from the gods to foretell war or heavy rain.",
"rainbow_04_highpitch" : "Some have accepted it as a miracle without physical explanation. To the Hebrews it was a token that there would be no more universal floods. The Greeks used to imagine that it was a sign from the gods to foretell war or heavy rain.",
"rainbow_04_loud" : "Some have accepted it as a miracle without physical explanation. To the Hebrews it was a token that there would be no more universal floods. The Greeks used to imagine that it was a sign from the gods to foretell war or heavy rain.",
"rainbow_04_lowpitch" : "Some have accepted it as a miracle without physical explanation. To the Hebrews it was a token that there would be no more universal floods. The Greeks used to imagine that it was a sign from the gods to foretell war or heavy rain.",
"rainbow_04_regular" : "Some have accepted it as a miracle without physical explanation. To the Hebrews it was a token that there would be no more universal floods. The Greeks used to imagine that it was a sign from the gods to foretell war or heavy rain.",
"rainbow_04_slow" : "Some have accepted it as a miracle without physical explanation. To the Hebrews it was a token that there would be no more universal floods. The Greeks used to imagine that it was a sign from the gods to foretell war or heavy rain.",
"rainbow_04_whisper" : "Some have accepted it as a miracle without physical explanation. To the Hebrews it was a token that there would be no more universal floods. The Greeks used to imagine that it was a sign from the gods to foretell war or heavy rain.",
"rainbow_05_fast" : "The Norsemen considered the rainbow as a bridge over which the gods passed from earth to their home in the sky. Others have tried to explain the phenomenon physically. Aristotle thought that the rainbow was caused by reflection of the sun's rays by the rain.",
"rainbow_05_highpitch" : "The Norsemen considered the rainbow as a bridge over which the gods passed from earth to their home in the sky. Others have tried to explain the phenomenon physically. Aristotle thought that the rainbow was caused by reflection of the sun's rays by the rain.",
"rainbow_05_loud" : "The Norsemen considered the rainbow as a bridge over which the gods passed from earth to their home in the sky. Others have tried to explain the phenomenon physically. Aristotle thought that the rainbow was caused by reflection of the sun's rays by the rain.",
"rainbow_05_lowpitch" : "The Norsemen considered the rainbow as a bridge over which the gods passed from earth to their home in the sky. Others have tried to explain the phenomenon physically. Aristotle thought that the rainbow was caused by reflection of the sun's rays by the rain.",
"rainbow_05_regular" : "The Norsemen considered the rainbow as a bridge over which the gods passed from earth to their home in the sky. Others have tried to explain the phenomenon physically. Aristotle thought that the rainbow was caused by reflection of the sun's rays by the rain.",
"rainbow_05_slow" : "The Norsemen considered the rainbow as a bridge over which the gods passed from earth to their home in the sky. Others have tried to explain the phenomenon physically. Aristotle thought that the rainbow was caused by reflection of the sun's rays by the rain.",
"rainbow_05_whisper" : "The Norsemen considered the rainbow as a bridge over which the gods passed from earth to their home in the sky. Others have tried to explain the phenomenon physically. Aristotle thought that the rainbow was caused by reflection of the sun's rays by the rain.",
"rainbow_06_fast" : "Since then physicists have found that it is not reflection, but refraction by the raindrops which causes the rainbows. Many complicated ideas about the rainbow have been formed.",
"rainbow_06_highpitch" : "Since then physicists have found that it is not reflection, but refraction by the raindrops which causes the rainbows. Many complicated ideas about the rainbow have been formed.",
"rainbow_06_loud" : "Since then physicists have found that it is not reflection, but refraction by the raindrops which causes the rainbows. Many complicated ideas about the rainbow have been formed.",
"rainbow_06_lowpitch" : "Since then physicists have found that it is not reflection, but refraction by the raindrops which causes the rainbows. Many complicated ideas about the rainbow have been formed.",
"rainbow_06_regular" : "Since then physicists have found that it is not reflection, but refraction by the raindrops which causes the rainbows. Many complicated ideas about the rainbow have been formed.",
"rainbow_06_slow" : "Since then physicists have found that it is not reflection, but refraction by the raindrops which causes the rainbows. Many complicated ideas about the rainbow have been formed.",
"rainbow_06_whisper" : "Since then physicists have found that it is not reflection, but refraction by the raindrops which causes the rainbows. Many complicated ideas about the rainbow have been formed.",
"rainbow_07_fast" : "The difference in the rainbow depends considerably upon the size of the drops, and the width of the colored band increases as the size of the drops increases. The actual primary rainbow observed is said to be the effect of super-imposition of a number of bows.",
"rainbow_07_highpitch" : "The difference in the rainbow depends considerably upon the size of the drops, and the width of the colored band increases as the size of the drops increases. The actual primary rainbow observed is said to be the effect of super-imposition of a number of bows.",
"rainbow_07_loud" : "The difference in the rainbow depends considerably upon the size of the drops, and the width of the colored band increases as the size of the drops increases. The actual primary rainbow observed is said to be the effect of super-imposition of a number of bows.",
"rainbow_07_lowpitch" : "The difference in the rainbow depends considerably upon the size of the drops, and the width of the colored band increases as the size of the drops increases. The actual primary rainbow observed is said to be the effect of super-imposition of a number of bows.",
"rainbow_07_regular" : "The difference in the rainbow depends considerably upon the size of the drops, and the width of the colored band increases as the size of the drops increases. The actual primary rainbow observed is said to be the effect of super-imposition of a number of bows.",
"rainbow_07_slow" : "The difference in the rainbow depends considerably upon the size of the drops, and the width of the colored band increases as the size of the drops increases. The actual primary rainbow observed is said to be the effect of super-imposition of a number of bows.",
"rainbow_07_whisper" : "The difference in the rainbow depends considerably upon the size of the drops, and the width of the colored band increases as the size of the drops increases. The actual primary rainbow observed is said to be the effect of super-imposition of a number of bows.",
"rainbow_08_fast" : "If the red of the second bow falls upon the green of the first, the result is to give a bow with an abnormally wide yellow band, since red and green light when mixed form yellow. This is a very common type of bow, one showing mainly red and yellow, with little or no green or blue.",
"rainbow_08_highpitch" : "If the red of the second bow falls upon the green of the first, the result is to give a bow with an abnormally wide yellow band, since red and green light when mixed form yellow. This is a very common type of bow, one showing mainly red and yellow, with little or no green or blue.",
"rainbow_08_loud" : "If the red of the second bow falls upon the green of the first, the result is to give a bow with an abnormally wide yellow band, since red and green light when mixed form yellow. This is a very common type of bow, one showing mainly red and yellow, with little or no green or blue.",
"rainbow_08_lowpitch" : "If the red of the second bow falls upon the green of the first, the result is to give a bow with an abnormally wide yellow band, since red and green light when mixed form yellow. This is a very common type of bow, one showing mainly red and yellow, with little or no green or blue.",
"rainbow_08_regular" : "If the red of the second bow falls upon the green of the first, the result is to give a bow with an abnormally wide yellow band, since red and green light when mixed form yellow. This is a very common type of bow, one showing mainly red and yellow, with little or no green or blue.",
"rainbow_08_slow" : "If the red of the second bow falls upon the green of the first, the result is to give a bow with an abnormally wide yellow band, since red and green light when mixed form yellow. This is a very common type of bow, one showing mainly red and yellow, with little or no green or blue.",
"rainbow_08_whisper" : "If the red of the second bow falls upon the green of the first, the result is to give a bow with an abnormally wide yellow band, since red and green light when mixed form yellow. This is a very common type of bow, one showing mainly red and yellow, with little or no green or blue.",
"sentences_01_fast" : "I will not stay here. God, we simply must dress the character. Stay, stay, I will go myself. May one ask what it is for. He rushed to the window and opened the movable pane.",
"sentences_01_highpitch" : "I will not stay here. God, we simply must dress the character. Stay, stay, I will go myself. May one ask what it is for. He rushed to the window and opened the movable pane.",
"sentences_01_loud" : "I will not stay here. God, we simply must dress the character. Stay, stay, I will go myself. May one ask what it is for. He rushed to the window and opened the movable pane.",
"sentences_01_lowpitch" : "I will not stay here. God, we simply must dress the character. Stay, stay, I will go myself. May one ask what it is for. He rushed to the window and opened the movable pane.",
"sentences_01_regular" : "I will not stay here. God, we simply must dress the character. Stay, stay, I will go myself. May one ask what it is for. He rushed to the window and opened the movable pane.",
"sentences_01_slow" : "I will not stay here. God, we simply must dress the character. Stay, stay, I will go myself. May one ask what it is for. He rushed to the window and opened the movable pane.",
"sentences_01_whisper" : "I will not stay here. God, we simply must dress the character. Stay, stay, I will go myself. May one ask what it is for. He rushed to the window and opened the movable pane.",
"sentences_02_fast" : "It might happen, he added with an involuntary smile. It is sold, sir, was again his laconic reply. And you must have some water, my dear fellow. What is that flying about? Who wants a dead cert for the Gold cup?",
"sentences_02_highpitch" : "It might happen, he added with an involuntary smile. It is sold, sir, was again his laconic reply. And you must have some water, my dear fellow. What is that flying about? Who wants a dead cert for the Gold cup?",
"sentences_02_loud" : "It might happen, he added with an involuntary smile. It is sold, sir, was again his laconic reply. And you must have some water, my dear fellow. What is that flying about? Who wants a dead cert for the Gold cup?",
"sentences_02_lowpitch" : "It might happen, he added with an involuntary smile. It is sold, sir, was again his laconic reply. And you must have some water, my dear fellow. What is that flying about? Who wants a dead cert for the Gold cup?",
"sentences_02_regular" : "It might happen, he added with an involuntary smile. It is sold, sir, was again his laconic reply. And you must have some water, my dear fellow. What is that flying about? Who wants a dead cert for the Gold cup?",
"sentences_02_slow" : "It might happen, he added with an involuntary smile. It is sold, sir, was again his laconic reply. And you must have some water, my dear fellow. What is that flying about? Who wants a dead cert for the Gold cup?",
"sentences_02_whisper" : "It might happen, he added with an involuntary smile. It is sold, sir, was again his laconic reply. And you must have some water, my dear fellow. What is that flying about? Who wants a dead cert for the Gold cup?",
"sentences_03_whisper" : "Had it been but one, it had been easy. We have boxed the compass among us. I shall rush out and prevent it. All that is mean slander. The doctor seemed tired and in a hurry.",
"sentences_04_whisper" : "I only heard it last night. We had now got into the month of March. But go thy ways; I had forgot. Conceited fellow with his waxed up moustache! Anne's unhappiness continued for a week.",
"sentences_05_loud" : "In fact, the count's face brightened. For God's sake, talk to her. In what an amiable light does this place him! Take me out of my way. I heard many things in hell.",
"sentences_06_loud" : "Yes; but we do not invite people of fashion. You see what he writes. Silent with awe and pity I went to her bedside. Happy to say, I never knew him. Birthdays are of no importance to a rational being.",
"sentences_07_slow" : "But it may all be put in two words. Clear up the room, the sick man said with effort. He was still in sight. He delayed; he seemed almost afraid of something. Then they carried me in.",
"sentences_08_slow" : "But I have never been presented. But we were only in fun! Now, look at that third name. And serve them both right, too. Good glass of burgundy take away that.",
"sentences_09_fast" : "And it seemed to her that God heard her prayer. My word, I admire you. I also have a pious visit to pay. She has promised to come on the twentieth. I want to tell you something.",
"sentences_10_fast" : "Oh, sir, it will break bones. I am very glad to see you. This question absorbed all his mental powers. Before going away forever, I'll tell him all. I told you it was mother.",
"sentences_11_highpitch" : "You're all in good spirits. They might retreat and leave the pickets. But I like sentimental people. Our potato crop is very good this year. Why is the chestnut on the right?",
"sentences_12_highpitch" : "His room was on the first floor. I have had a pattern in my hand. The knocking still continued and grew louder. May my sorrows ever shun the light. How must I arrange it, then?",
"sentences_13_lowpitch" : "Just read it out to me. I shall take your advice in every particular. What mortal imagination could conceive it? The gate was again hidden by smoke. After a while I left him.",
"sentences_14_lowpitch" : "There was a catch in her breath. They told me, but I didn't understand. What a cabin it is. A cry of joy broke from his lips. He had obviously prepared the sentence beforehand.",
"sentences_15_regular" : "They were all sitting in her room. So that's how it stands. He did not know why he embraced it. Why don't you speak, cousin? I didn't tell a tale.",
"sentences_16_regular" : "My head aches dreadfully now. Not to say every word. I have only found out. He is trying to discover something. I have done my duty.",
"sentences_17_regular" : "I always had a value for him. He is a deceiver and a villain. But those tears were pleasant to them both. She conquered her fears, and spoke. Oh, he couldn't overhear me at the door.",
"sentences_18_regular" : "How could I have said it more directly? She remembered her oath. My kingdom for a drink! Have they caught the little girl and the boy? Then she gave him the dry bread.",
"sentences_19_regular" : "Your sister is given to government. Water was being sprinkled on his face. The clumsy things are dear. He jumped up and sat on the sofa. How do you know her?",
"sentences_20_regular" : "I never could guess a riddle in my life. The expression of her face was cold. Besides, what on earth could happen to you? Allow me to give you a piece of advice. This must be stopped at once.",
"sentences_21_regular" : "The lawyer was right about that. You are fond of fighting. Every word is so deep. So you were never in London before? Death is now, perhaps, striking a fourth blow.",
"sentences_22_regular" : "It seemed that sleep and night had resumed their empire. The snowstorm was still raging. But we'll talk later on. Take the baby, Mum, and give me your book. The doctor gave him his hand.",
"sentences_23_regular" : "It is, nevertheless, conclusive to my mind. Give this to the countess. It is only a question of a few hours. No, we don't keep a cat. The cool evening air refreshed him.",
"sentences_24_regular" : "You can well enjoy the evening now. We'll make up for it now. The weakness of a murderer. But they wouldn't leave me alone. The telegram was from his wife."
}
root = "/mount/resources/speech/corpora/EARS/"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
for speaker in os.listdir(root):
if os.path.isdir(os.path.join(root, speaker)):
for sentence_type in transcript_for_ears:
path = os.path.join(root, speaker, sentence_type + ".wav")
path_to_transcript[path] = transcript_for_ears[sentence_type]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_mls_english(re_cache=False):
lang = "english"
root = f"/mount/resources/speech/corpora/MultiLingLibriSpeech/mls_{lang}/train"
cache_path = f"/mount/resources/speech/corpora/MultiLingLibriSpeech/mls_{lang}/train/pttd_cache.pt"
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_multi_ling_librispeech_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_gigaspeech(re_cache=False):
root = "/mount/resources/speech/corpora/GigaSpeech/"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(os.path.join(root, "transcripts_only_clean_samples.txt"), "r", encoding="utf8") as file:
lookup = file.read()
for line in lookup.split("\n"):
if line.strip() != "":
fields = line.split("\t")
norm_transcript = fields[1]
wav_path = fields[0]
path_to_transcript[wav_path] = norm_transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_elizabeth(re_cache=False):
root = "/mount/resources/speech/corpora/MAILabs_british_single_speaker_elizabeth"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
for el in os.listdir(root):
if os.path.isdir(os.path.join(root, el)):
with open(os.path.join(root, el, "metadata.csv"), "r", encoding="utf8") as file:
lookup = file.read()
for line in lookup.split("\n"):
if line.strip() != "":
norm_transcript = line.split("|")[2]
wav_path = os.path.join(root, el, "wavs", line.split("|")[0] + ".wav")
if os.path.exists(wav_path):
path_to_transcript[wav_path] = norm_transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_nancy(re_cache=False):
root = "/mount/resources/speech/corpora/NancyKrebs"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(os.path.join(root, "metadata.csv"), "r", encoding="utf8") as file:
lookup = file.read()
for line in lookup.split("\n"):
if line.strip() != "":
norm_transcript = line.split("|")[1]
wav_path = os.path.join(root, "wav", line.split("|")[0] + ".wav")
if os.path.exists(wav_path):
path_to_transcript[wav_path] = norm_transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_integration_test(re_cache=True):
root = "/mount/resources/speech/corpora/NancyKrebs"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(os.path.join(root, "metadata.csv"), "r", encoding="utf8") as file:
lookup = file.read()
for line in lookup.split("\n")[:500]:
if line.strip() != "":
norm_transcript = line.split("|")[1]
wav_path = os.path.join(root, "wav", line.split("|")[0] + ".wav")
if os.path.exists(wav_path):
path_to_transcript[wav_path] = norm_transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_CREMA_D(re_cache=False):
root = "/mount/resources/speech/corpora/CREMA_D/"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
identifier_to_sent = {"IEO": "It's eleven o'clock.",
"TIE": "That is exactly what happened.",
"IOM": "I'm on my way to the meeting.",
"IWW": "I wonder what this is about.",
"TAI": "The airplane is almost full.",
"MTI": "Maybe tomorrow it will be cold.",
"IWL": "I would like a new alarm clock.",
"ITH": "I think, I have a doctor's appointment.",
"DFA": "Don't forget a jacket.",
"ITS": "I think, I've seen this before.",
"TSI": "The surface is slick.",
"WSI": "We'll stop in a couple of minutes."}
path_to_transcript = dict()
for file in os.listdir(root):
if file.endswith(".wav"):
path_to_transcript[root + file] = identifier_to_sent[file.split("_")[1]]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_EmoV_DB(re_cache=False):
root = "/mount/resources/speech/corpora/EmoV_DB/"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(os.path.join(root, "labels.txt"), "r", encoding="utf8") as file:
lookup = file.read()
identifier_to_sent = dict()
for line in lookup.split("\n"):
if line.strip() != "":
identifier_to_sent[line.split()[0]] = " ".join(line.split()[1:])
for file in os.listdir(root):
if file.endswith(".wav"):
path_to_transcript[root + file] = identifier_to_sent[file[-14:-10]]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_ryanspeech(re_cache=False):
root = "/mount/resources/speech/corpora/RyanSpeech"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript_dict = dict()
with open(root + "/metadata.csv", mode="r", encoding="utf8") as f:
transcripts = f.read().split("\n")
for transcript in transcripts:
if transcript.strip() != "":
parsed_line = transcript.split("|")
audio_file = f"{root}/wavs/{parsed_line[0]}.wav"
path_to_transcript_dict[audio_file] = parsed_line[2]
torch.save(path_to_transcript_dict, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_RAVDESS(re_cache=False):
root = "/mount/resources/speech/corpora/RAVDESS"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript_dict = dict()
for speaker_dir in os.listdir(root):
for audio_file in os.listdir(os.path.join(root, speaker_dir)):
if audio_file.split("-")[4] == "01":
path_to_transcript_dict[os.path.join(root, speaker_dir, audio_file)] = "Kids are talking by the door."
else:
path_to_transcript_dict[os.path.join(root, speaker_dir, audio_file)] = "Dogs are sitting by the door."
torch.save(path_to_transcript_dict, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_ESDS(re_cache=False):
root = "/mount/resources/speech/corpora/Emotional_Speech_Dataset_Singapore"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript_dict = dict()
for speaker_dir in os.listdir(root):
if speaker_dir.startswith("00"):
if int(speaker_dir) > 10:
with open(f"{root}/{speaker_dir}/fixed_unicode.txt", mode="r", encoding="utf8") as f:
transcripts = f.read()
for line in transcripts.replace("\n\n", "\n").replace(",", ", ").split("\n"):
if line.strip() != "":
filename, text, emo_dir = line.split("\t")
filename = speaker_dir + "_" + filename.split("_")[1]
path_to_transcript_dict[f"{root}/{speaker_dir}/{emo_dir}/{filename}.wav"] = text
torch.save(path_to_transcript_dict, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_nvidia_hifitts(re_cache=False):
root = "/mount/resources/speech/corpora/hi_fi_tts_v0"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
transcripts = list()
import json
for jpath in [f"{root}/6097_manifest_clean_dev.json",
f"{root}/6097_manifest_clean_test.json",
f"{root}/6097_manifest_clean_train.json",
f"{root}/9017_manifest_clean_dev.json",
f"{root}/9017_manifest_clean_test.json",
f"{root}/9017_manifest_clean_train.json",
f"{root}/92_manifest_clean_dev.json",
f"{root}/92_manifest_clean_test.json",
f"{root}/92_manifest_clean_train.json"]:
with open(jpath, encoding='utf-8', mode='r') as jfile:
for line in jfile.read().split("\n"):
if line.strip() != "":
transcripts.append(json.loads(line))
for transcript in transcripts:
path = transcript["audio_filepath"]
norm_text = transcript["text_normalized"]
path_to_transcript[f"{root}/{path}"] = norm_text
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_blizzard_2013(re_cache=False):
root = "/mount/resources/speech/corpora/Blizzard2013/train/segmented/"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(root + "prompts.gui", encoding="utf8") as f:
transcriptions = f.read()
blocks = transcriptions.split("||\n")
for block in blocks:
trans_lines = block.split("\n")
if trans_lines[0].strip() != "":
transcript = trans_lines[1].replace("@", "").replace("#", ",").replace("|", "").replace(";", ",").replace(
":", ",").replace(" 's", "'s").replace(", ,", ",").replace(" ", " ").replace(" ,", ",").replace(" .",
".").replace(
" ?", "?").replace(" !", "!").rstrip(" ,")
path_to_transcript[root + "wavn/" + trans_lines[0] + ".wav"] = transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_vctk(re_cache=False):
root = "/mount/resources/speech/corpora/VCTK"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
for transcript_dir in os.listdir("/mount/resources/speech/corpora/VCTK/txt"):
for transcript_file in os.listdir(f"/mount/resources/speech/corpora/VCTK/txt/{transcript_dir}"):
if transcript_file.endswith(".txt"):
with open(f"/mount/resources/speech/corpora/VCTK/txt/{transcript_dir}/" + transcript_file, 'r',
encoding='utf8') as tf:
transcript = tf.read()
wav_path = f"/mount/resources/speech/corpora/VCTK/wav48_silence_trimmed/{transcript_dir}/" + transcript_file.rstrip(
".txt") + "_mic2.flac"
if os.path.exists(wav_path):
path_to_transcript[wav_path] = transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_libritts_all_clean(re_cache=False):
root = "/mount/resources/speech/corpora/LibriTTS_R/"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_train = "/mount/resources/speech/corpora/LibriTTS_R/" # using all files from the "clean" subsets from LibriTTS-R https://arxiv.org/abs/2305.18802
path_to_transcript = dict()
for speaker in os.listdir(path_train):
for chapter in os.listdir(os.path.join(path_train, speaker)):
for file in os.listdir(os.path.join(path_train, speaker, chapter)):
if file.endswith("normalized.txt"):
with open(os.path.join(path_train, speaker, chapter, file), 'r', encoding='utf8') as tf:
transcript = tf.read()
wav_file = file.split(".")[0] + ".wav"
path_to_transcript[os.path.join(path_train, speaker, chapter, wav_file)] = transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_libritts_other500(re_cache=False):
root = "/mount/resources/asr-data/LibriTTS/train-other-500"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_train = "/mount/resources/asr-data/LibriTTS/train-other-500"
path_to_transcript = dict()
for speaker in os.listdir(path_train):
for chapter in os.listdir(os.path.join(path_train, speaker)):
for file in os.listdir(os.path.join(path_train, speaker, chapter)):
if file.endswith("normalized.txt"):
with open(os.path.join(path_train, speaker, chapter, file), 'r', encoding='utf8') as tf:
transcript = tf.read()
wav_file = file.split(".")[0] + ".wav"
path_to_transcript[os.path.join(path_train, speaker, chapter, wav_file)] = transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_ljspeech(re_cache=False):
root = "/mount/resources/speech/corpora/LJSpeech/"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
for transcript_file in os.listdir("/mount/resources/speech/corpora/LJSpeech/16kHz/txt"):
with open("/mount/resources/speech/corpora/LJSpeech/16kHz/txt/" + transcript_file, 'r', encoding='utf8') as tf:
transcript = tf.read()
wav_path = "/mount/resources/speech/corpora/LJSpeech/16kHz/wav/" + transcript_file.rstrip(".txt") + ".wav"
path_to_transcript[wav_path] = transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_jenny(re_cache=False):
"""
https://www.kaggle.com/datasets/noml4u/jenny-tts-dataset
https://github.com/dioco-group/jenny-tts-dataset
Dataset of Speaker Jenny (Dioco) with an Irish accent
"""
root = "/mount/resources/speech/corpora/Jenny/"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open("/mount/resources/speech/corpora/Jenny/metadata.csv", encoding="utf8") as f:
transcriptions = f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript["/mount/resources/speech/corpora/Jenny/" + line.split("|")[0] + "_silence.flac"] = line.split("|")[1]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# GERMAN
def build_path_to_transcript_dict_mls_german(re_cache=False):
lang = "german"
root = f"/mount/resources/speech/corpora/MultiLingLibriSpeech/mls_{lang}/train"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_multi_ling_librispeech_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_karlsson(re_cache=False):
root = "/mount/resources/speech/corpora/HUI_German/Karlsson"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_hui_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_eva(re_cache=False):
root = "/mount/resources/speech/corpora/HUI_German/Eva"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_hui_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_bernd(re_cache=False):
root = "/mount/resources/speech/corpora/HUI_German/Bernd"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_hui_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_friedrich(re_cache=False):
root = "/mount/resources/speech/corpora/HUI_German/Friedrich"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_hui_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_hokus(re_cache=False):
root = "/mount/resources/speech/corpora/HUI_German/Hokus"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_hui_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_hui_others(re_cache=False):
root = "/mount/resources/speech/corpora/HUI_German/others"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
pttd = dict()
for speaker in os.listdir(root):
pttd.update(build_path_to_transcript_dict_hui_template(root=f"{root}/{speaker}"))
torch.save(pttd, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_thorsten_neutral(re_cache=False):
root = "/mount/resources/speech/corpora/ThorstenDatasets/thorsten-de_v03"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(root + "/metadata_train.csv", encoding="utf8") as f:
transcriptions = f.read()
with open(root + "/metadata_val.csv", encoding="utf8") as f:
transcriptions += "\n" + f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript[root + "/wavs/" + line.split("|")[0] + ".wav"] = \
line.split("|")[1]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_thorsten_2022_10(re_cache=False):
root = "/mount/resources/speech/corpora/ThorstenDatasets/ThorstenVoice-Dataset_2022.10"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(root + "/metadata_train.csv", encoding="utf8") as f:
transcriptions = f.read()
with open(root + "/metadata_dev.csv", encoding="utf8") as f:
transcriptions += "\n" + f.read()
with open(root + "/metadata_test.csv", encoding="utf8") as f:
transcriptions += "\n" + f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript[root + "/wavs/" + line.split("|")[0] + ".wav"] = \
line.split("|")[1]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_thorsten_emotional(re_cache=False):
root = "/mount/resources/speech/corpora/ThorstenDatasets/thorsten-emotional_v02"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(root + "/thorsten-emotional-metadata.csv", encoding="utf8") as f:
transcriptions = f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript[root + "/amused/" + line.split("|")[0] + ".wav"] = line.split("|")[1]
path_to_transcript[root + "/angry/" + line.split("|")[0] + ".wav"] = line.split("|")[1]
path_to_transcript[root + "/disgusted/" + line.split("|")[0] + ".wav"] = line.split("|")[1]
path_to_transcript[root + "/neutral/" + line.split("|")[0] + ".wav"] = line.split("|")[1]
path_to_transcript[root + "/sleepy/" + line.split("|")[0] + ".wav"] = line.split("|")[1]
path_to_transcript[root + "/surprised/" + line.split("|")[0] + ".wav"] = line.split("|")[1]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# FRENCH
def build_path_to_transcript_dict_mls_french(re_cache=False):
lang = "french"
root = f"/mount/resources/speech/corpora/MultiLingLibriSpeech/mls_{lang}/train"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_multi_ling_librispeech_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_blizzard2023_ad_silence_removed(re_cache=False):
root = "/mount/resources/speech/corpora/Blizzard2023/AD_silence_removed"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(os.path.join(root, "transcript.tsv"), "r", encoding="utf8") as file:
lookup = file.read()
for line in lookup.split("\n"):
if line.strip() != "":
norm_transcript = line.split("\t")[1]
wav_path = os.path.join(root, line.split("\t")[0].split("/")[-1])
if os.path.exists(wav_path):
path_to_transcript[wav_path] = norm_transcript.replace("§", "").replace("#", "").replace("~", "").replace(" »", '"').replace("« ", '"').replace("»", '"').replace("«", '"')
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_blizzard2023_neb_silence_removed(re_cache=False):
root = "/mount/resources/speech/corpora/Blizzard2023/NEB_silence_removed"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(os.path.join(root, "transcript.tsv"), "r", encoding="utf8") as file:
lookup = file.read()
for line in lookup.split("\n"):
if line.strip() != "":
norm_transcript = line.split("\t")[1]
wav_path = os.path.join(root, line.split("\t")[0].split("/")[-1])
if os.path.exists(wav_path):
path_to_transcript[wav_path] = norm_transcript.replace("§", "").replace("#", "").replace("~", "").replace(" »", '"').replace("« ", '"').replace("»", '"').replace("«", '"')
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_blizzard2023_neb_e_silence_removed(re_cache=False):
root = "/mount/resources/speech/corpora/Blizzard2023/enhanced_NEB_subset_silence_removed"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(os.path.join(root, "transcript.tsv"), "r", encoding="utf8") as file:
lookup = file.read()
for line in lookup.split("\n"):
if line.strip() != "":
norm_transcript = line.split("\t")[1]
wav_path = os.path.join(root, line.split("\t")[0].split("/")[-1])
if os.path.exists(wav_path):
path_to_transcript[wav_path] = norm_transcript.replace("§", "").replace("#", "").replace("~", "").replace(" »", '"').replace("« ", '"').replace("»", '"').replace("«", '"')
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_synpaflex_norm_subset(re_cache=False):
"""
Contributed by https://github.com/tomschelsen
"""
root = "/mount/resources/speech/corpora/synpaflex-corpus/5/v0.1/"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
for text_path in glob.iglob(os.path.join(root, "**/*_norm.txt"), recursive=True):
with open(text_path, "r", encoding="utf8") as file:
norm_transcript = file.read()
path_obj = Path(text_path)
wav_path = str((path_obj.parent.parent / path_obj.name[:-9]).with_suffix(".wav"))
if Path(wav_path).exists():
path_to_transcript[wav_path] = norm_transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_siwis_subset(re_cache=False):
"""
Contributed by https://github.com/tomschelsen
"""
root = "/mount/resources/speech/corpora/SiwisFrenchSpeechSynthesisDatabase/"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
# part4 and part5 are not segmented
sub_dirs = ["part1", "part2", "part3"]
path_to_transcript = dict()
for sd in sub_dirs:
for text_path in glob.iglob(os.path.join(root, "text", sd, "*.txt")):
with open(text_path, "r", encoding="utf8") as file:
norm_transcript = file.read()
path_obj = Path(text_path)
wav_path = str((path_obj.parent.parent.parent / "wavs" / sd / path_obj.stem).with_suffix(".wav"))
if Path(wav_path).exists():
path_to_transcript[wav_path] = norm_transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_css10fr(re_cache=False):
language = "french"
root = f"/mount/resources/speech/corpora/CSS10/{language}"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(f"/mount/resources/speech/corpora/CSS10/{language}/transcript.txt", encoding="utf8") as f:
transcriptions = f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript[f"/mount/resources/speech/corpora/CSS10/{language}/{line.split('|')[0]}"] = \
line.split("|")[2]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# SPANISH
def build_path_to_transcript_dict_mls_spanish(re_cache=False):
lang = "spanish"
root = f"/mount/resources/speech/corpora/MultiLingLibriSpeech/mls_{lang}/train"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_multi_ling_librispeech_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_css10es(re_cache=False):
language = "spanish"
root = f"/mount/resources/speech/corpora/CSS10/{language}"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(f"/mount/resources/speech/corpora/CSS10/{language}/transcript.txt", encoding="utf8") as f:
transcriptions = f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript[f"/mount/resources/speech/corpora/CSS10/{language}/{line.split('|')[0]}"] = \
line.split("|")[2]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_spanish_blizzard_train(re_cache=False):
root = "/mount/resources/speech/corpora/Blizzard2021/spanish_blizzard_release_2021_v2/hub"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(os.path.join(root, "train_text.txt"), "r", encoding="utf8") as file:
lookup = file.read()
for line in lookup.split("\n"):
if line.strip() != "":
norm_transcript = line.split("\t")[1]
wav_path = os.path.join(root, "train_wav", line.split("\t")[0] + ".wav")
if os.path.exists(wav_path):
path_to_transcript[wav_path] = norm_transcript
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# PORTUGUESE
def build_path_to_transcript_dict_mls_portuguese(re_cache=False):
lang = "portuguese"
root = f"/mount/resources/speech/corpora/MultiLingLibriSpeech/mls_{lang}/train"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_multi_ling_librispeech_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# POLISH
def build_path_to_transcript_dict_mls_polish(re_cache=False):
lang = "polish"
root = f"/mount/resources/speech/corpora/MultiLingLibriSpeech/mls_{lang}/train"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_multi_ling_librispeech_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# ITALIAN
def build_path_to_transcript_dict_mls_italian(re_cache=False):
lang = "italian"
root = f"/mount/resources/speech/corpora/MultiLingLibriSpeech/mls_{lang}/train"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_multi_ling_librispeech_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# DUTCH
def build_path_to_transcript_dict_mls_dutch(re_cache=False):
lang = "dutch"
root = f"/mount/resources/speech/corpora/MultiLingLibriSpeech/mls_{lang}/train"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = build_path_to_transcript_dict_multi_ling_librispeech_template(root=root)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_css10nl(re_cache=False):
language = "dutch"
root = f"/mount/resources/speech/corpora/CSS10/{language}"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(f"/mount/resources/speech/corpora/CSS10/{language}/transcript.txt", encoding="utf8") as f:
transcriptions = f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript[f"/mount/resources/speech/corpora/CSS10/{language}/{line.split('|')[0]}"] = \
line.split("|")[2]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# GREEK
def build_path_to_transcript_dict_css10el(re_cache=False):
language = "greek"
root = f"/mount/resources/speech/corpora/CSS10/{language}"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(f"/mount/resources/speech/corpora/CSS10/{language}/transcript.txt", encoding="utf8") as f:
transcriptions = f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript[f"/mount/resources/speech/corpora/CSS10/{language}/{line.split('|')[0]}"] = \
line.split("|")[2]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# FINNISH
def build_path_to_transcript_dict_css10fi(re_cache=False):
language = "finnish"
root = f"/mount/resources/speech/corpora/CSS10/{language}"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(f"/mount/resources/speech/corpora/CSS10/{language}/transcript.txt", encoding="utf8") as f:
transcriptions = f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript[f"/mount/resources/speech/corpora/CSS10/{language}/{line.split('|')[0]}"] = \
line.split("|")[2]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# VIETNAMESE
def build_path_to_transcript_dict_VIVOS_viet(re_cache=False):
root = "/mount/resources/speech/corpora/VIVOS_vietnamese/train"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript_dict = dict()
with open(root + "/prompts.txt", mode="r", encoding="utf8") as f:
transcripts = f.read().split("\n")
for transcript in transcripts:
if transcript.strip() != "":
parsed_line = transcript.split(" ")
audio_file = f"{root}/waves/{parsed_line[0][:10]}/{parsed_line[0]}.wav"
path_to_transcript_dict[audio_file] = " ".join(parsed_line[1:]).lower()
torch.save(path_to_transcript_dict, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_vietTTS(re_cache=False):
root = "/mount/resources/speech/corpora/VietTTS"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(root + "/meta_data.tsv", encoding="utf8") as f:
transcriptions = f.read()
for line in transcriptions.split("\n"):
if line.strip() != "":
parsed_line = line.split(".wav")
audio_path = parsed_line[0]
transcript = parsed_line[1]
path_to_transcript[os.path.join(root, audio_path + ".wav")] = transcript.strip()
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# CHINESE
def build_path_to_transcript_dict_aishell3(re_cache=False):
root = "/mount/resources/speech/corpora/aishell3/train"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript_dict = dict()
with open(root + "/label_train-set.txt", mode="r", encoding="utf8") as f:
transcripts = f.read().replace("$", "").replace("%", " ").split("\n")
for transcript in transcripts:
if transcript.strip() != "" and not transcript.startswith("#"):
parsed_line = transcript.split("|")
audio_file = f"{root}/wav/{parsed_line[0][:7]}/{parsed_line[0]}.wav"
kanji = parsed_line[2]
path_to_transcript_dict[audio_file] = kanji
torch.save(path_to_transcript_dict, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_css10cmn(re_cache=False):
language = "chinese"
root = f"/mount/resources/speech/corpora/CSS10/{language}"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open("/mount/resources/speech/corpora/CSS10/chinese/transcript.txt", encoding="utf8") as f:
transcriptions = f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript["/mount/resources/speech/corpora/CSS10/chinese/" + line.split("|")[0]] = line.split("|")[2]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# RUSSIAN
def build_path_to_transcript_dict_css10ru(re_cache=False):
language = "russian"
root = f"/mount/resources/speech/corpora/CSS10/{language}"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(f"/mount/resources/speech/corpora/CSS10/{language}/transcript.txt", encoding="utf8") as f:
transcriptions = f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript[f"/mount/resources/speech/corpora/CSS10/{language}/{line.split('|')[0]}"] = \
line.split("|")[2]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# HUNGARIAN
def build_path_to_transcript_dict_css10hu(re_cache=False):
language = "hungarian"
root = f"/mount/resources/speech/corpora/CSS10/{language}"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
language = "hungarian"
with open(f"/mount/resources/speech/corpora/CSS10/{language}/transcript.txt", encoding="utf8") as f:
transcriptions = f.read()
trans_lines = transcriptions.split("\n")
for line in trans_lines:
if line.strip() != "":
path_to_transcript[f"/mount/resources/speech/corpora/CSS10/{language}/{line.split('|')[0]}"] = \
line.split("|")[2]
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# JAPANESE
def build_path_to_transcript_dict_captain_japanese(re_cache=False):
root = "/mount/resources/speech/corpora/HiFiCaptainJapanese"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
with open(root + "/male/text/train_parallel.txt", encoding="utf8") as f:
transcriptions = f.read()
for line in transcriptions.split("\n"):
if line.strip() != "":
parsed_line = line.split()
audio_path = parsed_line[0]
transcript = parsed_line[1]
audio_path = os.path.join(root, "male", "wav", "train_parallel", audio_path + ".wav")
if os.path.exists(audio_path):
path_to_transcript[audio_path] = transcript.strip()
else:
print(f"{audio_path} does not seem to exist!")
with open(root + "/female/text/train_parallel.txt", encoding="utf8") as f:
transcriptions = f.read()
for line in transcriptions.split("\n"):
if line.strip() != "":
parsed_line = line.split()
audio_path = parsed_line[0]
transcript = parsed_line[1]
audio_path = os.path.join(root, "female", "wav", "train_parallel", audio_path + ".wav")
if os.path.exists(audio_path):
path_to_transcript[audio_path] = transcript.strip()
else:
print(f"{audio_path} does not seem to exist!")
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_jvs(re_cache=False):
root = "/mount/resources/speech/corpora/JVS/jvs_ver1"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = dict()
for data_dir in os.listdir(root):
if os.path.isdir(os.path.join(root, data_dir)):
for data_type in ["parallel100", "nonpara30"]:
with open(os.path.join(root, data_dir, data_type, "transcripts_utf8.txt"), encoding="utf8") as f:
transcriptions = f.read()
for line in transcriptions.split("\n"):
if line.strip() != "":
parsed_line = line.split(":")
audio_path = parsed_line[0]
transcript = parsed_line[1]
audio_path = os.path.join(root, data_dir, data_type, "wav24kHz16bit", audio_path + ".wav")
if os.path.exists(audio_path):
path_to_transcript[audio_path] = transcript.strip()
else:
print(f"{audio_path} does not seem to exist!")
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
# OTHER
def build_path_to_transcript_dict_indicvoices_Assamese(re_cache=False):
language = "Assamese"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Bengali(re_cache=False):
language = "Bengali"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Bodo(re_cache=False):
language = "Bodo"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Dogri(re_cache=False):
language = "Dogri"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Gujarati(re_cache=False):
language = "Gujarati"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Hindi(re_cache=False):
language = "Hindi"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Kannada(re_cache=False):
language = "Kannada"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Kashmiri(re_cache=False):
language = "Kashmiri"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Konkani(re_cache=False):
language = "Konkani"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Maithili(re_cache=False):
language = "Maithili"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Malayalam(re_cache=False):
language = "Malayalam"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Manipuri(re_cache=False):
language = "Manipuri"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Marathi(re_cache=False):
language = "Marathi"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Nepali(re_cache=False):
language = "Nepali"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Odia(re_cache=False):
language = "Odia"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Punjabi(re_cache=False):
language = "Punjabi"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Sanskrit(re_cache=False):
language = "Sanskrit"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Santali(re_cache=False):
language = "Santali"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Sindhi(re_cache=False):
language = "Sindhi"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Tamil(re_cache=False):
language = "Tamil"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Telugu(re_cache=False):
language = "Telugu"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_indicvoices_Urdu(re_cache=False):
language = "Urdu"
root = f"/mount/resources/speech/corpora/IndicVoicesR"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
path_to_transcript = indic_voices_template(root=root, lang=language)
torch.save(path_to_transcript, cache_path)
return torch.load(cache_path)
def build_file_list_singing_voice_audio_database(re_cache=False):
root = "/mount/resources/speech/corpora/singing_voice_audio_dataset/monophonic"
cache_path = os.path.join(root, "pttd_cache.pt")
if not os.path.exists(cache_path) or re_cache:
file_list = list()
for corw in os.listdir(root):
for singer in os.listdir(os.path.join(root, corw)):
for audio in os.listdir(os.path.join(root, corw, singer)):
file_list.append(os.path.join(root, corw, singer, audio))
torch.save(file_list, cache_path)
return torch.load(cache_path)
def build_path_to_transcript_dict_nst_norwegian():
root = '/resources/speech/corpora/NST_norwegian/pcm/cs'
path_to_transcript = dict()
audio_paths = sorted(list(Path(root).glob('*.pcm')))
i = 0
with open(Path(root, 'SCRIPTS/CTTS_core'), encoding='latin-1') as f:
for line in f:
transcript = line.strip().replace('\xad', '')
path = str(audio_paths[i].absolute())
path_to_transcript[path] = transcript
i += 1
return path_to_transcript
def build_path_to_transcript_dict_nst_swedish():
root = '/resources/speech/corpora/NST_swedish/sw_pcms'
path_to_transcript = dict()
audio_paths = sorted(list(Path(root, 'mf').glob('*.pcm')))
audio_paths.insert(4154, None)
audio_paths.insert(5144, None)
i = 0
with open(Path(root, 'scripts/mf/sw_all'), encoding='latin-1') as f:
for line in f:
if i == 4154 or i == 5144:
i += 1
continue
transcript = line.strip().replace('\xad', '')
path = str(audio_paths[i].absolute())
path_to_transcript[path] = transcript
i += 1
return path_to_transcript
def build_path_to_transcript_dict_nchlt_afr():
root = '/resources/speech/corpora/nchlt_afr'
return build_path_to_transcript_dict_nchlt_template(root, lang_code='afr')
def build_path_to_transcript_dict_nchlt_nbl():
root = '/resources/speech/corpora/nchlt_nbl'
return build_path_to_transcript_dict_nchlt_template(root, lang_code='nbl')
def build_path_to_transcript_dict_nchlt_nso():
root = '/resources/speech/corpora/nchlt_nso'
return build_path_to_transcript_dict_nchlt_template(root, lang_code='nso')
def build_path_to_transcript_dict_nchlt_sot():
root = '/resources/speech/corpora/nchlt_sot'
return build_path_to_transcript_dict_nchlt_template(root, lang_code='sot')
def build_path_to_transcript_dict_nchlt_ssw():
root = '/resources/speech/corpora/nchlt_ssw'
return build_path_to_transcript_dict_nchlt_template(root, lang_code='ssw')
def build_path_to_transcript_dict_nchlt_tsn():
root = '/resources/speech/corpora/nchlt_tsn'
return build_path_to_transcript_dict_nchlt_template(root, lang_code='tsn')
def build_path_to_transcript_dict_nchlt_tso():
root = '/resources/speech/corpora/nchlt_tso'
return build_path_to_transcript_dict_nchlt_template(root, lang_code='tso')
def build_path_to_transcript_dict_nchlt_ven():
root = '/resources/speech/corpora/nchlt_ven'
return build_path_to_transcript_dict_nchlt_template(root, lang_code='ven')
def build_path_to_transcript_dict_nchlt_xho():
root = '/resources/speech/corpora/nchlt_xho'
return build_path_to_transcript_dict_nchlt_template(root, lang_code='xho')
def build_path_to_transcript_dict_nchlt_zul():
root = '/resources/speech/corpora/nchlt_zul'
return build_path_to_transcript_dict_nchlt_template(root, lang_code='zul')
def build_path_to_transcript_dict_nchlt_template(root, lang_code):
path_to_transcript = dict()
base_dir = Path(root).parent
for split in ['trn', 'tst']:
tree = ET.parse(f'{root}/transcriptions/nchlt_{lang_code}.{split}.xml')
tree_root = tree.getroot()
for rec in tree_root.iter('recording'):
transcript = rec.find('orth').text
if '[s]' in transcript:
continue
path = str(base_dir / rec.get('audio'))
path_to_transcript[path] = transcript
return path_to_transcript
def build_path_to_transcript_dict_bibletts_akuapem_twi():
path_to_transcript = dict()
root = '/resources/speech/corpora/BibleTTS/akuapem-twi'
for split in ['train', 'dev', 'test']:
for book in Path(root, split).glob('*'):
for textfile in book.glob('*.txt'):
with open(textfile, 'r', encoding='utf-8') as f:
text = ' '.join([line.strip() for line in f]) # should usually be only one line anyway
path_to_transcript[textfile.with_suffix('.flac')] = text
return path_to_transcript
def build_path_to_transcript_dict_bembaspeech():
root = '/resources/speech/corpora/BembaSpeech/bem'
path_to_transcript = dict()
for split in ['train', 'dev', 'test']:
with open(Path(root, f'{split}.tsv'), 'r', encoding='utf-8') as f:
reader = DictReader(f, delimiter='\t')
for row in reader:
path_to_transcript[str(Path(root, 'audio', row['audio']))] = row['sentence']
return path_to_transcript
def build_path_to_transcript_dict_alffa_sw():
root = '/resources/speech/corpora/ALFFA/data_broadcastnews_sw/data'
path_to_transcript = build_path_to_transcript_dict_kaldi_template(root=root, split='train', replace_in_path=('asr_swahili/data/', ''))
path_to_transcript.update(build_path_to_transcript_dict_kaldi_template(root=root, split='test', replace_in_path=('/my_dir/wav', 'test/wav5')))
return path_to_transcript
def build_path_to_transcript_dict_alffa_am():
root = '/resources/speech/corpora/ALFFA/data_readspeech_am/data'
path_to_transcript = build_path_to_transcript_dict_kaldi_template(root=root, split='train', replace_in_path=('/home/melese/kaldi/data/', ''))
path_to_transcript.update(build_path_to_transcript_dict_kaldi_template(root=root, split='test', replace_in_path=('/home/melese/kaldi/data/', '')))
return path_to_transcript
def build_path_to_transcript_dict_alffa_wo():
root = '/resources/speech/corpora/ALFFA/data_readspeech_wo/data'
path_to_transcript = dict()
for split in ['train', 'dev', 'test']:
with open(Path(root, split, 'text'), 'r', encoding='utf-8') as f:
for line in f:
line = line.strip().split()
file = line[0]
text = ' '.join(line[1:])
number = file.split('_')[1]
path_to_transcript[str(Path(root, split, number, f'{file}.wav'))] = text
return path_to_transcript
def build_path_to_transcript_dict_malayalam():
root = '/resources/speech/corpora/malayalam'
path_to_transcript = dict()
for gender in ['female', 'male']:
with open(Path(root, f'line_index_{gender}.tsv'), 'r', encoding='utf-8') as f:
for line in f:
file, text = line.strip().split('\t')
path_to_transcript[str(Path(root, gender, f'{file}.wav'))] = text
return path_to_transcript
def build_path_to_transcript_dict_msc():
root = '/resources/speech/corpora/msc_reviewed_speech'
path_to_transcript = dict()
with open(Path(root, f'metadata.tsv'), 'r', encoding='utf-8') as f:
reader = DictReader(f, delimiter='\t')
for row in reader:
path_to_transcript[str(Path(root, row['speechpath']))] = row['transcript']
return path_to_transcript
def build_path_to_transcript_dict_chuvash():
root = '/resources/speech/corpora/chuvash'
path_to_transcript = dict()
for textfile in Path(root, 'transcripts', 'txt').glob('*.txt'):
with open(textfile, 'r', encoding='utf-8') as f:
for line in f:
line = line.strip().split()
text = ' '.join(line[1:]).replace('«', '').replace('»', '')
path = Path(root, 'audio', 'split', f'trim_clean_{textfile.stem}.{line[0]}.flac')
if path.exists():
path_to_transcript[str(path)] = text
return path_to_transcript
def build_path_to_transcript_dict_iban():
root = '/resources/speech/corpora/iban/data'
path_to_transcript = build_path_to_transcript_dict_kaldi_template(root, 'train', replace_in_path=(
'asr_iban/data/', ''))
path_to_transcript.update(build_path_to_transcript_dict_kaldi_template(root, 'dev', replace_in_path=(
'asr_iban/data/', '')))
return path_to_transcript
def build_path_to_transcript_dict_kaldi_template(root, split, replace_in_path=None):
path_to_transcript = dict()
wav_scp = {}
with open(Path(root, split, 'wav.scp'), 'r') as f:
for line in f:
wav_id, wav_path = line.split()
if replace_in_path:
wav_path = wav_path.replace(replace_in_path[0], replace_in_path[1])
wav_scp[wav_id] = str(Path(root, wav_path))
with open(Path(root, split, 'text'), 'r', encoding='utf-8') as f:
for line in f:
line = line.split()
wav_id = line[0]
text = ' '.join(line[1:])
if '<' in text: # ignore all <UNK> utterance etc.
continue
path_to_transcript[wav_scp[wav_id]] = text
return path_to_transcript
def build_path_to_transcript_dict_sundanese_speech():
root = '/resources/speech/corpora/sundanese_speech/asr_sundanese'
return build_path_to_transcript_dict_south_asian_languages_template(root)
def build_path_to_transcript_dict_sinhala_speech():
root = '/resources/speech/corpora/sinhala_speech/asr_sinhala'
return build_path_to_transcript_dict_south_asian_languages_template(root)
def build_path_to_transcript_dict_bengali_speech():
root = '/resources/speech/corpora/bengali_speech/asr_bengali'
return build_path_to_transcript_dict_south_asian_languages_template(root)
def build_path_to_transcript_dict_nepali_speech():
root = '/resources/speech/corpora/nepali_speech/asr_nepali'
return build_path_to_transcript_dict_south_asian_languages_template(root)
def build_path_to_transcript_dict_javanese_speech():
root = '/resources/speech/corpora/javanese_speech/asr_javanese'
return build_path_to_transcript_dict_south_asian_languages_template(root)
def build_path_to_transcript_dict_south_asian_languages_template(root):
path_to_transcript = dict()
with open(Path(root, 'utt_spk_text.tsv'), 'r', encoding='utf-8') as f:
for line in f:
utt, spk, text = line.strip().split('\t')
dir_tag = utt[:2]
path_to_transcript[str(Path(root, 'data', dir_tag, f'{utt}.flac'))] = text
return path_to_transcript
def build_path_to_transcript_dict_african_voices_kenyan_afv():
root = '/resources/speech/corpora/AfricanVoices/afv_enke'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_fon_alf():
root = '/resources/speech/corpora/AfricanVoices/fon_alf'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_hausa_cmv():
main_root = '/resources/speech/corpora/AfricanVoices'
path_to_transcript = build_path_to_transcript_dict_african_voices_template(f'{main_root}/hau_cmv_f')
path_to_transcript.update(build_path_to_transcript_dict_african_voices_template(f'{main_root}/hau_cmv_m'))
return path_to_transcript
def build_path_to_transcript_dict_african_voices_ibibio_lst():
root = '/resources/speech/corpora/AfricanVoices/ibb_lst'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_kikuyu_opb():
root = '/resources/speech/corpora/AfricanVoices/kik_opb'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_lingala_opb():
root = '/resources/speech/corpora/AfricanVoices/lin_opb'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_ganda_cmv():
root = '/resources/speech/corpora/AfricanVoices/lug_cmv'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_luo_afv():
root = '/resources/speech/corpora/AfricanVoices/luo_afv'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_luo_opb():
root = '/resources/speech/corpora/AfricanVoices/luo_opb'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_swahili_llsti():
root = '/resources/speech/corpora/AfricanVoices/swa_llsti'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_suba_afv():
root = '/resources/speech/corpora/AfricanVoices/sxb_afv'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_wolof_alf():
root = '/resources/speech/corpora/AfricanVoices/wol_alf'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_yoruba_opb():
root = '/resources/speech/corpora/AfricanVoices/yor_opb'
return build_path_to_transcript_dict_african_voices_template(root)
def build_path_to_transcript_dict_african_voices_template(root):
path_to_transcript = dict()
with open(Path(root, 'txt.done.data'), 'r', encoding='utf-8') as f:
for line in f:
line = line.replace('\\"', "'").split('"')
text = line[1]
file = line[0].split()[-1]
path_to_transcript[str(Path(root, 'wav', f'{file}.wav'))] = text
return path_to_transcript
def build_path_to_transcript_dict_zambezi_voice_nyanja():
root = '/resources/speech/corpora/ZambeziVoice/nyanja/nya'
return build_path_to_transcript_dict_zambezi_voice_template(root)
def build_path_to_transcript_dict_zambezi_voice_lozi():
root = '/resources/speech/corpora/ZambeziVoice/lozi/loz'
return build_path_to_transcript_dict_zambezi_voice_template(root)
def build_path_to_transcript_dict_zambezi_voice_tonga():
root = '/resources/speech/corpora/ZambeziVoice/tonga/toi'
return build_path_to_transcript_dict_zambezi_voice_template(root)
def build_path_to_transcript_dict_zambezi_voice_template(root):
path_to_transcript = dict()
for split in ['train', 'dev', 'test']:
with open(Path(root, f'{split}.tsv'), 'r', encoding='utf-8') as f:
reader = DictReader(f, delimiter='\t')
for row in reader:
path_to_transcript[str(Path(root, 'audio', row['audio_id']))] = row['sentence'].strip()
return path_to_transcript
def build_path_to_transcript_dict_fleurs_template(root):
path_to_transcript = dict()
for split in ['train', 'dev', 'test']:
with open(Path(root, f'{split}.tsv'), 'r', encoding='utf-8') as f:
reader = DictReader(f, delimiter='\t', fieldnames=['id', 'filename', 'transcription_raw',
'transcription', 'words', 'speaker', 'gender'])
for row in reader:
path_to_transcript[str(Path(root, 'audio', split, row['filename']))] = row['transcription_raw'].strip()
return path_to_transcript
def build_path_to_transcript_dict_fleurs_afrikaans():
root = '/resources/speech/corpora/fleurs/af_za'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_amharic():
root = '/resources/speech/corpora/fleurs/am_et'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_arabic():
root = '/resources/speech/corpora/fleurs/ar_eg'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_assamese():
root = '/resources/speech/corpora/fleurs/as_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_asturian():
root = '/resources/speech/corpora/fleurs/ast_es'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_azerbaijani():
root = '/resources/speech/corpora/fleurs/az_az'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_belarusian():
root = '/resources/speech/corpora/fleurs/be_by'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_bulgarian():
root = '/resources/speech/corpora/fleurs/bg_bg'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_bengali():
root = '/resources/speech/corpora/fleurs/bn_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_bosnian():
root = '/resources/speech/corpora/fleurs/bs_ba'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_catalan():
root = '/resources/speech/corpora/fleurs/ca_es'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_cebuano():
root = '/resources/speech/corpora/fleurs/ceb_ph'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_sorani_kurdish():
root = '/resources/speech/corpora/fleurs/ckb_iq'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_mandarin():
root = '/resources/speech/corpora/fleurs/cmn_hans_cn'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_czech():
root = '/resources/speech/corpora/fleurs/cs_cz'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_welsh():
root = '/resources/speech/corpora/fleurs/cy_gb'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_danish():
root = '/resources/speech/corpora/fleurs/da_dk'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_german():
root = '/resources/speech/corpora/fleurs/de_de'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_greek():
root = '/resources/speech/corpora/fleurs/el_gr'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_english():
root = '/resources/speech/corpora/fleurs/en_us'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_spanish():
root = '/resources/speech/corpora/fleurs/es_419'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_estonian():
root = '/resources/speech/corpora/fleurs/et_ee'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_persian():
root = '/resources/speech/corpora/fleurs/fa_ir'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_fula():
root = '/resources/speech/corpora/fleurs/ff_sn'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_finnish():
root = '/resources/speech/corpora/fleurs/fi_fi'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_filipino():
root = '/resources/speech/corpora/fleurs/fil_ph'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_french():
root = '/resources/speech/corpora/fleurs/fr_fr'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_irish():
root = '/resources/speech/corpora/fleurs/ga_ie'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_galician():
root = '/resources/speech/corpora/fleurs/gl_es'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_gujarati():
root = '/resources/speech/corpora/fleurs/gu_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_hausa():
root = '/resources/speech/corpora/fleurs/ha_ng'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_hebrew():
root = '/resources/speech/corpora/fleurs/he_il'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_hindi():
root = '/resources/speech/corpora/fleurs/hi_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_croatian():
root = '/resources/speech/corpora/fleurs/hr_hr'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_hungarian():
root = '/resources/speech/corpora/fleurs/hu_hu'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_armenian():
root = '/resources/speech/corpora/fleurs/hy_am'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_indonesian():
root = '/resources/speech/corpora/fleurs/id_id'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_igbo():
root = '/resources/speech/corpora/fleurs/ig_ng'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_icelandic():
root = '/resources/speech/corpora/fleurs/is_is'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_italian():
root = '/resources/speech/corpora/fleurs/it_it'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_japanese():
root = '/resources/speech/corpora/fleurs/ja_jp'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_javanese():
root = '/resources/speech/corpora/fleurs/jv_id'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_georgian():
root = '/resources/speech/corpora/fleurs/ka_ge'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_kamba():
root = '/resources/speech/corpora/fleurs/kam_ke'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_kabuverdianu():
root = '/resources/speech/corpora/fleurs/kea_cv'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_kazakh():
root = '/resources/speech/corpora/fleurs/kk_kz'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_khmer():
root = '/resources/speech/corpora/fleurs/km_kh'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_kannada():
root = '/resources/speech/corpora/fleurs/kn_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_korean():
root = '/resources/speech/corpora/fleurs/ko_kr'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_kyrgyz():
root = '/resources/speech/corpora/fleurs/ky_kg'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_luxembourgish():
root = '/resources/speech/corpora/fleurs/lb_lu'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_ganda():
root = '/resources/speech/corpora/fleurs/lg_ug'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_lingala():
root = '/resources/speech/corpora/fleurs/ln_cd'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_lao():
root = '/resources/speech/corpora/fleurs/lo_la'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_lithuanian():
root = '/resources/speech/corpora/fleurs/lt_lt'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_luo():
root = '/resources/speech/corpora/fleurs/luo_ke'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_latvian():
root = '/resources/speech/corpora/fleurs/lv_lv'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_maori():
root = '/resources/speech/corpora/fleurs/mi_nz'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_macedonian():
root = '/resources/speech/corpora/fleurs/mk_mk'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_malayalam():
root = '/resources/speech/corpora/fleurs/ml_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_mongolian():
root = '/resources/speech/corpora/fleurs/mn_mn'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_marathi():
root = '/resources/speech/corpora/fleurs/mr_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_malay():
root = '/resources/speech/corpora/fleurs/ms_my'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_maltese():
root = '/resources/speech/corpora/fleurs/mt_mt'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_burmese():
root = '/resources/speech/corpora/fleurs/my_mm'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_norwegian():
root = '/resources/speech/corpora/fleurs/nb_no'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_nepali():
root = '/resources/speech/corpora/fleurs/ne_np'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_dutch():
root = '/resources/speech/corpora/fleurs/nl_nl'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_northern_sotho():
root = '/resources/speech/corpora/fleurs/nso_za'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_nyanja():
root = '/resources/speech/corpora/fleurs/ny_mw'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_occitan():
root = '/resources/speech/corpora/fleurs/oc_fr'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_oroma():
root = '/resources/speech/corpora/fleurs/om_et'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_oriya():
root = '/resources/speech/corpora/fleurs/or_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_punjabi():
root = '/resources/speech/corpora/fleurs/pa_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_polish():
root = '/resources/speech/corpora/fleurs/pl_pl'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_pashto():
root = '/resources/speech/corpora/fleurs/ps_af'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_portuguese():
root = '/resources/speech/corpora/fleurs/pt_br'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_romanian():
root = '/resources/speech/corpora/fleurs/ro_ro'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_russian():
root = '/resources/speech/corpora/fleurs/ru_ru'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_sindhi():
root = '/resources/speech/corpora/fleurs/sd_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_slovak():
root = '/resources/speech/corpora/fleurs/sk_sk'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_slovenian():
root = '/resources/speech/corpora/fleurs/sl_si'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_shona():
root = '/resources/speech/corpora/fleurs/sn_zw'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_somali():
root = '/resources/speech/corpora/fleurs/so_so'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_serbian():
root = '/resources/speech/corpora/fleurs/sr_rs'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_swedish():
root = '/resources/speech/corpora/fleurs/sv_se'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_swahili():
root = '/resources/speech/corpora/fleurs/sw_ke'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_tamil():
root = '/resources/speech/corpora/fleurs/ta_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_telugu():
root = '/resources/speech/corpora/fleurs/te_in'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_tajik():
root = '/resources/speech/corpora/fleurs/tg_tj'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_thai():
root = '/resources/speech/corpora/fleurs/th_th'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_turkish():
root = '/resources/speech/corpora/fleurs/tr_tr'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_ukrainian():
root = '/resources/speech/corpora/fleurs/uk_ua'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_umbundu():
root = '/resources/speech/corpora/fleurs/umb_ao'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_urdu():
root = '/resources/speech/corpora/fleurs/ur_pk'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_uzbek():
root = '/resources/speech/corpora/fleurs/uz_uz'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_vietnamese():
root = '/resources/speech/corpora/fleurs/vi_vn'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_wolof():
root = '/resources/speech/corpora/fleurs/wo_sn'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_xhosa():
root = '/resources/speech/corpora/fleurs/xh_za'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_yoruba():
root = '/resources/speech/corpora/fleurs/yo_ng'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_cantonese():
root = '/resources/speech/corpora/fleurs/yue_hant_hk'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_fleurs_zulu():
root = '/resources/speech/corpora/fleurs/zu_za'
return build_path_to_transcript_dict_fleurs_template(root)
def build_path_to_transcript_dict_living_audio_dataset_template(root):
path_to_transcript = dict()
tree = ET.parse(f'{root}/text.xml')
tree_root = tree.getroot()
for rec in tree_root.iter('recording_script'):
for file in rec.iter('fileid'):
path_to_transcript[str(Path(root, '48000_orig', f'{file.get("id")}.wav'))] = file.text.strip()
return path_to_transcript
def build_path_to_transcript_dict_living_audio_dataset_irish():
root = '/resources/speech/corpora/LivingAudioDataset/ga'
return build_path_to_transcript_dict_living_audio_dataset_template(root)
def build_path_to_transcript_dict_living_audio_dataset_dutch():
root = '/resources/speech/corpora/LivingAudioDataset/nl'
return build_path_to_transcript_dict_living_audio_dataset_template(root)
def build_path_to_transcript_dict_living_audio_dataset_russian():
root = '/resources/speech/corpora/LivingAudioDataset/ru'
return build_path_to_transcript_dict_living_audio_dataset_template(root)
def build_path_to_transcript_dict_romanian_db():
root = '/resources/speech/corpora/RomanianDB'
path_to_transcript = dict()
for split in ['training', 'testing', 'elena', 'georgiana']:
for transcript in Path(root, split, 'text').glob('*.txt'):
subset = transcript.stem
with open(transcript, 'r', encoding='utf-8') as f:
for line in f:
fileid = line.strip()[:2]
if len(fileid) == 2:
fileid = '0' + fileid
text = line.strip()[5:]
if split == 'elena':
path = f'ele_{subset}_{fileid}.wav'
elif split == 'georgiana':
path = f'geo_{subset}_{fileid}.wav'
else:
path = f'adr_{subset}_{fileid}.wav'
path_to_transcript[str(Path(root, split, 'wav', subset, path))] = text
return path_to_transcript
def build_path_to_transcript_dict_shemo():
root = '/resources/speech/corpora/ShEMO'
path_to_transcript = dict()
with open('/resources/speech/corpora/ShEMO/shemo.json', 'r', encoding='utf-8') as f:
data = json.load(f)
for fileid, file_info in data.items():
path = Path(root, file_info['gender'], f'{fileid}.wav')
if path.exists():
path_to_transcript[str(path)] = file_info['transcript']
return path_to_transcript
def build_path_to_transcript_dict_mslt_template(root, lang='en'):
path_to_transcript = dict()
for split in Path(root).glob('*'):
if split.is_dir():
for audio_file in split.glob('*.wav'):
text_file = str(audio_file).replace(f'T0.{lang}.wav', f'T1.{lang}.snt')
with open(text_file, 'r', encoding='utf-16') as f:
for line in f:
text = line.strip() # should have only one line
if '<' in text or '[' in text:
# ignore all utterances with special parts like [laughter] or <UNIN/>
continue
path_to_transcript[str(audio_file)] = text
break
return path_to_transcript
def build_path_to_transcript_dict_mslt_english():
root = '/resources/speech/corpora/MSLT/Data/EN'
return build_path_to_transcript_dict_mslt_template(root, lang='en')
def build_path_to_transcript_dict_mslt_japanese():
root = '/resources/speech/corpora/MSLT/Data/JA'
return build_path_to_transcript_dict_mslt_template(root, lang='jp')
def build_path_to_transcript_dict_mslt_chinese():
root = '/resources/speech/corpora/MSLT/Data/ZH'
return build_path_to_transcript_dict_mslt_template(root, lang='ch')
def build_path_to_transcript_dict_rajasthani_hindi_speech():
root = '/resources/speech/corpora/Rajasthani_Hindi_Speech/Hindi-Speech-Data'
path_to_transcript = dict()
for audio_file in Path(root).glob('*.3gp'):
with open(audio_file.with_suffix('.txt'), 'r', encoding='utf-8') as f:
for line in f: # should only be one line
text = line.strip()
path_to_transcript[str(audio_file)] = text
return path_to_transcript
def build_path_to_transcript_dict_cmu_arctic():
root = '/resources/speech/corpora/cmu_arctic'
path_to_transcript = dict()
for speaker_dir in Path(root).glob('*'):
if speaker_dir.is_dir():
with open(Path(speaker_dir, 'etc', 'txt.done.data'), 'r', encoding='utf-8') as f:
for line in f:
line = line.replace('\\"', "'").split('"')
text = line[1]
file = line[0].split()[-1]
path_to_transcript[str(Path(speaker_dir, 'wav', f'{file}.wav'))] = text
return path_to_transcript
def build_path_to_transcript_dict_sevil_tatar():
root = '/resources/speech/corpora/sevil_tatar/sevil'
path_to_transcript = dict()
with open(Path(root, 'metadata.jsonl'), 'r', encoding='utf-8') as f:
for line in f:
meta = json.loads(line)
path_to_transcript[str(Path(root, meta['file']))] = meta['orig_text'].strip().replace('\xad', '')
return path_to_transcript
def build_path_to_transcript_dict_clartts():
root = '/resources/speech/corpora/ClArTTS'
path_to_transcript = dict()
with open(Path(root, 'training.txt'), 'r', encoding='utf-16') as f:
for line in f:
fileid, transcript = line.strip().split('|')
path_to_transcript[str(Path(root, 'wav', 'train', f'{fileid}.wav'))] = transcript
with open(Path(root, 'validation.txt'), 'r', encoding='utf-16') as f:
for line in f:
fileid, transcript = line.strip().split('|')
path_to_transcript[str(Path(root, 'wav', 'val', f'{fileid}.wav'))] = transcript
return path_to_transcript
def build_path_to_transcript_dict_snow_mountain_template(root, lang):
path_to_transcript = dict()
for split in ['train_full', 'val_full', 'test_common']:
with open(Path(root, 'experiments', lang, f'{split}.csv'), 'r', encoding='utf-8') as f:
reader = DictReader(f, delimiter=',')
for row in reader:
path = row['path'].replace('data/', f'{root}/')
path_to_transcript[path] = row['sentence'].strip()
return path_to_transcript
def build_path_to_transcript_dict_snow_mountain_bhadrawahi():
root = '/resources/speech/corpora/snow_mountain'
language = 'bhadrawahi'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_bilaspuri():
root = '/resources/speech/corpora/snow_mountain'
language = 'bilaspuri'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_dogri():
root = '/resources/speech/corpora/snow_mountain'
language = 'dogri'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_gaddi():
root = '/resources/speech/corpora/snow_mountain'
language = 'gaddi'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_haryanvi():
root = '/resources/speech/corpora/snow_mountain'
language = 'haryanvi'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_hindi():
root = '/resources/speech/corpora/snow_mountain'
language = 'hindi'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_kangri():
root = '/resources/speech/corpora/snow_mountain'
language = 'kangri'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_kannada():
root = '/resources/speech/corpora/snow_mountain'
language = 'kannada'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_kulvi():
root = '/resources/speech/corpora/snow_mountain'
language = 'kulvi'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_kulvi_outer_seraji():
root = '/resources/speech/corpora/snow_mountain'
language = 'kulvi_outer_seraji'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_malayalam():
root = '/resources/speech/corpora/snow_mountain'
language = 'malayalam'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_mandeali():
root = '/resources/speech/corpora/snow_mountain'
language = 'mandeali'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_pahari_mahasui():
root = '/resources/speech/corpora/snow_mountain'
language = 'pahari_mahasui'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_tamil():
root = '/resources/speech/corpora/snow_mountain'
language = 'tamil'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_snow_mountain_telugu():
root = '/resources/speech/corpora/snow_mountain'
language = 'telugu'
return build_path_to_transcript_dict_snow_mountain_template(root, language)
def build_path_to_transcript_dict_ukrainian_lada():
root = '/resources/speech/corpora/ukrainian_lada/dataset_lada/accept'
path_to_transcript = dict()
with open(Path(root, 'metadata.jsonl'), 'r', encoding='utf-8') as f:
for line in f:
meta = json.loads(line)
path_to_transcript[str(Path(root, meta['file']).with_suffix('.wav'))] = meta['orig_text'].strip().replace('\xad', '')
return path_to_transcript
def build_path_to_transcript_dict_m_ailabs_template(root):
path_to_transcript = dict()
for gender_dir in Path(root).glob('*'):
if not gender_dir.is_dir():
continue
for speaker_dir in gender_dir.glob('*'):
if not speaker_dir.is_dir():
continue
if (speaker_dir / 'wavs').exists():
with open(Path(speaker_dir, 'metadata.csv'), 'r', encoding='utf-8') as f:
for line in f:
fileid, text, text_norm = line.strip().split('|')
path = Path(speaker_dir, 'wavs', f'{fileid}.wav')
if path.exists():
path_to_transcript[str(path)] = text_norm
else:
for session_dir in speaker_dir.glob('*'):
if not session_dir.is_dir():
continue
with open(Path(session_dir, 'metadata.csv'), 'r', encoding='utf-8') as f:
for line in f:
fileid, text, text_norm = line.strip().split('|')
path = Path(session_dir, 'wavs', f'{fileid}.wav')
if path.exists():
path_to_transcript[str(path)] = text_norm
return path_to_transcript
def build_path_to_transcript_dict_m_ailabs_german():
root = '/resources/speech/corpora/m-ailabs-speech/de_DE'
return build_path_to_transcript_dict_m_ailabs_template(root)
def build_path_to_transcript_dict_m_ailabs_uk_english():
root = '/resources/speech/corpora/m-ailabs-speech/en_UK'
return build_path_to_transcript_dict_m_ailabs_template(root)
def build_path_to_transcript_dict_m_ailabs_us_english():
root = '/resources/speech/corpora/m-ailabs-speech/en_US'
return build_path_to_transcript_dict_m_ailabs_template(root)
def build_path_to_transcript_dict_m_ailabs_spanish():
root = '/resources/speech/corpora/m-ailabs-speech/es_ES'
return build_path_to_transcript_dict_m_ailabs_template(root)
def build_path_to_transcript_dict_m_ailabs_french():
root = '/resources/speech/corpora/m-ailabs-speech/fr_FR'
return build_path_to_transcript_dict_m_ailabs_template(root)
def build_path_to_transcript_dict_m_ailabs_italian():
root = '/resources/speech/corpora/m-ailabs-speech/it_IT'
return build_path_to_transcript_dict_m_ailabs_template(root)
def build_path_to_transcript_dict_m_ailabs_polish():
root = '/resources/speech/corpora/m-ailabs-speech/pl_PL'
return build_path_to_transcript_dict_m_ailabs_template(root)
def build_path_to_transcript_dict_m_ailabs_russian():
root = '/resources/speech/corpora/m-ailabs-speech/ru_RU'
return build_path_to_transcript_dict_m_ailabs_template(root)
def build_path_to_transcript_dict_m_ailabs_ukrainian():
root = '/resources/speech/corpora/m-ailabs-speech/uk_UK'
return build_path_to_transcript_dict_m_ailabs_template(root)
def build_path_to_transcript_dict_cml_tts_template(root):
path_to_transcript = dict()
for split in ['train', 'dev', 'test']:
with open(Path(root, f'{split}.csv'), 'r', encoding='utf-8') as f:
reader = DictReader(f, delimiter='|')
for row in reader:
path_to_transcript[str(Path(root, row['wav_filename']))] = row['transcript'].strip()
return path_to_transcript
def build_path_to_transcript_dict_cml_tts_dutch():
root = '/resources/speech/corpora/cml_tts/cml_tts_dataset_dutch_v0.1'
return build_path_to_transcript_dict_cml_tts_template(root)
def build_path_to_transcript_dict_cml_tts_french():
root = '/resources/speech/corpora/cml_tts/cml_tts_dataset_french_v0.1'
return build_path_to_transcript_dict_cml_tts_template(root)
def build_path_to_transcript_dict_cml_tts_german():
root = '/resources/speech/corpora/cml_tts/cml_tts_dataset_german_v0.1'
return build_path_to_transcript_dict_cml_tts_template(root)
def build_path_to_transcript_dict_cml_tts_italian():
root = '/resources/speech/corpora/cml_tts/cml_tts_dataset_italian_v0.1'
return build_path_to_transcript_dict_cml_tts_template(root)
def build_path_to_transcript_dict_cml_tts_polish():
root = '/resources/speech/corpora/cml_tts/cml_tts_dataset_polish_v0.1'
return build_path_to_transcript_dict_cml_tts_template(root)
def build_path_to_transcript_dict_cml_tts_portuguese():
root = '/resources/speech/corpora/cml_tts/cml_tts_dataset_portuguese_v0.1'
return build_path_to_transcript_dict_cml_tts_template(root)
def build_path_to_transcript_dict_cml_tts_spanish():
root = '/resources/speech/corpora/cml_tts/cml_tts_dataset_spanish_v0.1'
return build_path_to_transcript_dict_cml_tts_template(root)
def build_path_to_transcript_dict_mms_template(lang, root='/resources/speech/corpora/mms_synthesized_bible_speech'):
path_to_transcript = dict()
i = 0
with open(Path(root, 'bible_texts', f'{lang}.txt'), 'r', encoding='utf-8') as f:
for line in f:
path = Path(root, 'bible_audios', lang, f'{i}.wav')
if path.exists():
path_to_transcript[str(path)] = line.strip()
i += 1
return path_to_transcript
if __name__ == '__main__':
pass
|