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

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

    RETURN:
      unique_words (int)    total number of unique words in dataset
    """
    all_words = list()
    for d in dataset:
        words = d[index].split(" ")
        all_words.extend(words)

    unique_words = len(set(all_words))
    return unique_words