用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/cxcscmu/SkillLearnBench --skill pdf-calendar-parsing命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | pdf-calendar-parsing |
| description | Extract calendar events, blocks, and time slots from PDF calendar files using pdfplumber |
This skill covers extracting calendar events and time blocks from PDF calendar documents using pdfplumber, a Python library for extracting text and tables from PDF files.
pip install pdfplumber
For a calendar with hourly/time-based layout:
import pdfplumber
with pdfplumber.open('/root/calendar.pdf') as pdf:
page = pdf.pages[0]
text = page.extract_text()
print(text)
import pdfplumber
with pdfplumber.open('/root/calendar.pdf') as pdf:
page = pdf.pages[0]
# Get all text objects with their positions
for char in page.chars:
print(f"Text: {char['text']}, X: {char['x0']}, Y: {char['y0']}")
import pdfplumber
def extract_calendar_events(pdf_path):
with pdfplumber.open(pdf_path) as pdf:
page = pdf.pages[0]
# Get all text with positions
text_data = page.extract_text_with_layout()
# Extract words and their bounding boxes
words = page.extract_words()
events = []
for word in words:
# word contains: 'text', 'x0', 'y0', 'x1', 'y1', 'size', 'font'
if word['text'] not in ['12am', '1am', '2am']: # Skip time labels
events.append({
'text': word['text'],
'x0': word['x0'],
'y0': word['y0'],
'x1': word['x1'],
'y1': word['y1']
})
return events
def extract_time_labels(page):
"""Extract hour labels from calendar time axis"""
words = page.extract_words()
time_labels = {}
for word in words:
text = word['text']
# Match patterns like "10am", "2pm", "12am"
if any(text.endswith(suffix) for suffix in ['am', 'pm']):
y_position = word['y0'] # Vertical position
time_labels[text] = y_position
return sorted(time_labels.items(), key=lambda x: x[1])
def get_block_duration(y_start, y_end, time_lines, interval_minutes=15):
"""
Calculate duration of a calendar block
time_lines: list of (time_string, y_position) tuples, sorted by y
interval_minutes: minutes between adjacent horizontal lines
"""
# Find which time lines bracket this block
start_time = None
end_time = None
for i, (time_str, y_pos) in enumerate(time_lines):
if y_pos <= y_start and (i+1 >= len(time_lines) or time_lines[i+1][1] > y_start):
start_time = time_str
if y_pos <= y_end and (i+1 >= len(time_lines) or time_lines[i+1][1] >= y_end):
end_time = time_str
return start_time, end_time