I am iterating through my text file, but when I use the read() function, the loop iterates through the letters instead of the sentences.
with the following code:
for question in questions: # voor elke question moet er door alle lines geiterate worden
print(f"Question: {question}")
f = open("glad.txt", "r")
text = f.read()
# text = text.replace("\n", ". ")
# text = text.replace(". .", "")
# text = text.replace(".. ", ". ")
# text = text.replace(".", ".\n")
#text = text.strip(".. ")
# test = text.replace('[bewerken | brontekst bewerken]', "")
# output = re.sub(r'\[\d+\]', '', test)
for line in text:
text = str(line) #het antwoord moet een string zijn
#encoding met tokenizen van de zinnen
print(text)
But when I remove the f.read()
I need to use the read() function, otherwise I cannot use the replace() function. Does anyone how to solve this issue?

