(examples, output_directory)
Writes a collection of data files by play & character.
Writes a collection of data files by play & character.
Writes a collection of data files by play & character .
def _write_data_by_character(examples, output_directory):
    """Writes a collection of data files by play & character."""
    if not os.path.exists(output_directory):
        os.makedirs(output_directory)
    for character_name, sound_bites in examples.items():
        filename = os.path.join(output_directory, character_name + '.txt')
        with open(filename, 'w') as output:
            for sound_bite in sound_bites:
                output.write(sound_bite + '\n')
def _write_data_by_character ( examples , output_directory ) : if not os . path . exists ( output_directory ) : os . makedirs ( output_directory ) for character_name , sound_bites in examples . items ( ) : filename = os . path . join ( output_directory , character_name + '.txt' ) with open ( filename , 'w' ) as output : for sound_bite in sound_bites : output . write ( sound_bite + '\n' )