/** * Given a list and a ngram, this method will delete all those ngrams present in the list which * are superstring of the given ngram and return the updated list. * * @param list * @param ngrams * @return */ public static ArrayList<TokenDetails> deleteNgramsSubsumed( ArrayList<TokenDetails> list, String ngrams) { ArrayList<TokenDetails> returnList = new ArrayList<TokenDetails>(); int size = list.size(); for (int i = 0; i < size; i++) { TokenDetails td = list.get(i); String s = td.getToken(); if (!Utility.isSubsumedBy(ngrams, s)) { // System.out.println("Token added:"+s); returnList.add(td); } else { System.out.println("Removing token:" + s); } } return returnList; }