Not understanding vector part

i am not able to understand this completely… here from the vector part where we are creating a vector … we are creating a vector and then we will find the word associated with it right?? but then why we used the code to create ones matrix??

Hey Kushal,
What we are doing here is to convert a sentence of words (a string) to an array containing numbers. The value at a particuar index of that array represents the number of times that word occurs in the sentence, ie, every word has been assigned an index in that array.

Yes, we are finding the word associated with it but we are not replacing it with the numbers. We are just doing that to know which index corresponds to which word. That’s it. We are using this countvectoriser tool to convert string to an integer containing array so that we can feed it to our model.

I hold the clears your doubt.