<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 There are at least two ways of vectorizing the collection, one is by simple count, the other is use the term frequency * inversed document frequency (to reduce the weight imposed by the very common words but meaningless words such as a, the, and, etc.). Let's start with the first one.
Step1:  Now let's try the second vectorization method
Step2:  if we add a new document 'meow squeak' to the collection, let's see the difference.
<ASSISTANT_TASK:>
Python Code:
# create a collection matrix (using the count vectorizer)
countVectorizer = CountVectorizer()
# The CountVectorizer will return a document-term sparse matrix
# the rows represent the documents, and the columns represent terms
# since we have only 2 documents, I use 2 variables to represent the 2 vectors returned
d1_count, d2_count, q_count = countVectorizer.fit_transform(col)
print(d1_count.shape)
print(d2_count.shape)
print(q_count.shape)
def content(name):
    '''
    print out the cosine similarity result
    
    params:
    -----------------
    name: the variable name for the cosine similarity function output (a 1X1 matrix in our case)
    '''
    return 'The cosine similarity between the two docs is {name:.4}.'.format(name=name[0][0])
# let's see the cosine similarity of the two documents first
cs_docs = cosine_similarity(d1_count, d2_count)
print(content(cs_docs))
# create a query matrix
d1_q = cosine_similarity(d1_count, q_count)
print(content(d1_q))
d2_q = cosine_similarity(d2_count, q_count)
print(content(d2_q))
# so the query will probably return the first file for us
Explanation: There are at least two ways of vectorizing the collection, one is by simple count, the other is use the term frequency * inversed document frequency (to reduce the weight imposed by the very common words but meaningless words such as a, the, and, etc.). Let's start with the first one.
End of explanation
tfidfVectorizer = TfidfVectorizer()
d1_tf, d2_tf, q_tf = tfidfVectorizer.fit_transform(col)
for i in (d1_tf, d2_tf, q_tf):
    print(i.shape)
# again, cosine similarities
cs_docs_tf = cosine_similarity(d1_tf, d2_tf)
print(content(cs_docs_tf))
cs_d1_q_tf = cosine_similarity(d1_tf, q_tf)
print(content(cs_d1_q_tf))
cs_d2_q_tf = cosine_similarity(d2_tf, q_tf)
print(content(cs_d2_q_tf))
Explanation: Now let's try the second vectorization method
End of explanation
d3 = 'meow squeak'
cols = (d1, d2, d3)
d1_tf, tf, d3_tf = tfidfVectorizer.fit_transform(cols)
cs_d1_d2 = cosine_similarity(d1_tf, d2_tf)
print(content(cs_d1_d2))
Explanation: if we add a new document 'meow squeak' to the collection, let's see the difference.
End of explanation
<END_TASK>