code: def filter_sentence(
      sentences: List[str],
      condition: Optional[Callable[[str], bool]] = None,
  ) -> Tuple[List[str], List[bool]]:
      """
      Filter sentence based on some condition, and returns filter mask
  
      Parameters
      ----------
      sentences:
          list of sentences
  
      condition:
          sentence filtering condition
  
      Returns
      ---------
      sentences:
          list of sentences filtered
  
      mask:
          boolean mask such that `mask[i] == True` if the i'th sentence is included in the
          filtered sentence, otherwise `mask[i] == False`
  
      Examples
      --------
      >>> from cleanlab.internal.token_classification_utils import filter_sentence
      >>> sentences = ["Short sentence.", "This is a longer sentence."]
      >>> condition = lambda x: len(x.split()) > 2
      >>> long_sentences, _ = filter_sentence(sentences, condition)
      >>> long_sentences
      ['This is a longer sentence.']
      >>> document = ["# Headline", "Sentence 1.", "&", "Sentence 2."]
      >>> sentences, mask = filter_sentence(document)
      >>> sentences, mask
      (['Sentence 1.', 'Sentence 2.'], [False, True, False, True])
      """
      if not condition:
          condition = (
              lambda sentence: len(sentence) > 1 and "#" not in sentence
          )
      mask = list(map(condition, sentences))
      sentences = [
          sentence for m, sentence in zip(mask, sentences) if m
      ]
      return sentences, mask
  
file_path: cleanlab/cleanlab/internal/token_classification_utils.py
imports: from __future__ import annotations
  import re
  import string
  import numpy
  from termcolor import colored
  from typing import List, Optional, Callable, Tuple, TypeVar, TYPE_CHECKING
label_desc: Use image node_id 2 for calling a global function with example usage: filter_sentence(sentences, condition) and returns: sentences,  mask