* various small changes

* various small changes

* update

* update

* update

* update

* update

* auto save

* change model loc

* updated instructions

* moved to gcloud storage

* fixed cd issue

* update

* UpdateCensor

* UpdateCensor
This commit is contained in:
Nick Walton
2019-12-06 14:11:19 -07:00
committed by GitHub
parent 9b22107128
commit 124dd3ef60
2 changed files with 8 additions and 16 deletions
+3
View File
@@ -0,0 +1,3 @@
rape
shitting
raped
+5 -16
View File
@@ -6,7 +6,10 @@ from difflib import SequenceMatcher
YAML_FILE = "story/story_data.yaml"
from profanityfilter import ProfanityFilter
pf = ProfanityFilter()
with open("story/extra_censored_words.txt", "r") as f:
more_words = [l.replace("\n", "") for l in f.readlines()]
pf = ProfanityFilter(extra_censor_list=more_words)
def console_print(text, width=75):
last_newline = 0
@@ -263,18 +266,4 @@ def second_to_first_person(text):
for variation in variations:
text = replace_outside_quotes(text, variation[0], variation[1])
return capitalize_first_letters(text[1:])
if __name__ == '__main__':
result = 'The only thing they can tell you is, "We have nowhere else to…"'
result = result.replace('."', '".')
result = result.replace("#", "")
result = result.replace("*", "")
result = first_to_second_person(result)
result = remove_profanity(result)
while ("\n \n \n " in result):
result = result.replace("\n \n \n ", "\n \n ")
print(result)
return capitalize_first_letters(text[1:])