17 changed files with 79 additions and 3 deletions
Binary file not shown.
Binary file not shown.
@ -1,10 +1,42 @@
@@ -1,10 +1,42 @@
|
||||
import os |
||||
os.chdir(r'C:\Users\Aki\source\repos\acoustic_model\acoustic_model') |
||||
import sys |
||||
|
||||
import defaultfiles as default |
||||
sys.path.append(default.forced_alignment_module_dir) |
||||
from forced_alignment import pyhtk, convert_phone_set, scripts |
||||
|
||||
wav_dir = r'c:\Users\Aki\source\repos\acoustic_model\reus-test' |
||||
reus_dir = r'c:\Users\Aki\source\repos\acoustic_model\reus-test' |
||||
wav_dir = reus_dir |
||||
wav_files = ['reus1008-reus.wav', |
||||
'reus1167-man.wav', |
||||
'reus3768-mantsje.wav'] |
||||
|
||||
word = 'reus' |
||||
pronunciation_ipa = ['rø:s', 'mɑn', 'mɑntsjə'] |
||||
|
||||
for wav_file in wav_files: |
||||
file_lab = os.path.join(reus_dir, wav_file.replace('.wav', '.lab')) |
||||
file_dic = os.path.join(reus_dir, wav_file.replace('.wav', '.dic')) |
||||
file_txt = os.path.join(reus_dir, wav_file.replace('.wav', '.txt')) |
||||
|
||||
# output htk dict file |
||||
with open(file_dic, 'w', encoding="utf-8") as f: |
||||
for ipa in pronunciation_ipa: |
||||
cgn = convert_phone_set.ipa2cgn([ipa.replace(':', 'ː')]) |
||||
barbara = convert_phone_set.cgn2barbara(cgn) |
||||
f.write(word.upper() + '\t' + barbara + '\n') |
||||
|
||||
# output htk label file. |
||||
pyhtk._create_label_file(word, file_lab) |
||||
|
||||
scripts.run_command([ |
||||
'HVite','-T', '1', |
||||
'-a', |
||||
'-C', default.config_hvite, |
||||
'-H', default.acoustic_model, |
||||
'-m', |
||||
'-i', file_txt, |
||||
#'-S', script_file, |
||||
file_dic, default.phonelist_txt, os.path.join(wav_dir, wav_file) |
||||
]) |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
REUS r eu s |
||||
REUS m ac n |
||||
REUS m ac n t s j @ |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
#!MLF!# |
||||
"c:/Users/Aki/source/repos/acoustic_model/reus-test/reus1008-reus.rec" |
||||
0 9700000 r -12463.852539 REUS |
||||
9700000 12800000 eu -3622.108887 |
||||
12800000 26250001 s -17303.216797 |
||||
. |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
REUS r eu s |
||||
REUS m ac n |
||||
REUS m ac n t s j @ |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
#!MLF!# |
||||
"c:/Users/Aki/source/repos/acoustic_model/reus-test/reus1167-man.rec" |
||||
0 150000 m -230.057571 REUS |
||||
150000 300000 ac -250.994858 |
||||
300000 450000 n -202.377716 |
||||
450000 4600000 t -5128.984375 |
||||
4600000 5050000 s -711.338501 |
||||
5050000 5450000 j -564.730591 |
||||
5450000 16049999 @ -13249.787109 |
||||
. |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
REUS r eu s |
||||
REUS m ac n |
||||
REUS m ac n t s j @ |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
#!MLF!# |
||||
"c:/Users/Aki/source/repos/acoustic_model/reus-test/reus3768-mantsje.rec" |
||||
0 150000 m -217.347229 REUS |
||||
150000 1150000 ac -1266.293579 |
||||
1150000 1650000 n -583.382568 |
||||
1650000 11100000 t -11259.270508 |
||||
11100000 11250000 s -247.939255 |
||||
11250000 11550000 j -445.511444 |
||||
11550000 24150000 @ -16769.048828 |
||||
. |
Loading…
Reference in new issue