Skip to content
Advertisement

Tag: vector

Counting specific words in a sentence

I am currently trying to solve this homework question. My task is to implement a function that returns a vector of word counts in a given text. I am required to split the text into words then use NLTK’s tokeniser to tokenise each sentence. This is the code I have so far: There are two doctests that should give the

Subtracting 2 lists in Python

Right now I have vector3 values represented as lists. is there a way to subtract 2 of these like vector3 values, like Should I use tuples? If none of them defines these operands on these types, can I define it instead? If not, should I create a new vector3 class? Answer If this is something you end up doing frequently,

Advertisement