--
Youre going to have to have a knowledge base in order to find where the items in the knowledge occur in the text. Once you have that, you can use this.
Import re
End_Location = [m.start() for m in text.read()]
Start_location = [m.end() for m in text.read()]
That will tell you where the knowledge occurs in the string. What you want is to find what occurs within the proximity. One approach to finding the most probable sequences occurring near the knowledge is to assign an arbitrary numerical parameter to look at. Another approach is pragmatic and requires a context base. I can explain the latter approach more if youre interested.
Nick
--
The code I provided is wrong, excuse me.
[m.start() for m in re.finditer(text)]
I'll have to check if this is right too when I get home.
Knowledge = ['scholarship']
For m in knowledge:
If m in text:
Start_location = [m.end() for m in re.finditer(text)]
And vica versa for the end location.
Hope that helps :)