

If we run the code based on that, we will get the result like this, query: barcelona Berikut artikel dengan nilai cosine similarity tertinggi: Nilai Similaritas: 0.4641990113096689 kompas com perombakan skuad yang dilakukan pelatih anyar barcelona ronald koeman memakan korban baru terkini ronald koeman dikabarkan akan mendepak bintang muda barcelona yang baru berusia tahun riqui puig menurut media spanyol rac koeman sudah meminta riqui puig mencari tim baru karena tidak masuk dalam rencananya di barcelona rumor itu semakin kuat karena puig. Suppose that we want to find articles that talk about Barcelona. 1) link = for i in soup.find('div', # Calculate the similarity for i in range(10): sim = np.dot(df.loc.values, q_vec) / np.linalg.norm(df.loc) * np.linalg.norm(q_vec) # Sort the values sim_sorted = sorted(sim.items(), key=lambda x: x, reverse=True) # Print the articles and their similarity values for k, v in sim_sorted: if v != 0.0: print("Nilai Similaritas:", v) print(docs) print() # Add The Query q1 = 'barcelona' # Call the function get_similar_articles(q1, df) Here is the code that I used for extracting the documents and its explanations on each line, import requests from bs4 import BeautifulSoup # Make a request to the website r = requests.get(' ') # Create an object to parse the HTML format soup = BeautifulSoup(r.content, 'html.parser') # Retrieve all popular news links (Fig.
