Created
October 14, 2023 20:51
-
-
Save hessius/3253eae752d7a0c1a29a62f1e7a24081 to your computer and use it in GitHub Desktop.
PatentTrollPriorArtFinder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
DISCLAIMER: This script is provided as-is and has not been rigorously tested. | |
Please proceed with caution and consult legal advice for any patent-related matters. | |
Instructions: | |
1. Install the required package by running `pip install google_patent_scraper` in your terminal. | |
2. Save this script in a Python file (e.g., search_prior_art.py). | |
3. Run the script by executing `python search_prior_art.py` in your terminal. | |
4. A CSV file named `prior_art.csv` will be generated, which you can then import into Google Sheets. | |
""" | |
from google_patent_scraper import scraper | |
from datetime import datetime | |
import csv | |
# Keywords extracted from the patent | |
keywords = [ | |
'beverage', 'brew', 'brewing', 'chamber', 'control', 'flow', | |
'infused', 'infusion', 'invention', 'management', 'operable', | |
'pressure', 'process', 'rate', 'solute', 'solvent', 'temperature' | |
] | |
def search_prior_art(keywords, max_results=10, output_csv='prior_art.csv'): | |
""" | |
Search for prior art using Google Patent based on keywords and output to a CSV. | |
Parameters: | |
keywords (list): List of keywords to use for the search | |
max_results (int): Maximum number of results to fetch | |
output_csv (str): The name of the output CSV file | |
Returns: | |
None | |
""" | |
# Initialize CSV | |
with open(output_csv, 'w', newline='') as csvfile: | |
fieldnames = ['ID', 'Prior Art', 'Found by', 'Date', 'Target Claims', 'Brief Description'] | |
writer = csv.DictWriter(csvfile, fieldnames=fieldnames) | |
writer.writeheader() | |
# Convert the date of the patent in question to a datetime object | |
patent_date = datetime.strptime('2015-08-06', '%Y-%m-%d') | |
for keyword in keywords: | |
print(f"Searching prior art for keyword: {keyword}") | |
# Perform the search | |
results = scraper.search(keyword, max_results=max_results) | |
# Filter and write the results to CSV | |
for i, result in enumerate(results): | |
pub_date_str = result.get('publication_date', 'N/A') | |
pub_date = datetime.strptime(pub_date_str, '%Y-%m-%d') if pub_date_str != 'N/A' else None | |
if pub_date and pub_date < patent_date: | |
title = result.get('title', 'N/A') | |
patent_id = result.get('patent_id', 'N/A') | |
patent_link = f"https://patents.google.com/patent/{patent_id}" | |
print(f"{i+1}. {title} ({pub_date_str}) - Patent ID: {patent_id}") | |
writer.writerow({ | |
'ID': i+1, | |
'Prior Art': patent_link, | |
'Found by': '', # To be filled manually | |
'Date': pub_date_str, | |
'Target Claims': '', # To be filled manually | |
'Brief Description': title # Or fill manually | |
}) | |
if __name__ == "__main__": | |
search_prior_art(keywords) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment