def split_sections(element):
  """Splits an article into sections, treating tables separately."""
  key, article = element
  total = 0
  for subkey, section in wiki_utils.split_article(article["text"]):
    if not section:
      continue
    beam.metrics.Metrics.counter(__name__, "sections").inc()
    new_key = (key, subkey)
    article["text"] = section
    yield new_key, article
    total += 1
  beam.metrics.Metrics.distribution(__name__, "sections_dist").update(total)
Splits an article into sections, treating tables separately.
language/fruit/beam_pipelines.py