Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. docContents = docContents.replaceAll("_", " ");
  2. String[] words = docContents.split("\\s+");
  3. ArrayList<String> tokens = new ArrayList<String>();
  4. for (int i = 0; i < words.length; i++) {
  5.     words[i] = words[i].replaceAll("\\W", "");
  6.     words[i] = words[i].replaceAll("\\d", "");
  7.     if (words[i].length() > 0) {
  8.         tokens.add(words[i]);
  9.     }
  10. }
  11. return tokens;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement