import string
import re


def _normalize_text(text):
  """Normalize text for TweetQA task.

  Args:
    text: string
  Returns:
    normalized string
  """

  # Lower case.
  text = text.lower()

  # Remove punctuation.
  text = ''.join(ch for ch in text if ch not in set(string.punctuation))

  # Remove articles.
  text = re.sub(r'\b(a|an|the)\b', ' ', text)

  # Fix extra whitespaces.
  text = ' '.join(text.split())

  return text