This commit is contained in:
Nick Walton
2019-09-25 13:32:58 -06:00
parent b219720244
commit 40be8b5f5a
2 changed files with 6 additions and 8 deletions
+4 -4
View File
@@ -263,11 +263,11 @@ class CTRLGenerator():
# you can delete theme from the pruned_list
# you can comment this out, I'm keeping it in for demonstration purpose
tokens_to_disallow = []
complex_to_dissalow = ["http", "r/nosleep", "EDIT", "UPDATE", "&amp"]
for _ in range(len(pruned_list)):
complex_to_dissalow = ["http", "r/nosleep", "EDIT", "UPDATE", "&amp", "[Part", "**", "[Link ", "www."]
for i in range(len(pruned_list)):
for complex in complex_to_dissalow:
if complex in self.idx2word[pruned_list[_]]:
tokens_to_disallow.append(_)
if complex in self.idx2word[pruned_list[i]]:
tokens_to_disallow.append(i)
pruned_list = np.delete(pruned_list, tokens_to_disallow)
# if temperature is 0
+2 -4
View File
@@ -40,9 +40,9 @@ class Story():
def latest_result(self):
if len(self.results) > 1:
return self.results[-2] + self.actions[-1] + self.results[-1]
return self.results[-2] + self.actions[-1] + self.results[-1] + self.actions[-1]
elif len(self.results) == 1:
return self.story_start + self.results[-1]
return self.story_start + self.results[-1] + self.actions[-1]
else:
return self.story_start
@@ -208,8 +208,6 @@ class CTRLStoryManager(ConstrainedStoryManager):
for phrase in self.action_phrases:
result = self.generate_action_result(self.story_context(), phrase, options=options)
location = result[0].split()[location_pos+1]
print("result is ", result)
print("location is ", location)
options["word_whitelist"][location_pos].remove(location)
results.append(result)