January 2019
Intermediate to advanced
342 pages
9h 17m
English
The tweets need to be tokenized and converted into numbers before they can be fed to the neural network. The count vectorizer is used to determine a fixed number of frequent words that form the vocabulary space for the chatbot. We also introduce three new tokens that signify the start of a sentence (START), the end of a sentence (PAD), and also any unknown words (UNK). The function to tokenize tweets is shown here for reference:
def tokenize_text(self,in_text,out_text): count_vectorizer = CountVectorizer(tokenizer=casual_tokenize, max_features=self.max_vocab_size - 3) count_vectorizer.fit(in_text + out_text) self.analyzer = count_vectorizer.build_analyzer() self.vocabulary = {key_: value_ + 3 for key_,value_ ...Read now
Unlock full access