Skip to content

Commit

Permalink
movie_script persona maker
Browse files Browse the repository at this point in the history
  • Loading branch information
gorkemgoknar committed Dec 18, 2020
1 parent 2d440f3 commit af09ca6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Binary file added __pycache__/utils.cpython-36.pyc
Binary file not shown.
17 changes: 16 additions & 1 deletion data/make_persona_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,22 @@ def get_utterance_list(chat, dialogs, char_opening_lines=None, num_cadidates=10,
all_utterances.append(utterances)


from collections import defaultdict
persona = {}
for ut_dialog in all_utterances:
##loop ut
for ut in ut_dialog:
name = ut["name"]
if name not in persona:
persona[name] = {}

persona[name]["personality"] = ut["personality"]
if 'utterances' not in persona[name]:
persona[name]["utterances"] = []

persona[name]["utterances"].append(ut)




##SAVE TO JSON
Expand All @@ -335,4 +351,3 @@ def get_utterance_list(chat, dialogs, char_opening_lines=None, num_cadidates=10,
with open(persona_file, 'w') as f:
json.dump(all_utterances, f)


0 comments on commit af09ca6

Please sign in to comment.