def _totalWords(dataset, index):
    """
    Given a dataset, compute the total number of words at the given index.

    GIVEN:
      dataset (list)    list of lists, where each sublist is a document
      index (int)       index in dataset to count words

    RETURN:
      total_words (int) total number of words in the dataset
    """
    total_words = 0
    for d in dataset:
        words = d[index].split(" ")
        total_words += len(words)

    return total_words