Exercise

# Part 2: Exploring the to_categorical() function

In part 1, you implemented the `compute_onehot_length()`

function which did not use the `num_classes`

argument while computing onehot vectors.

The `num_classes`

argument controls the length of the one-hot encoded vectors produced by the `to_categorical()`

function. You will see that in situations where you have two different corpora (i.e. collections of texts) with different vocabularies, leaving the `num_classes`

undefined can result in one-hot vectors of varying length.

For this exercise, the `compute_onehot_length()`

function and the `word2index`

dictionary have been provided.

Instructions

**100 XP**

- Call
`compute_onehot_length()`

on`words_1`

. - Call
`compute_onehot_length()`

on`words_2`

. - Print the lengths of one-hot vectors obtained for
`words_1`

and`words_2`

.