Processing the input data
Text data cannot be fed directly into any neural network, since neural networks can understand only numbers. We will treat each word as a one-hot encoded vector of a length that is equal to the number of words present in each corpus. If the English corpus contains 1,000 words, the one-hot encoded vectors ve would be of a dimension of 1,000, that is, ve ∈ R1000 x 1.
We will read through the English and the French corpus and determine the number of unique words in each of them. We will also represent the words by index, and for a one-hot encoded vector for the word, the index corresponding to the word would be set to one, while the rest of the indices would be set to zero. For example, let's assume that in the English ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access