Advertisement
GenuineSounds

Untitled

Dec 19th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.74 KB | None | 0 0
  1. package com.genuineminecraft.tooltips;
  2.  
  3. import java.io.*;
  4. import java.util.ArrayList;
  5. import java.util.Arrays;
  6. import java.util.List;
  7. import java.util.Map;
  8.  
  9. public class CleanData {
  10.  
  11.     public static List<String> wordList = Arrays.asList("a", "able", "###", "##", "about", "above", "according", "accordingly", "across", "actually", "after",
  12.             "afterwards", "again", "against", "all", "allow", "allows", "almost", "alone", "along", "already", "also", "although", "always", "am", "among",
  13.             "amongst", "an", "and", "another", "any", "anybody", "anyhow", "anyone", "anything", "anyway", "anyways", "anywhere", "apart", "appear",
  14.             "appreciate", "appropriate", "RT", "are", "around", "as", "aside", "ask", "asking", "fuck", "associated", "at", "available", "away", "awfully",
  15.             "b", "be", "became", "because", "become", "becomes", "becoming", "been", "before", "beforehand", "behind", "being", "believe", "below", "beside",
  16.             "besides", "best", "better", "between", "beyond", "both", "brief", "but", "by", "c", "came", "can", "cannot", "cant", "cause", "causes", "certain",
  17.             "certainly", "changes", "clearly", "co", "com", "come", "comes", "concerning", "consequently", "consider", "considering", "#", "contain",
  18.             "containing", "contains", "corresponding", "could", "course", "currently", "d", "definitely", "described", "despite", "did", "different", "do",
  19.             "you're", "does", "doing", "done", "down", "downwards", "during", "e", "each", "edu", "eg", "either", "else", "elsewhere", "enough", "entirely",
  20.             "especially", "et", "etc", "even", "ever", "every", "everybody", "everyone", "everything", "everywhere", "ex", "exactly", "example", "except", "f",
  21.             "far", "few", "fifth", "first", "followed", "following", "follows", "for", "former", "formerly", "forth", "from", "further", "furthermore", "g",
  22.             "get", "gets", "getting", "given", "gives", "go", "goes", "going", "gone", "got", "gotten", "greetings", "h", "had", "happens", "hardly", "has",
  23.             "have", "having", "he", "hello", "help", "hence", "her", "here", "hereafter", "hereby", "herein", "hereupon", "hers", "herself", "hi", "him",
  24.             "himself", "his", "hither", "hopefully", "how", "howbeit", "however", "i", "ie", "if", "ignored", "immediate", "in", "inasmuch", "inc", "indeed",
  25.             "indicate", "indicated", "indicates", "inner", "insofar", "instead", "into", "inward", "is", "it", "its", "itself", "j", "just", "k", "keep",
  26.             "keeps", "kept", "know", "knows", "known", "l", "last", "lately", "later", "latter", "latterly", "least", "less", "lest", "let", "like", "liked",
  27.             "likely", "little", "ll", "look", "looking", "looks", "ltd", "m", "mainly", "many", "may", "maybe", "me", "mean", "meanwhile", "merely", "might",
  28.             "more", "moreover", "most", "mostly", "much", "must", "my", "myself", "n", "name", "namely", "nd", "near", "nearly", "necessary", "need", "needs",
  29.             "neither", "never", "nevertheless", "new", "next", "no", "nobody", "non", "none", "noone", "nor", "normally", "not", "nothing", "novel", "now",
  30.             "nowhere", "o", "obviously", "of", "off", "often", "oh", "ok", "okay", "old", "on", "once", "ones", "only", "onto", "or", "other", "others",
  31.             "otherwise", "ought", "our", "ours", "ourselves", "out", "outside", "over", "overall", "own", "p", "particular", "particularly", "per", "perhaps",
  32.             "placed", "please", "plus", "possible", "presumably", "probably", "provides", "q", "que", "quite", "qv", "r", "rather", "rd", "re", "really",
  33.             "reasonably", "regarding", "regardless", "regards", "relatively", "respectively", "right", "s", "said", "same", "saw", "say", "saying", "says",
  34.             "second", "secondly", "see", "seeing", "seem", "seemed", "seeming", "seems", "seen", "self", "selves", "sensible", "sent", "serious", "seriously",
  35.             "several", "shall", "she", "should", "since", "so", "some", "somebody", "somehow", "someone", "something", "sometime", "sometimes", "somewhat",
  36.             "somewhere", "soon", "sorry", "specified", "specify", "specifying", "still", "sub", "such", "sup", "sure", "t", "take", "taken", "tell", "tends",
  37.             "th", "than", "thank", "thanks", "thanx", "that", "thats", "the", "their", "theirs", "them", "themselves", "then", "thence", "there", "thereafter",
  38.             "thereby", "therefore", "therein", "theres", "thereupon", "these", "they", "think", "third", "this", "thorough", "thoroughly", "those", "though",
  39.             "through", "throughout", "thru", "thus", "to", "together", "too", "took", "toward", "towards", "tried", "tries", "truly", "try", "trying", "twice",
  40.             "u", "un", "under", "unfortunately", "unless", "unlikely", "until", "unto", "up", "upon", "us", "use", "used", "useful", "uses", "using",
  41.             "usually", "uucp", "v", "value", "various", "you've", "very", "via", "viz", "vs", "w", "want", "wants", "was", "way", "we", "welcome", "well",
  42.             "went", "were", "what", "whatever", "when", "whence", "whenever", "where", "whereafter", "whereas", "whereby", "wherein", "whereupon", "wherever",
  43.             "whether", "which", "while", "whither", "who", "whoever", "whole", "whom", "whose", "why", "will", "willing", "wish", "with", "within", "without",
  44.             "wonder", "would", "x", "y", "crap", "nigga", "yes", "yet", "you", "you'll", "your", "yours", "yourself", "yourselves", "z", "zero");
  45.  
  46.     public static void main(String[] args) throws IOException {
  47.         File folder = new File("/home/aditya/Desktop/inputforCleaning/");
  48.         File[] filesList = folder.listFiles();
  49.         int count = 0;
  50.         for (int i = 0; i < filesList.length; i++) {
  51.             FileReader file = new FileReader("/home/aditya/Desktop/inputforCleaning/" + filesList[i].getName().toString());
  52.             BufferedReader reader = new BufferedReader(file);
  53.             PrintWriter pw = new PrintWriter("/home/aditya/Desktop/OutPutforCleaning/File" + count + ".txt");
  54.             String fromFile = reader.readLine();
  55.             while (fromFile != null) {
  56.                 String[] array = fromFile.split(" +");
  57.                 for (int z = 0; z < array.length; z++) {
  58.                     if (wordList.contains(array[z].toLowerCase()))
  59.                         array[z] = "";
  60.                 }
  61.                 for (int z = 0; z < array.length; z++) {
  62.                     array[z] = array[z].replace("\"", "");
  63.                     array[z] = array[z].replace("-", "");
  64.                     array[z] = array[z].replace(".", "");
  65.                     array[z] = array[z].replace("!", "");
  66.                     array[z] = array[z].replace(":", "");
  67.                     array[z] = array[z].replace("'", "");
  68.                     array[z] = array[z].replace("&", "");
  69.                     array[z] = array[z].replace("$", "");
  70.                     array[z] = array[z].replace("(", "");
  71.                     array[z] = array[z].replace(")", "");
  72.                     array[z] = array[z].replace("*", "");
  73.                     array[z] = array[z].replace(",", "");
  74.                     array[z] = array[z].replace("?", "");
  75.                     array[z] = array[z].replace("-", "");
  76.                     array[z] = array[z].replace("+", "");
  77.                 }
  78.                 for (int z = 0; z < array.length; z++) {
  79.                     pw.append(array[z] + " ");
  80.                 }
  81.                 pw.println("");
  82.                 fromFile = reader.readLine();
  83.             }
  84.             pw.close();
  85.             count++;
  86.         }
  87.     }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement