### Run Full Citation Workflow - Command Line Source: https://context7.com/yingpengma/awesome-story-generation/llms.txt Executes the complete citation workflow from the command line, encompassing paper synchronization, citation fetching, and README badge updates in a single operation. This script automates the entire process. ```bash # Run the full citation workflow python citation_workflow.py # Expected output: # ⏰ 启动时间: 2025-07-12 16:30:00 # -------------------------------------------------------------------------------- # 论文引用数管理工具 # -------------------------------------------------------------------------------- # [步骤 1/3] 同步论文列表 # ✅ 成功从 README.md 中提取了 85 篇论文 # ... # [步骤 2/3] 获取最新引用数 # ... # [步骤 3/3] 更新README.md中的引用标签 # ... # ✅ 步骤3 - README更新: 完成 # ⏰ 完成时间: 2025-07-12 16:35:00 ``` -------------------------------- ### Run Citation Workflow Source: https://context7.com/yingpengma/awesome-story-generation/llms.txt Initializes and runs the complete citation management workflow. This includes synchronizing paper lists between README.md and a JSON file, fetching citation counts from the Semantic Scholar API, and updating citation badges in the README. It handles configuration for file paths, API delays, and skipping recent updates. ```python from citation_workflow import CitationWorkflow # Initialize the workflow workflow = CitationWorkflow() # Configure settings (defaults shown) workflow.readme_file = 'README.md' # Source markdown file workflow.citations_file = 'citations.json' # Citation data storage workflow.api_delay = 1 # Seconds between API requests workflow.skip_recent_hours = 24 # Skip papers updated within this window # Run the complete workflow workflow.run_workflow() # Output: # [步骤 1/3] 同步论文列表 # ✅ 成功从 README.md 中提取了 85 篇论文 # ✅ 成功加载 citations.json,现有 85 篇论文 # 📋 开始同步论文列表... # ✅ 论文列表同步完成! # [步骤 2/3] 获取最新引用数 # ... # [步骤 3/3] 更新README.md中的引用标签 # ✅ 内容完整性验证通过 ``` -------------------------------- ### Synchronize Paper List Source: https://context7.com/yingpengma/awesome-story-generation/llms.txt Synchronizes the list of papers between the README.md file and the citations.json database. It identifies new papers in the README to add, preserves existing citation data, and removes entries from the JSON that are no longer present in the README. ```python from citation_workflow import CitationWorkflow workflow = CitationWorkflow() citations_data = workflow.sync_papers() # Output: # [步骤 1/3] 同步论文列表 # ✅ 成功从 README.md 中提取了 85 篇论文 # ✅ 成功加载 citations.json,现有 82 篇论文 # 📋 开始同步论文列表... # ➕ 添加新论文:New Paper Title 1 # ➕ 添加新论文:New Paper Title 2 # ✅ 论文列表同步完成! # 📊 当前总计:85 篇论文 # ➕ 新增:3 篇 # 📋 数据清理:0 篇 print(f"Total papers: {len(citations_data['papers'] অ্যাপ্লিকেশন)}") ``` -------------------------------- ### Load and Save Citation Data Source: https://context7.com/yingpengma/awesome-story-generation/llms.txt Manages the loading and saving of citation data to and from a JSON file. The data is structured as a dictionary mapping paper titles to their citation counts and last updated timestamps. It includes error handling for missing files, creating an empty structure if necessary. ```python from citation_workflow import CitationWorkflow workflow = CitationWorkflow() # Load existing citations data = workflow.load_citations() # Output: ✅ 成功加载 citations.json,现有 85 篇论文 # Access paper data paper = data['papers']['AutoAgents: A Framework for Automatic Agent Generation'] print(f"Citations: {paper['citations']}") print(f"Last updated: {paper['last_updated']}") # Citations: 129 # Last updated: 2025-07-12-04:09:30 # Modify and save data['papers']['New Paper Title'] = { 'title': 'New Paper Title', 'citations': 0, 'last_updated': '1970-01-01-00:00:00' } workflow.save_citations(data) ``` -------------------------------- ### Batch Fetch Citations for Papers - Python Source: https://context7.com/yingpengma/awesome-story-generation/llms.txt Fetches citation counts for multiple papers, prioritizing those least recently updated. It skips papers updated within the last 24 hours to minimize API calls and adhere to rate limits. This function is part of the CitationWorkflow class. ```python from citation_workflow import CitationWorkflow workflow = CitationWorkflow() citations_data = workflow.sync_papers() # Get citations for all papers updated_data, updated_papers_list = workflow.get_citations(citations_data) # Output: # [步骤 2/3] 获取最新引用数 # 📊 论文更新优先级排序(共85篇,按最后更新时间升序): # 1. 引用: 0, 最后更新: 1970-01-01-00:00:00 # 2. 引用: 7, 最后更新: 2025-07-12-04:08:46 # ... 还有 80 篇论文 # 📊 需要更新: 5 篇,跳过: 80 篇(24小时内已更新) # ... # ✅ 成功更新: 5 (5.9%) # ⏭️ 跳过(24小时内已更新): 80 (94.1%) print(f"Updated {len(updated_papers_list)} papers") ``` -------------------------------- ### Extract Paper Titles from Markdown Source: https://context7.com/yingpengma/awesome-story-generation/llms.txt Extracts paper titles from a README.md file using regular expressions. It specifically looks for titles formatted in bold markdown (**Title**) followed by links. The function returns a cleaned list of titles, filtering out any that are too short. ```python from citation_workflow import CitationWorkflow workflow = CitationWorkflow() titles = workflow.extract_titles_from_md() # Output: # ✅ 成功从 README.md 中提取了 85 篇论文 print(f"Found {len(titles)} papers") print(f"First paper: {titles[0]}") # Found 85 papers # First paper: What Makes a Good Story and How Can We Measure It? A Comprehensive Survey of Story Evaluation ``` -------------------------------- ### Extract Authors from README for a Paper - Python Source: https://context7.com/yingpengma/awesome-story-generation/llms.txt Extracts author information for a specific paper from the README.md file. This is useful for manual verification when Semantic Scholar returns a non-matching title. This function is part of the CitationWorkflow class. ```python from citation_workflow import CitationWorkflow workflow = CitationWorkflow() # Extract authors for a paper title = "AutoAgents: A Framework for Automatic Agent Generation" authors = workflow.extract_authors_from_readme(title) print(f"Authors: {authors}") # Authors: Guangyao Chen, Siwei Dong, Yu Shu, Ge Zhang, Jaward Sesay, Börje F. Karlsson, Jie Fu, Yemin Shi ``` -------------------------------- ### Update Citation Badges in README - Python Source: https://context7.com/yingpengma/awesome-story-generation/llms.txt Updates citation badges in the README.md file for papers that have been successfully updated. It performs strict content validation to ensure only badge values are modified, preserving all other content. This function is part of the CitationWorkflow class. ```python from citation_workflow import CitationWorkflow workflow = CitationWorkflow() citations_data = workflow.sync_papers() updated_data, updated_papers_list = workflow.get_citations(citations_data) # Update README badges success = workflow.update_readme_citations(updated_data, updated_papers_list) # Output: # [步骤 3/3] 更新README.md中的引用标签 # 📄 开始更新 5 篇论文的citation badges... # ✅ 成功更新: 'RecurrentGPT: Interactive Generation of (Arbitrarily...' → 64 引用 # ✅ 成功更新: 'AutoAgents: A Framework for Automatic Agent Genera...' → 129 引用 # 🔍 验证内容完整性... # ✅ 内容完整性验证通过 # 💾 README.md 更新完成! # ✅ 成功更新: 5 个citation badges if success: print("README updated successfully") ``` -------------------------------- ### Update Single Paper Citation Count Source: https://context7.com/yingpengma/awesome-story-generation/llms.txt Fetches the citation count for a specific paper from the Semantic Scholar API. It uses exact title matching and includes logic for handling API rate limits through retries. Updates are immediately saved to the JSON citation file. ```python from citation_workflow import CitationWorkflow workflow = CitationWorkflow() citations_data = workflow.load_citations() # Update a specific paper title = "RecurrentGPT: Interactive Generation of (Arbitrarily) Long Text" success, result = workflow.update_paper_citation(title, citations_data, retry_limit=3) # Output: # 📖 论文: 'RecurrentGPT: Interactive Generation of (Arbitrarily) Long Text' # ✅ 更新成功: 60 → 64 (📈 +4) # 🔗 论文链接: https://www.semanticscholar.org/paper/... if success: print(f"New citation count: {result}") else: print(f"Update failed: {result}") ``` -------------------------------- ### Citations Data JSON Structure Source: https://context7.com/yingpengma/awesome-story-generation/llms.txt Defines the JSON structure for storing paper metadata, including citation counts and last updated timestamps. Each paper entry contains its title, current citation count, and the last update time in ISO format. ```json { "papers": { "AutoAgents: A Framework for Automatic Agent Generation": { "title": "AutoAgents: A Framework for Automatic Agent Generation", "citations": 129, "last_updated": "2025-07-12-04:09:30" }, "RecurrentGPT: Interactive Generation of (Arbitrarily) Long Text": { "title": "RecurrentGPT: Interactive Generation of (Arbitrarily) Long Text", "citations": 64, "last_updated": "2025-07-12-04:10:16" } } } ``` -------------------------------- ### Check if Paper was Recently Updated - Python Source: https://context7.com/yingpengma/awesome-story-generation/llms.txt Checks if a paper's last update timestamp falls within a configurable skip window, defaulting to 24 hours. Returns True if the paper should be skipped to prevent redundant API calls. This function is part of the CitationWorkflow class. ```python from citation_workflow import CitationWorkflow workflow = CitationWorkflow() workflow.skip_recent_hours = 24 # Skip papers updated in last 24 hours # Check various timestamps recent = workflow.is_recently_updated("2025-07-12-16:00:00") old = workflow.is_recently_updated("2025-07-10-00:00:00") invalid = workflow.is_recently_updated("1970-01-01-00:00:00") print(f"Recent update (skip): {recent}") # True - skip this paper print(f"Old update (process): {old}") # False - needs update print(f"Invalid/new (process): {invalid}") # False - needs update ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.