Exemplo n.º 1
0
skype_contacts_dict = tbh_skype_interface.load_skype_contacts( \
    'skype_contact_names_00.txt' )


# -------------------- #
#    INITIALIZATION    #
# -------------------- #
# ---- INITIALIZE THINGS ---- #
# Initialize the dialog manager
feature_type_list = [ 'tbh_keyword' , 'tbh_first_word' , 'tbh_keyword_sequence', 'score_statistic', 'tbh_digits', 'tbh_skype_contact', 'tbh_environmental_control_keyword' ]

#dm = tbh_dialog_manager.tbh_dialog_manager_t( feature_type_list = feature_type_list, \
#                                                  skype_contacts_dict = \
#                                                  skype_contacts_dict )
dm = tbh_dialog_manager.tbh_dialog_manager_t( \
    feature_type_list = feature_type_list, \
        skype_contacts_dict = \
        skype_contacts_dict, starting_state='awake' )

# Initialize speech recognizer
sr = tbh_speech_recognizer.tbh_speech_recognizer_t( \
    starting_grammar = 'phone_call', default_grammar = 'phone_call' )

# Initialize Skype manager
# Pass in the text file containing the contact names
sm = tbh_skype_interface.tbh_skype_interface_t( contacts_file = skype_contacts_dict )



# Initialize the audio listener, has its own thread
al = tbh_audio_listener.tbh_audio_listener_t( \
    microphone_name = 'icicle', temp_audio_storage_path = \
Exemplo n.º 2
0
Arquivo: test2.py Projeto: wpli/dialog
# tbh specific stuff
import tbh_speech_recognizer
import tbh_audio_listener
import tbh_audio_listener_gui
# import tbh_output_interface

import tbh_dialog_manager


# Start the GUI
# It needs to be on its own thread
gui_manager = tbh_audio_listener_gui.tbh_gui_manager()
gui_manager_thread = threading.Thread( target = gui_manager.gui.main )

# Start the dialog manager
dm = tbh_dialog_manager.tbh_dialog_manager_t()
dm.add_processed_nbest_event_handler( gui_manager.execute_action_handler )

# Start speech recognizer
# It does not need to be on its own thread
sr = tbh_speech_recognizer.tbh_speech_recognizer_t()
sr.add_processed_audio_event_handler( gui_manager.show_nbest_handler )
sr.add_processed_audio_event_handler( dm.process_nbest_handler )

# Add handlers to the tbh_audio_listener
# al = tbh_audio_listener.tbh_audio_listener_t()
gui_manager.audio_listener.add_audio_listener_handler( sr.process_raw_audio_handler )
gui_manager.audio_listener.add_audio_listener_handler( gui_manager.end_of_audio_stream_handler )
gui_manager.audio_listener.add_start_of_audio_handler( gui_manager.start_of_audio_handler )

# Add handlers to the speech recognizer
Exemplo n.º 3
0
import tbh_dialog_manager

import sys
sys.path.append( '../../tbh_top_level/src/' )
import tbh_user_profile


if __name__ == '__main__':
    user_profile = tbh_user_profile.tbh_user_profile_t( 0 )
    feature_type_list = [ 'tbh_keyword' , 'tbh_first_word' , \
                              'tbh_keyword_sequence', 'score_statistic' ]
    


    dialog_manager = tbh_dialog_manager.tbh_dialog_manager_t( user_profile, \
                                                                  feature_type_list )


    while 1:
        input_sentence = raw_input( "Type in a string " + \
                           "(lowercase, no commas or periods, " + \
                           "compose words if necessary, q to exit): " )

        if input_sentence == 'q':
            break
        else:
            # Turn into artificial param_dict with n-best list
            param_dict = {}       
            # Create an artificial nbest list
            nbest_list = []
            for index in range(0,10):