run1_skill-1
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-10-02
- Stars
- ★ 93
- Forks
- 7
03 SKILL.md 正文
[SKILL]
name: pymupdf-visual-calendar-parsing description: Parse visual PDF calendars by extracting visual elements (horizontal lines, colored event blocks) and mapping their vertical Y-coordinates to time values using PyMuPDF (fitz).
When parsing visual calendars in PDF format, events and grid lines are typically drawn as vector graphics rather than plain text. You can use PyMuPDF (fitz) to extract text (for the timeline axis labels) and vector drawings (rectangles representing events, and lines representing time intervals).
1. Extracting Drawings (Lines and Rectangles)
Use page.get_drawings() to extract all vector shapes. You can identify horizontal grid lines and colored event blocks based on the drawing item properties.
import fitz
doc = fitz.open("calendar.pdf")
page = doc[0]
drawings = page.get_drawings()
horizontal_lines = set()
event_blocks = []
for d in drawings:
# Colors are typically represented as RGB tuples/lists like [0.0, 0.0, 1.0] for blue
fill_color = d.get("fill")
for item in d["items"]:
if item[0] == "l": # It's a line
p1, p2 = item[1], item[2]
if p1.y == p2.y: # It's a horizontal line
horizontal_lines.add(p1.y)
elif item[0] == "re": # It's a rectangle
rect = item[1] # A fitz.Rect object
event_blocks.append({
"y0": rect.y0,
"y1": rect.y1,
"color": fill_color
})
# Sort lines from top to bottom
sorted_y_lines = sorted(list(horizontal_lines))
2. Extracting Timeline Text Labels
You must parse text from the PDF to identify the time values corresponding to the axis, and find their vertical coordinates.
text_dict = page.get_text("dict
04 同仓库更多 Skills
object_counter
Count occurrences of an object in the image using computer vision algorithm.
travel-planning-workflow
Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.
bundled-dataset-search-tool
invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.
glm-output
Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final /root/metrics.json.
glm-calibration
Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.
glm-basics
A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.