Skip to content

Instantly share code, notes, and snippets.

@andrea-dagostino
Created October 3, 2022 22:13
Show Gist options
  • Save andrea-dagostino/234fb9ebb01e3f7fe06dbd1b1e07c9e6 to your computer and use it in GitHub Desktop.
Save andrea-dagostino/234fb9ebb01e3f7fe06dbd1b1e07c9e6 to your computer and use it in GitHub Desktop.
text_sim_tfidf
M = np.zeros((posts.shape[0], posts.shape[0])) # we create a 30x30 matrix to contain the results of article_i with article_j
for i, row in tqdm(posts.iterrows(), total=posts.shape[0], desc='1st level'): # we define i
for j, next_row in posts.iterrows(): # we define j
M[i, j] = compute_similarity(row.article, next_row.article) # we populate the matrix with the results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment