import re


def replace_titles(targets, predictions):
  """Replaces titles with a __unk__ token."""

  def replace_fn(text):
    return re.sub(r"\@([^@]*\([^@]*\)[^@]*)\@", "__unk__", text)

  return (list(map(replace_fn, targets)), list(map(replace_fn, predictions)))