def count_covered_examples(matrix, vocabulary_size):
  """Returns the number of examples whose added phrases are in the vocabulary.

  This assumes the vocabulary is created simply by selecting the
  `vocabulary_size` most frequent phrases.

  Args:
    matrix: Phrase occurrence matrix with the most frequent phrases on the
      left-most columns.
    vocabulary_size: Number of most frequent phrases to include in the
      vocabulary.
  """
  # Ignore the `vocabulary_size` most frequent (i.e. leftmost) phrases (i.e.
  # columns) and count the rows with zero added phrases.
  return (matrix[:, vocabulary_size:].sum(axis=1) == 0).sum()