<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="serif">You all looked troubled today when I started
talking about having to clean up the words so that there were no
punctuations symbols, etc. Here is a an example of a simple
static method, although not exhaustive, that you could use in your
program. It basically converts the punctuation character to a
space and then trims it.<br>
<br>
<br>
</font><tt> private static String cleanUp( String word ){</tt><tt><br>
</tt><tt> if (word.endsWith("'s")) word =
word.substring(0,word.length()-2);</tt><tt><br>
</tt><tt> word = word.replace('\'', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace('[', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace(']', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace('.', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace(',', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace(';', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace(':', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace('!', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace('?', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace('(', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace(')', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace('"', ' ').trim();</tt><tt><br>
</tt><tt> word = word.replace("--", " ").trim();</tt><tt><br>
</tt><tt> word = word.replace("`", " ").trim();</tt><tt><br>
</tt><tt><br>
</tt><tt> return word;</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><font face="serif"><br>
</font>
<pre class="moz-signature" cols="72">--
Andrew J. Pounds, Ph.D. (<a class="moz-txt-link-abbreviated" href="mailto:pounds_aj@mercer.edu">pounds_aj@mercer.edu</a>)
Professor of Chemistry and Computer Science
Mercer University, Macon, GA 31207 (478) 301-5627
<a class="moz-txt-link-freetext" href="http://faculty.mercer.edu/pounds_aj">http://faculty.mercer.edu/pounds_aj</a>
</pre>
</body>
</html>