anbeime/skill / skills/paper-analysis-assistant/paper-analysis-assistant
paper-analysis-assistant
Verified其他高等院校教师与数据科学家在追踪前沿学术时,当需要深度解析arXiv论文,用此技能可一键下载PDF并自动生成词频分析、双人播客、交互式网页、PPT演示与总结图,将数小时的文献阅读转化为多媒体内容,效率提升十倍!
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.7 KB |
| references/stopwords.txt | markdown | 954 B |
| scripts/analyze_word_frequency.py | script | 3.2 KB |
| scripts/dialogue_to_podcast.py | script | 4.6 KB |
| scripts/download_pdf.py | script | 2.0 KB |
| scripts/extract_references.py | script | 3.1 KB |
| scripts/extract_text.py | script | 1.8 KB |
| scripts/generate_html.py | script | 7.0 KB |
| scripts/generate_ppt.py | script | 4.2 KB |
| scripts/text_to_speech.py | script | 1.7 KB |
scripts/dialogue_to_podcast.py
View on GitHub#!/usr/bin/env python3
"""
对话脚本转语音(使用 pyttsx3)
"""
import argparse
import os
import re
import pyttsx3
def parse_dialogue(dialogue_text: str) -> list:
"""
解析对话脚本,提取角色和台词
格式示例:
Alice: Hello!
Bob: Hi Alice, how are you?
Alice: I'm doing great!
Args:
dialogue_text: 对话脚本文本
Returns:
角色和台词的列表: [(role, line), ...]
"""
dialogues = []
lines = dialogue_text.strip().split('\n')
current_role = None
current_lines = []
for line in lines:
line = line.strip()
if not line:
# 空行,保存当前对话
if current_role and current_lines:
dialogues.append((current_role, ' '.join(current_lines)))
current_role = None
current_lines = []
continue
# 匹配角色: 台词格式
match = re.match(r'^([^:]+):\s*(.+)$', line)
if match:
# 保存之前的对话
if current_role and current_lines:
dialogues.append((current_role, ' '.join(current_lines)))
# 开始新对话
current_role = match.group(1).strip()
current_lines = [match.group(2).strip()]
else:
# 延续当前对话
if current_role:
current_lines.append(line)
# 保存最后的对话
if current_role and current_lines:
dialogues.append((current_role, ' '.join(current_lines)))
return dialogues
def dialogue_to_podcast(dialogue_path: str, output_path: str, voice_rate: int = 150) -> None:
"""
将对话脚本转换为语音文件
Args:
dialogue_path: 对话脚本文件路径
output_path: 输出 wav 文件路径
voice_rate: 语音速率(默认 150)
"""
print(f"正在生成播客: {dialogue_path}")
# 读取对话脚本
with open(dialogue_path, 'r', encoding='utf-8') as f:
dialogue_text = f.read()
# 解析对话
dialogues = parse_dialogue(dialogue_text)
if not dialogues:
raise Exception("未找到有效的对话内容")
print(f"解析到 {len(dialogues)} 条对话")
# 初始化语音引擎
engine = pyttsx3.init()
engine.setProperty('rate', voice_rate)
# 获取可用语音
voices = engine.getProperty('voices')
if len(voices) >= 2:
# 为两个角色设置不同的声音
voice1 = voices[0].id
voice2 = voices[1] if len(voices) > 1 else voices[0].id
else:
voice1 = voice2 = None
# 确定角色
role1 = dialogues[0][0]
voice1_id = voice1
voice2_id = voice2
# 确保输出目录存在
output_dir = os.path.dirname(output_path)
if output_dir:
os.makedirs(output_dir, exist_ok=True)
# 生成对话语音
try:
# 使用临时文件存储各条语音
temp_files = []
for i, (role, line) in enumerate(dialogues):
# 根据角色设置声音
if role == role1:
if voice1_id:
engine.setProperty('voice', voice1_id)
else:
if voice2_id:
engine.setProperty('voice', voice2_id)
# 保存当前句子的语音
temp_file = f"{output_path}.temp_{i}.wav"
engine.save_to_file(line, temp_file)
engine.runAndWait()
temp_files.append(temp_file)
# 合并所有语音文件(这里简化处理,只输出第一条)
# 注意:完整实现需要使用 pydub 等库进行音频合并
print(f"已生成 {len(temp_files)} 个语音片段")
# 这里简化处理,直接输出提示
print(f"注意:由于技术限制,仅生成了各个片段。请使用音频编辑工具合并以下文件:")
for temp_file in temp_files:
print(f" - {temp_file}")
# 将第一个片段作为示例输出
if temp_files:
import shutil
shutil.copy(temp_files[0], output_path)
print(f"示例语音文件已保存到: {output_path}")
except Exception as e:
raise Exception(f"播客生成失败: {str(e)}")
def main():
parser = argparse.ArgumentParser(description='对话脚本转语音')
parser.add_argument('--dialogue', required=True, help='对话脚本文件路径')
parser.add_argument('--output', required=True, help='输出 wav 文件路径')
parser.add_argument('--rate', type=int, default=150, help='语音速率(默认 150)')
args = parser.parse_args()
dialogue_to_podcast(args.dialogue, args.output, args.rate)
if __name__ == '__main__':
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |