"""SPARC - Semiconductor Patent & Analytics Report Core Example usage of the company performance analyzer. Before running: 1. Create a .env file with: API_KEY=your_serpapi_key OPENROUTER_API_KEY=your_openrouter_key 2. Run: python main.py """ from SPARC.analyzer import CompanyAnalyzer def main(): """Analyze a company's performance based on their patent portfolio.""" # Initialize the analyzer (loads API keys from .env) analyzer = CompanyAnalyzer() # Analyze a company - this will: # 1. Retrieve patents from SERP API # 2. Download and parse patent PDFs # 3. Minimize content (remove bloat) # 4. Analyze with Claude to estimate performance company_name = "nvidia" print(f"\n{'=' * 70}") print(f"SPARC Patent Analysis - {company_name.upper()}") print(f"{'=' * 70}\n") analysis = analyzer.analyze_company(company_name) print(f"\n{'=' * 70}") print("ANALYSIS RESULTS") print(f"{'=' * 70}\n") print(analysis) print(f"\n{'=' * 70}\n") if __name__ == "__main__": main()