Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static ArrayList<String> puncRemover(ArrayList<String> words){
- String[] punc = {".", ",", "\\?", "!", "'", "\""};
- for(String word : words){
- for(String s : punc){
- if(word.contains(s)){
- word = word.replaceAll(s, "");
- if(!word.contains(s)){
- System.out.println("Removed " + s);
- }
- }
- }
- }
- System.out.println("Punctuation removed.");
- return words;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement