code: def filter_ngram(gram, mode="any"):
      """
      Decide whether to keep or discard an n-gram.
  
      :param gram:
          list of tokens (length N)
      """
      return any(filter_word(w) for w in gram)
  
file_path: ParlAI/parlai/agents/tfidf_retriever/utils.py
imports: import regex
  import unicodedata
  import numpy
  import scipy.sparse
  from sklearn.utils import murmurhash3_32
label_desc: Use image node_id 6 for calling a global function with example usage: filter_ngram(gram, mode) and returns: any