<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Similarity among documents
Step1:  What if want to understand which words are more similar in this context?
Similarity among words
<ASSISTANT_TASK:>
Python Code:
from sklearn.metrics.pairwise import cosine_similarity
similarity=cosine_similarity(document_term_matrix)
pd.DataFrame(similarity)
Explanation: Similarity among documents
End of explanation
similarity=cosine_similarity(document_term_matrix.T)
pd.DataFrame(similarity, index=vocab, columns=vocab)
Explanation: What if want to understand which words are more similar in this context?
Similarity among words
End of explanation
<END_TASK>