code: def extract_snippets_from_page(
      page,
      min_content_len=500,
      snippet_len=(150, 500),
      min_text_frac=0.9,
      exclude_en=False,
      max_n=10,
  ):
      """
      Args:
          page (:class:`wikipedia.WikipediaPage`)
          min_content_len (int)
          snippet_len (Tuple[int, int])
          min_text_frac (float)
          exclude_en (bool)
          max_n (int)
  
      Returns:
          List[str]
      """
      logging.debug("... extracting snippets from page %s", page.title)
      snippets = []
      content = page.content
      if len(content) < min_content_len:
          logging.debug(
              "...... content too short: %s < %s",
              len(content),
              min_content_len,
          )
          return snippets
      for section in re_sections.split(content):
          if len(snippets) >= max_n:
              break
          for snippet in re_breaking_whitespace.split(section.strip()):
              if len(snippets) >= max_n:
                  break
              snippet = re_whitespace.sub(" ", snippet).strip()
              snippet = re_citation.sub("", snippet)
              if is_good_snippet(
                  snippet, snippet_len, min_text_frac, exclude_en
              ):
                  snippets.append(snippet)
      logging.debug(
          "... extracted %s snippets from page %s",
          len(snippets),
          page.title,
      )
      return snippets
  
file_path: textacy/scripts/fetch_wiki_lang_snippets.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import datetime
  import io
  import logging
  import os
  import random
  import re
  import sys
  import time
  import warnings
  import wikipedia
  from cld2 import detect
  from tqdm import tqdm
label_desc: Use image node_id 5 for calling a global function with example usage: extract_snippets_from_page(page, min_content_len, snippet_len, min_text_frac, exclude_en, max_n) and returns: snippets, snippets