[Tutor] about a program
Abdirizak abdi
a_abdi406@yahoo.com
Wed Mar 19 09:06:02 2003
--0-1537960010-1048082757=:68194
Content-Type: text/plain; charset=us-ascii
Hi everyone,
I was developing a little program that uses regular expression, initially I set up
an expression which looks like this :
buf = re.compile("[a-zA-Z]+\s+")
this was to match the followint string:
str = 'Data sparseness is an inherent problem in statistical methods for natural language processing.'
Result:
['Data', 'sparseness', 'is', 'an', 'inherent', 'problem', 'in', 'statistical', '
methods', 'for', 'natural', 'language']
the result is that, it gets all the tokens except the last one with the processing+ dot (full stop at the back)
can anyone suggest how I can achieve to handle all the cases with the above
RE.
Reposted for some correction
thanks in advance
---------------------------------
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
--0-1537960010-1048082757=:68194
Content-Type: text/html; charset=us-ascii
<P>Hi everyone,</P>
<P>I was developing a little program that uses regular expression, initially I set up</P>
<P>an expression which looks like this :</P>
<P><EM>buf = re.compile("[a-zA-Z]+\s+") </EM></P>
<P>this was to match the followint string:</P>
<P><EM>str = 'Data sparseness is an inherent problem in statistical methods for natural language <STRONG>processing</STRONG>.'</EM></P>
<P><EM><STRONG>Result:</STRONG></EM></P>
<P><EM>['Data', 'sparseness', 'is', 'an', 'inherent', 'problem', 'in', 'statistical', '<BR>methods', 'for', 'natural', 'language']</EM></P>
<P>the result is that, it gets all the tokens except the last one with the <STRONG><EM>processing+ dot </EM></STRONG>(full stop at the back)</P>
<P>can anyone suggest how I can achieve to handle all the cases with the above</P>
<P>RE.</P>
<P>Reposted for some correction</P>
<P>thanks in advance </P>
<P> </P><p><br><hr size=1>Do you Yahoo!?<br>
<a href="http://rd.yahoo.com/platinum/evt=8162/*http://platinum.yahoo.com/splash.html">Yahoo! Platinum</a> - Watch CBS' NCAA March Madness, <a href="http://rd.yahoo.com/platinum/evt=8162/*http://platinum.yahoo.com/splash.html">live on your desktop</a>!
--0-1537960010-1048082757=:68194--