This commit is contained in:
Nick
2019-09-24 13:12:10 -06:00
parent 1fc23efa66
commit 7ae5b07d88
2 changed files with 4 additions and 5 deletions
+1 -2
View File
@@ -157,8 +157,7 @@ class CTRLGenerator():
if options is None:
options = {}
if prompt[-2:] == ".I":
prompt = prompt[:-1] + " I"
prompt = prompt.replace(".I", ". I")
if prompt[-1] != " ":
prompt = prompt + " "
+3 -3
View File
@@ -6,7 +6,6 @@ YAML_FILE = "story/story_data.yaml"
from profanityfilter import ProfanityFilter
pf = ProfanityFilter()
def get_story_start(key):
with open(YAML_FILE, 'r') as stream:
data_loaded = yaml.safe_load(stream)
@@ -20,10 +19,11 @@ def get_action_verbs(key):
return data_loaded["action_verbs"][key]
# TODO add capital words to remove words
def remove_profanity(text):
return pf.censor(text)
def cut_trailing_quotes(text):
num_quotes = text.count('"')
if num_quotes % 2 is 0:
@@ -36,7 +36,6 @@ def cut_trailing_quotes(text):
def all_replace(text):
text = first_to_second_person(text)
text = text.replace("#","")
text = remove_profanity(text)
return text
@@ -120,6 +119,7 @@ def capitalize_helper(string):
def capitalize_first_letters(text):
print("Text to capitalize is ", text)
first_letters_regex = re.compile(r'((?<=[\.\?!]\s)(\w+)|(^\w+))')
def cap(match):