Skip to content

Commit

Permalink
fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
gorkemgoknar committed Dec 19, 2020
1 parent 4039792 commit 144145e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions data/make_persona_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ def generate_dialogs(dialog_holder):



def preprocess_line(text):
#add space for ( and ) chars
##else everthing sucks

text = text.replace("("," ( ")
text = text.replace(")"," ( ")

#remove "-" if exists
text = text.replace("-"," ")

return text

def get_chat_dialog(dialog):
##we have the dialogues
#now generate utterances.
Expand All @@ -91,11 +103,13 @@ def get_chat_dialog(dialog):
continue

talk = " ".join(splitted[1:]).strip()

talk = preprocess_line(talk)

##TODO check name starts with in participants
##if name (VO) name (..) or name/Something than assume same
##as voice over are here too.

if name not in participants:
participants[name] = participant_number
participant_number += 1
Expand All @@ -111,6 +125,7 @@ def get_chat_dialog(dialog):
return chat_dialog



def generate_dialog_from_file(filename):
with open(filename) as f:
lines = f.readlines()
Expand Down Expand Up @@ -215,7 +230,7 @@ def get_random_line_not_said_by_char(name,dialogs,current_recursion=0):
current_recursion += 1
if current_recursion > 5:
##enough already
return ["I could not find anything to say."]
return "I could not find anything to say."
else:
##2th has line
return get_random_line_not_said_by_char(name,dialogs,current_recursion)
Expand Down

0 comments on commit 144145e

Please sign in to comment.