# # forced alignment using novo-api. # # *** IMPORTANT *** # This file should be treated as confidencial. # This file should not be copied or uploaded to public sites. # # NOTES: # The usage of novo api: https://bitbucket.org/novolanguage/python-novo-api # I couldn't make it work as I described in the mail to Martijn Bartelds on # 2018/12/03. # As per the advice from him, I modified testgrammer.py and made it a function. # # In order to run on Python 3.6, the following points are changed in novo-api. # (1) backend/__init__.py # - #import session # from . import session # (2) backend/session.py # - #except Exception, e: # except Exception as e: # - #print self.last_message # print(self.last_message) # (3) asr/segment/praat.py # - def print_tier(output, title, begin, end, segs, (format, formatter)) # def print_tier(output, title, begin, end, segs, format, formatter): # (4) asr/spraaklab/__init.py # - #import session # from . import session # (5) asr/spraaklab/schema.py # - #print data, "validated not OK", e.message # print("{0} validated not OK {1}".format(data, e.message)) # - #print data, "validated OK" # print("{} validated OK".format(data)) # - #if isinstance(object, basestring): # if isinstance(object, str) # # Aki Kunikoshi # 428968@gmail.com # import os os.chdir(r'C:\Users\Aki\source\repos\acoustic_model\acoustic_model') import argparse import json from novoapi.backend import session import novoapi_functions import defaultfiles as default # username / password cannot be passed as artuments... p = argparse.ArgumentParser() #p.add_argument("--user", default=None) #p.add_argument("--password", default=None) p.add_argument("--user", default='martijn.wieling') p.add_argument("--password", default='fa0Thaic') args = p.parse_args() #wav_file = 'c:\\OneDrive\\WSL\\test\\onetwothree.wav' wav_file = os.path.join(default.stimmen_wav_dir, 'pg_pauw_2206_0fjd8.wav') # list of the pronunciation for each words word = 'pauw' pronunciation_ipa = ['pau', 'pɑu'] result = novoapi_functions.forced_alignment(wav_file, word, pronunciation_ipa) pronunciation_ipa, pronunciation_novo70, llh = novoapi_functions.result2pronunciation(result, word)