Skip to content

anbeime/skill / skills/paper-analysis-assistant/paper-analysis-assistant

paper-analysis-assistant

Verified

其他高等院校教师与数据科学家在追踪前沿学术时,当需要深度解析arXiv论文,用此技能可一键下载PDF并自动生成词频分析、双人播客、交互式网页、PPT演示与总结图,将数小时的文献阅读转化为多媒体内容,效率提升十倍!

scripts/extract_text.py

View on GitHub
#!/usr/bin/env python3
"""
从 PDF 文件中提取纯文本
"""
import argparse
import os
import pdfplumber


def extract_text_from_pdf(pdf_path: str, output_path: str) -> None:
    """
    从 PDF 文件中提取纯文本

    Args:
        pdf_path: PDF 文件路径
        output_path: 输出 txt 文件路径
    """
    print(f"正在提取文本: {pdf_path}")

    text_content = []

    try:
        with pdfplumber.open(pdf_path) as pdf:
            for page_num, page in enumerate(pdf.pages, 1):
                text = page.extract_text()
                if text:
                    # 清理文本
                    text = text.strip()
                    # 移除多余的空行
                    text = '\n'.join(line for line in text.split('\n') if line.strip())
                    text_content.append(text)

        # 合并所有页面内容
        full_text = '\n\n'.join(text_content)

        # 确保输出目录存在
        output_dir = os.path.dirname(output_path)
        if output_dir:
            os.makedirs(output_dir, exist_ok=True)

        # 保存文本
        with open(output_path, 'w', encoding='utf-8') as f:
            f.write(full_text)

        print(f"文本已保存到: {output_path}")
        print(f"提取了 {len(pdfplumber.open(pdf_path).pages)} 页,{len(full_text)} 个字符")

    except Exception as e:
        raise Exception(f"提取 PDF 文本失败: {str(e)}")


def main():
    parser = argparse.ArgumentParser(description='从 PDF 文件中提取纯文本')
    parser.add_argument('--pdf', required=True, help='PDF 文件路径')
    parser.add_argument('--output', required=True, help='输出 txt 文件路径')
    args = parser.parse_args()

    extract_text_from_pdf(args.pdf, args.output)


if __name__ == '__main__':
    main()
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: 197kUpdated Claude CodeCodexVerifiedInstall
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: 197kUpdated Claude CodeCodexVerifiedInstall
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: 197kUpdated Claude CodeCodexVerifiedInstall
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: 197kUpdated Claude CodeCodexVerifiedInstall