Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Created November 24, 2022 20:23
Show Gist options
  • Save Abhayparashar31/d27b3036168d1c5bd0351e4b7c11617a to your computer and use it in GitHub Desktop.
Save Abhayparashar31/d27b3036168d1c5bd0351e4b7c11617a to your computer and use it in GitHub Desktop.
'''
Finding Similar Stackoverflow Questions.
'''
from autoscraper import AutoScraper
url = 'https://stackoverflow.com/questions/67483624/how-to-install-tensorflow-object-detection-api-offline'
wanted_list = ["How to know if an object has an attribute in Python?"]
scraper = AutoScraper()
result = scraper.build(url, wanted_list)
print(scraper.get_result_similar('https://stackoverflow.com/questions/273192/how-can-i-safely-create-a-nested-directory-in-python'))
'''
['How can I get the source directory of a Bash script from within the script itself?', 'How to execute a program or call a system command?', 'How can I add a blank directory to a Git repository?', 'How can a file be copied?', 'How to get the current time in Python', 'How can I add new keys to a dictionary?', 'How do I concatenate two lists in Python?', 'How do I list all files of a directory?', 'How to find if directory exists in Python']
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment