public static boolean passesNgramFilter(List<String> tokenList,Set<String> stopwords,boolean filterPartialMatches){
  List<String> filteredList=new ArrayList<String>();
  for (  String ngram : tokenList) {
    if (!stopwords.contains(ngram)) {
      filteredList.add(ngram);
    }
  }
  if (filterPartialMatches) {
    return filteredList.size() == tokenList.size();
  }
 else {
    return filteredList.size() != 0;
  }
}

public static boolean passesNgramFilter ( List < String > tokenList , Set < String > stopwords , boolean filterPartialMatches ) { List < String > filteredList = new ArrayList < String > ( ) ; for ( String ngram : tokenList ) { if ( ! stopwords . contains ( ngram ) ) { filteredList . add ( ngram ) ; } } if ( filterPartialMatches ) { return filteredList . size ( ) == tokenList . size ( ) ; } else { return filteredList . size ( ) != 0 ; } }
an ngram ( represented by the list of tokens ) does not pass the stopword filter : a ) filterpartialmatches = true - if it contains any stopwords b ) filterpartialmatches = false - if it entirely consists of stopwords
