The question is:
Write a script that reads a text a file, splits it into sentences, and print the sentences on the screen, one after the other. Do not use libraries that do sentence-splitting for you.
The following is my code:
import re
fr=open('input.txt')
text=fr.read().strip()
fr.close()
Ms=re.finditer(' +([A-Z].+?\.) ',text)
for i in Ms:
print i.group(1)
The result shows nothing. Actually I know what's maybe wrong because the first sentence of the file doesn't have multiple spaces ahead, but I can't figure out how to fix it.
The following is my input:
Metformin will reach full effectiveness in 6-8 weeks. It has three primary effects (http://en.wikipedia.org/wiki/Metformin#Mechanism4of_action).
First, it (frequently) reduces the amount of blood sugar produced by your liver, this presumably will decrease your basal needs and help your fasting numbers.
Second, metformin increases the insulin, signaling resulting in increased insulin sensitivity: http://care.diabetesjournals.org/content/27/1/281.full. The effect is primarily on the muscle mass in your body. Insulin resistance also affects all kinds of other stuff, but the biggest utilization of insulin is in the uptake of glucose to muscles.
Third, Metformin decreases the absorption of glucose during digestion.It is this effect that I believe causes some of the gastric issues.