This commit is contained in:
Nick Walton
2019-09-26 14:34:29 -06:00
parent 5b3d86e191
commit 77dd8413d3
4 changed files with 10 additions and 8 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ import textwrap
CRED_FILE = "./AI-Adventure-2bb65e3a4e2f.json"
# Set the key
def console_print(str, pycharm=True):
def console_print(str, pycharm=False):
if pycharm:
LINE_WIDTH=80
+1 -1
View File
@@ -216,7 +216,7 @@ class CTRLGenerator():
prompt_logits[_token][generated_token] /= self.penalty
# disallow some tokens
forbidden_tokens = ['<unk>', 'Sco@@', "&amp@@", "1]@@", "2]@@", "3]@@", "4]@@", "https://www.@@", "[@@"]
forbidden_tokens = ['<unk>', 'Sco@@', "&amp@@", "1]@@", "2]@@", "3]@@", "4]@@", "https://www.@@", "[@@", ":@@"]
if num_new_lines > self.max_new_lines:
forbidden_tokens.append("\n")
+3 -3
View File
@@ -39,9 +39,9 @@ class Story():
self.results.append(story_block)
def latest_result(self):
if len(self.results) > 1:
return self.actions[-2] + self.results[-2] + self.actions[-1] + self.results[-1]
elif len(self.results) == 1:
# if len(self.results) > 1:
# return self.actions[-2] + self.results[-2] + self.actions[-1] + self.results[-1]
if len(self.results) >= 1:
return self.story_start + self.actions[-1] + self.results[-1]
else:
return self.story_start
+5 -3
View File
@@ -114,16 +114,18 @@ first_to_second_mappings = [
("me", "you"),
("us", "you"),
("our", "your"),
("I'll", "you'll")
("I'll", "you'll"),
("myself", "yourself")
]
second_to_first_mappings = [
("you're", "I'm"),
("your ", "my "),
("your", "my "),
("you are", "I am"),
("you", "I"),
("you", "me"),
("you'll", "I'll")
("you'll", "I'll"),
("yourself", "myself")
]
def capitalize_helper(string):