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/analyze_word_frequency.py
View on GitHub#!/usr/bin/env python3
"""
词频分析,过滤停用词
"""
import argparse
import os
import re
import pandas as pd
import sys
def load_stopwords(stopwords_path: str) -> set:
"""
加载停用词列表
Args:
stopwords_path: 停用词文件路径
Returns:
停用词集合
"""
stopwords = set()
try:
with open(stopwords_path, 'r', encoding='utf-8') as f:
for line in f:
word = line.strip().lower()
if word:
stopwords.add(word)
except FileNotFoundError:
print(f"警告: 停用词文件未找到: {stopwords_path}")
return stopwords
def analyze_word_frequency(txt_path: str, output_path: str, stopwords_path: str = None) -> None:
"""
分析文本词频,过滤停用词
Args:
txt_path: 文本文件路径
output_path: 输出 csv 文件路径
stopwords_path: 停用词文件路径
"""
print(f"正在进行词频分析: {txt_path}")
# 加载停用词
if stopwords_path and os.path.exists(stopwords_path):
stopwords = load_stopwords(stopwords_path)
else:
# 如果没有提供停用词文件,使用默认停用词(只过滤一些常见的)
stopwords = {'the', 'and', 'is', 'in', 'to', 'of', 'a', 'for', 'that', 'it', 'on', 'with',
'as', 'this', 'are', 'be', 'was', 'at', 'by', 'an', 'or', 'from', 'but',
'not', 'which', 'we', 'you', 'their', 'they', 'have', 'has', 'had', 'can'}
# 读取文本
with open(txt_path, 'r', encoding='utf-8') as f:
text = f.read().lower()
# 使用正则表达式提取单词
words = re.findall(r'\b[a-z]{3,}\b', text)
# 过滤停用词
filtered_words = [word for word in words if word not in stopwords]
# 统计词频
word_freq = {}
for word in filtered_words:
word_freq[word] = word_freq.get(word, 0) + 1
# 转换为 DataFrame
df = pd.DataFrame(list(word_freq.items()), columns=['word', 'frequency'])
df = df.sort_values('frequency', ascending=False).reset_index(drop=True)
# 确保输出目录存在
output_dir = os.path.dirname(output_path)
if output_dir:
os.makedirs(output_dir, exist_ok=True)
# 保存为 CSV
df.to_csv(output_path, index=False, encoding='utf-8')
print(f"词频统计已保存到: {output_path}")
print(f"总词数: {len(words)}, 过滤后词数: {len(filtered_words)}, 唯一词数: {len(word_freq)}")
print(f"前10个高频词:\n{df.head(10)}")
def main():
parser = argparse.ArgumentParser(description='词频分析,过滤停用词')
parser.add_argument('--txt', required=True, help='文本文件路径')
parser.add_argument('--output', required=True, help='输出 csv 文件路径')
parser.add_argument('--stopwords', help='停用词文件路径(可选)')
args = parser.parse_args()
# 默认停用词路径
default_stopwords = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'references', 'stopwords.txt')
stopwords_path = args.stopwords if args.stopwords else default_stopwords
analyze_word_frequency(args.txt, args.output, stopwords_path)
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 |