code: def detect_english(page: PageFeatures, min_probability=0.99):
      """Yields page iff text is 'en' with at least `min_probability`."""
      text = page.text
  
      counter_inc_fn = get_counter_inc_fn("english-filter")
  
      langdetect = tfds.core.lazy_imports.langdetect
      # Make langdetect predictions deterministic.
      with langdetect_lock:
          langdetect.DetectorFactory.seed = 0
          try:
              predictions = langdetect.detect_langs(text)
          except langdetect.lang_detect_exception.LangDetectException:
              counter_inc_fn("filtered:langdetect_exception")
              return
      if not predictions:
          counter_inc_fn("filtered:no_predictions")
          return
      best_prediction = predictions[0]
      if best_prediction.prob < min_probability:
          counter_inc_fn("filtered:low_confidence")
          return
      if best_prediction.lang != "en":
          counter_inc_fn("filtered:ignored_language")
          counter_inc_fn(
              "filtered:ignored_language-%s" % (best_prediction.lang,)
          )
          return
  
      counter_inc_fn("passed")
      yield dataclasses.replace(page, language="en")
  
imports: import dataclasses
  import functools
  import gzip
  import hashlib
  import heapq
  import io
  import re
  import threading
  from typing import Collection, Iterable, Mapping, Optional, Sequence, Tuple
  from absl import logging
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 5 for calling a global function with example usage: detect_english(page, min_probability) without return types