Added the story mode with 2 methods by Electro199 (#1288)

Thank you @electro199!
This commit is contained in:
Syed Aman Raza authored and GitHub committed 2022-12-19 18:39:03 +01:00
1 parent 903dc3476f
commit e30eaf7594
27 files changed
+825 -249

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
import re
import spacy
from utils.console import print_step
from utils.voice import sanitize_text
# working good
def posttextparser(obj):
text = re.sub("\n", "", obj)
try:
nlp = spacy.load('en_core_web_sm')
except OSError:
print_step("The spacy model can't load. You need to install it with \npython -m spacy download en")
exit()
doc = nlp(text)
newtext: list = []
# to check for space str
for line in doc.sents:
if sanitize_text(line.text):
newtext.append(line.text)
# print(line)
return newtext