Example #1
0
def do_edit_prompt():

    global stdcr, prompt

    prompt = misc.edit_popup(stdscr, ' Prompt ', prompt)

    do_process_input()
Example #2
0
def do_change_module():

    global stdcr, match_module

    match_module = misc.edit_popup(stdscr, ' Module ', match_module)
Example #3
0
        elif c == ord('1'):
            accept_ts(1, cur_ts)
            missing_token, cur_ts = goto_next_ts(cur_ts)
        elif c == ord('2'):
            if not missing_token:
                accept_ts(2, cur_ts)
                missing_token, cur_ts = goto_next_ts(cur_ts)
        elif c == ord('3'):
            if not missing_token:
                accept_ts(3, cur_ts)
                missing_token, cur_ts = goto_next_ts(cur_ts)
                    
        elif c == ord('e'):

            ts['prompt'] = misc.edit_popup(stdscr, ' Prompt ', ts['prompt'])
            ts['ts'] = ''

        elif c == ord('a'):

            if prompt_token_idx < len(prompt_tokens):
                if len(ts['prompt']) > 0:
                    ts['prompt'] += ' '
                ts['prompt'] +=  prompt_tokens[prompt_token_idx]
                ts['ts'] = ''
                prompt_token_idx += 1

        elif c == ord('s'):

            if prompt_token_idx < len(prompt_tokens):
                prompt_token_idx += 1
Example #4
0
def lex_edit(token):

    global lex, lex_token, lex_entry, lex_base

    lex_set_token (token)

    while True:
   
        try:

            lex_paint_main()
        
            c = stdscr.getch()
            if c == ord('q'):
                lex.save()
                break  
        
            # generate de-mary
            elif c == ord('g'):
                
                tts.locale = 'de'
                tts.engine = 'mary'
                tts.voice  = 'bits3'

                ipas = tts.gen_ipa (lex_base)
                tts.say_ipa(ipas)
                lex_entry['ipa'] = ipas
       
            # generate de-espeak
            elif c == ord('h'):
                
                tts.locale ='de'
                tts.engine ='espeak'
                tts.voice  ='de'
                ipas = tts.gen_ipa (lex_base)
                lex_entry['ipa'] = ipas

                tts.locale ='de'
                tts.engine ='mary'
                tts.voice  ='bits3'
                tts.say_ipa(ipas)

        
            # generate en-mary 
            elif c == ord('l'):
                
                tts.locale ='en-US'
                tts.engine ='mary'
                tts.voice  ='cmu-rms-hsmm'

                ipas = tts.gen_ipa (lex_base)
                tts.say_ipa(ipas)
                lex_entry['ipa'] = ipas

            # generate fr-mary 
            elif c == ord('k'):
                
                tts.locale ='fr'
                tts.engine ='mary'
                tts.voice  ='upmc-pierre-hsmm'

                ipas = tts.gen_ipa (lex_base)
                tts.say_ipa(ipas)
                lex_entry['ipa'] = ipas

            # generate de-sequitur
            elif c == ord('j'):
                
                ipas = sequitur_gen_ipa (SEQUITUR_MODEL, lex_base)
                tts.locale ='de'
                tts.engine ='mary'
                tts.voice  ='bits3'
                tts.say_ipa(ipas)
                lex_entry['ipa'] = ipas

            # speak de mary unitsel 
            elif c == ord('p'):
        
                if len(lex_entry['ipa']) == 0:
                    continue
        
                ipas = lex_entry['ipa']

                tts.locale = 'de'
                tts.engine = 'mary'
                tts.voice  = 'bits3'

                tts.say_ipa(ipas)

            # speak de mary hsmm
            elif c == ord('o'):
        
                if len(lex_entry['ipa']) == 0:
                    continue
        
                ipas = lex_entry['ipa']

                tts.locale = 'de'
                tts.engine = 'mary'
                tts.voice  = 'dfki-pavoque-neutral-hsmm'

                tts.say_ipa(ipas)

            # speak fr mary hsmm
            elif c == ord('i'):
       
                if len(lex_entry['ipa']) == 0:
                    continue
        
                ipas = lex_entry['ipa']

                tts.locale = 'fr'
                tts.engine = 'mary'
                tts.voice  = 'pierre-voice-hsmm'

                tts.say_ipa(ipas)
       
            # speak en mary hsmm
            elif c == ord('u'):
        
                ipas = lex_entry['ipa']

                tts.locale = 'en-US'
                tts.engine = 'mary'
                tts.voice  = 'cmu-rms-hsmm'

                tts.say_ipa(ipas)
       
            # edit token
            elif c == ord('t'):

                token = misc.edit_popup(stdscr, ' Token ', '')

                lex_set_token (token)

            # edit XS
            elif c == ord('e'):
        
                ipas = lex_entry['ipa']

                xs = ipa2xsampa (lex_token, ipas, stress_to_vowels=False)

                xs = misc.edit_popup(stdscr, ' X-SAMPA ', xs)

                ipas = xsampa2ipa (lex_token, xs)
        
                lex_entry['ipa'] = ipas

        except:
            logging.error('EXCEPTION CAUGHT %s' % traceback.format_exc())
Example #5
0
        # speak en mary hsmm
        elif c == ord('u'):

            ipas = lex_entry['ipa']

            tts.locale = 'en-US'
            tts.engine = 'mary'
            tts.voice = 'cmu-rms-hsmm'

            tts.say_ipa(ipas, async=True)

        # edit token
        elif c == ord('t'):

            token = misc.edit_popup(stdscr, ' Token ', '')

            lex_set_token(token)

        # edit XS
        elif c == ord('e'):

            ipas = lex_entry['ipa']

            xs = ipa2xsampa(lex_token, ipas, stress_to_vowels=False)

            xs = misc.edit_popup(stdscr, ' X-SAMPA ', xs)

            try:
                ipas = xsampa2ipa(lex_token, xs)