cv_matrix cv fit_transform(norm_corpuscv_matrix cv_matrix toarray(cv_matrix out[ ]array([[ ][ ][ ][ ][ ][ ]]dtype=int the output represents numeric term frequency based feature vector for each document like we mentioned before to understand it betterwe can represent it using the feature names and view it as dataframe in [ ]vocab cv get_feature_names(pd dataframe(cv_matrixcolumns=vocabout[ ]beautiful blue brown dog fox jumps lazy love quick sky today we can clearly see now that each row of the dataframe depicts the term frequency vector for each text document hence the name bag of words because this model represents unstructured text into bag of words without taking into account word positionssyntaxor semantics bag of -grams model we have used single word terms as features in the above mentioned bag of words model but what if we also wanted to take into account phrases or collection of words which occur in sequencen-grams help us achieve that an -gram is basically collection of word tokens from text document such that these tokens are contiguous and occur in sequence bi-grams indicate -grams of order (two words)tri-grams indicate -grams of order (three words)and so on we can easily extend the bag of words model to use bag of -grams model to give us -gram based feature vectors the following code computes bi-gram based features on our corpus in [ ]bv countvectorizer(ngram_range=( , )bv_matrix bv fit_transform(norm_corpusbv_matrix bv_matrix toarray(vocab bv get_feature_names(pd dataframe(bv_matrixcolumns=vocab