This commit is contained in:
Nick
2019-09-19 22:44:08 -06:00
parent 35eaefaa32
commit da015e2149
3 changed files with 9 additions and 1 deletions
+2 -1
View File
@@ -29,8 +29,9 @@ def play_unconstrained():
console_print(str(story_manager.story))
while (True):
print("\n")
action = input("> ")
action = "You " + action
action = " You " + action + "."
result = story_manager.act(action)
console_print(action + result)
+2
View File
@@ -256,6 +256,8 @@ class CTRLGenerator():
# os.system("clear")
tokens_generated_so_far = ' '.join([self.idx2word[c] for c in tokens_generated[0].squeeze()[:token + 2]])
tokens_generated_so_far = re.sub('(@@ )', '', string=tokens_generated_so_far)
tokens_generated_so_far = re.sub('(@@ ?$)', '', string=tokens_generated_so_far)
result = tokens_generated_so_far[prompt_length:]
+5
View File
@@ -61,16 +61,21 @@ def replace_outside_quotes(text, current_word, repl_word):
first_to_second_mappings = [
("I'm", "you're"),
("I am", "you are"),
("I ", "you "),
("I've", "You've"),
("my", "your"),
("My", "Your"),
("we ","you "),
("We ","You "),
(" mine"," yours"),
("me", "you"),
]
second_to_first_mappings = [
("You're", "I'm"),
("you're", "I'm"),
("Your", "My"),
("your", "my"),
("you are", "I am"),