Codex 統測試題切題與答案鍵練習

練習目標

Module 3 全部練習預計 30~40 分鐘完成,本頁是第二部分,接續第一部分下載好的試題與標準答案 PDF。這次要練習用一段自然語言指令,請 Codex 把試題 PDF 逐題裁切成一張一張的圖片,並依你指定的檔名規則命名,再對照標準答案 PDF 建立一份 JSON 格式的答案鍵。跟第一部分「照著網址、連結點下去」不同,這次 Codex 得自己判斷每一題在頁面上從哪裡開始、到哪裡結束。

完成後你應該能夠:

練習範圍與資料夾結構

本次練習延續第一部分的下載範圍,但只取其中一科試題,避免題號重複:

項目內容
輸入檔案第一部分練習下載好的 <學年度>/專業一題目.pdf(試題)與 <學年度>/專業一答案.pdf(標準答案)
科目群電機與電子群資電類・專業科目(一)
學年度111、112、113、114、115(共 5 個學年度)
輸出圖片檔名規則<學年度>Q<題號>.png(例如 111Q1.png、111Q23.png)
輸出答案鍵檔案answer_key.json,key 與圖片檔名(不含副檔名)完全相同

切題完成後,請 Codex 依照學年度建立資料夾,例如:

images/
  111/
    111Q1.png
    111Q2.png
    ...
    111Q40.png
  112/ ... 115/(同樣依題數各自產生檔案)
answer_key.json
{
  "111Q1": "C",
  "111Q2": "D",
  "111Q3": "C",
  "112Q1": "B"
}

因為專業科目(二)的題號也是從 1 開始編,如果兩科都用同一套 <學年度>Q<題號> 規則命名,會互相撞名。這次練習先只處理專業科目(一);要不要、以及怎麼把兩科都納入,留給反思問題討論。輸入的 PDF 都是第一部分練習已經下載好的本機檔案,這次不需要重新連線到官網。

參考 Prompt

精確版

如果想寫得像傳統批次處理腳本一樣精確,可以連要用什麼工具把 PDF 轉成圖片、解析度多少、裁切範圍怎麼判斷都寫清楚。這種寫法在試卷版面穩定、一題接一題乾淨分隔時最省事,但統測試題本身沒有網址或連結文字可以寫死,唯一能寫死的是流程與工具——換一個學年度、版面忽然變雙欄,或某一題橫跨兩頁,寫死的流程還是得靠 Codex 臨場判斷。

請依照以下步驟,把 115 學年度「電機與電子群資電類」的試題 PDF(專業科目(一)與專業科目(二))切成一題一張圖片,並整理出 JSON 格式答案鍵:

1. 讀取 115/專業一題目.pdf 與 115/專業二題目.pdf(已下載好的檔案)。使用 pdftoppm 或同等工具,把每份 PDF 的每一頁轉成一張 300 DPI 的 PNG 圖片,暫存在一個工作資料夾中。

2. 依序檢視轉出的頁面圖片,找出每一題(例如「1.」「2.」這種題號開頭)在頁面上的起始與結束位置。一題的範圍包含題幹、所有選項,以及題目附帶的圖或表,直到下一題題號出現為止。

3. 用你判斷出的範圍,把每一題從頁面圖片中裁切出來,另存成一張獨立的 PNG,檔名為 <學年度>專業<1 或 2>Q<題號>.png(例如 115專業1Q1.png、115專業2Q23.png),放到 ./<學年度>/assets/ 資料夾中。

4. 讀取 115/專業一答案.pdf 與 115/專業二答案.pdf(標準答案),找出每一題對應的正確選項(A/B/C/D)。

5. 把兩個科目所有題目的答案整理成一個 JSON 檔 ./<學年度>/<學年度>keys.json,格式為 { "115專業1Q1": "C", "115專業1Q2": "D", ... },key 要跟第 3 步產生的圖片檔名(不含副檔名)完全一致。

6. 如果某一題在頁面上找不到明確的題號、題目橫跨兩頁、或某一題被官方公告不予計分/一律給分,請停下來、告訴我實際狀況,不要憑猜測硬裁或亂填答案。

詳細版

先看一個把規則和驗收標準都講清楚、但不規定用哪個工具的版本:說明輸入檔案在哪裡、裁切與命名規則、答案要以標準答案 PDF 為準,並要求 Codex 遇到例外要主動回報、完成後給一份數量核對。

請幫我把 115 學年度統測「電機與電子群資電類」的試題(專業科目(一)與專業科目(二)),從已下載好的 PDF 中,切成一題一張圖片,並建立對應的 JSON 答案鍵。

輸入檔案:115/專業一題目.pdf、115/專業一答案.pdf、115/專業二題目.pdf、115/專業二答案.pdf,都已經下載好。

請針對兩個科目:
1. 把試題 PDF 中的每一題(含題幹、選項、附圖或附表)各自裁切成一張獨立的 PNG 圖片。
2. 圖片檔名請用 <學年度>專業<1 或 2>Q<題號>.png 的格式,例如 115專業1Q1.png、115專業2Q15.png。
3. 把所有圖片放進 ./<學年度>/assets/ 資料夾。
4. 從標準答案 PDF 中找出每一題的正確答案(A/B/C/D),整理成一個 JSON 檔 ./<學年度>/<學年度>keys.json,key 用跟圖片檔名相同的字串(不含 .png),例如 "115專業1Q1": "C"。

處理過程請注意:
- 每張圖片只能包含一題,不要把兩題的內容裁在同一張圖裡,也不要把同一題切成兩張圖。
- 答案請以官方標準答案 PDF 為準,不要自己作答猜測。
- 如果題號不連續、有缺頁,或某一題被官方公告不計分/一律給分,請明確告訴我是哪一科、哪一題,不要略過不提。
- 全部處理完成後,請列出兩個科目各自切出的圖片張數,並確認 <學年度>keys.json 裡的 key 數量與圖片數量一致。

簡易版

同一個任務也可以只講你要的結果,把「怎麼切、用什麼工具」留給 Codex 自己判斷:

請幫我把下載好的 115 學年度試題 PDF,每一題切成一張圖片,檔名使用 ./<學年度>/assets/<學年度>專業<1 或 2>Q<題號>.png。
然後對照標準答案 PDF,製作 ./<學年度>/<學年度>keys.json。JSON 的 key 使用與圖片檔名完全相同的字串,value 填入正確答案。

三種寫法怎麼選? 「精確版」把要用的工具、解析度、裁切範圍的判斷邏輯都寫清楚,這種寫法在試卷版面穩定、題目一題接一題乾淨分隔時最省事——但統測試題不像網站,沒有網址或連結文字可以寫死,唯一能寫死的是流程與工具本身;如果某年題目橫跨兩頁、或版面忽然變成雙欄,寫死的流程還是得靠 Codex 臨場判斷,這時候精確版不見得比詳細版更可靠。「詳細版」只講規則和驗收標準(一題一圖、檔名規則、答案要以官方 PDF 為準、遇到例外怎麼辦),不規定要用哪個工具、DPI 多少,Codex 可以自己選最適合的做法,工具版本或介面變化也不會卡住整段 Prompt。「簡易版」連規則都不講,只講你要的結果,怎麼切、用什麼工具完全交給 Codex 決定,最省事但也最難確認做得夠不夠完整。多數時候,介於詳細版和簡易版之間最實用:講清楚一題一圖、檔名規則、答案要對照官方 PDF,但不用規定 Codex 該用哪一套裁圖工具。

檢查重點

反思問題

  1. 如果用固定的頁面座標去裁切每一題,換一個學年度、版面編排不同時,這個做法還能用嗎?為什麼第一部分的「網站操作版」可以把連結整個寫死,但這裡沒辦法把裁切座標整個寫死?
  2. 如果要把專業科目(一)和專業科目(二)都做這個練習,兩科的題號都從 1 開始,<學年度>Q<題號> 這個檔名規則會發生什麼問題?你會怎麼修改命名規則來避免衝突?
  3. 你要怎麼在不用肉眼看完所有圖片的情況下,快速確認 Codex 沒有把任何一題的附圖漏掉、或裁到隔壁題的內容?
  4. 為什麼答案鍵要讓 Codex 去讀標準答案 PDF,而不是直接請 Codex 看著題目圖片自己作答?這兩種做法的可靠度有什麼差別?

Codex Exam Question Cropping and Answer Key Practice

Practice Goal

Module 3 is designed to take about 30–40 minutes in total. This page covers Part 2, continuing from the exam papers and answer keys downloaded in Part 1. This time you'll practice giving Codex one natural-language instruction to crop an exam PDF into one image per question, name each image using a rule you specify, and build a JSON-style answer key against the official standard-answer PDF. Unlike Part 1's "follow this URL, click this link," Codex now has to judge for itself where each question starts and ends on the page.

After this, you should be able to:

Scope and Folder Layout

This practice continues the scope from Part 1, but uses only one subject exam to keep question numbers unique:

ItemValue
Input files<year>/專業一題目.pdf (exam) and <year>/專業一答案.pdf (standard answer key), already downloaded in Part 1
Subject groupElectrical and Electronics Group — Information/Electronics Track, Professional Subject (1)
Academic years111, 112, 113, 114, 115 (5 years)
Output image naming rule<year>Q<question number>.png (e.g. 111Q1.png, 111Q23.png)
Output answer key fileanswer_key.json, keys identical to the image filenames minus the extension

Once cropped, have Codex create one folder per academic year, for example:

images/
  111/
    111Q1.png
    111Q2.png
    ...
    111Q40.png
  112/ ... 115/ (same pattern, one file per question)
answer_key.json
{
  "111Q1": "C",
  "111Q2": "D",
  "111Q3": "C",
  "112Q1": "B"
}

Professional Subject (2) also numbers its questions starting from 1, so applying the same <year>Q<question number> rule to both subjects would collide. This practice covers only Professional Subject (1); whether and how to extend it to both subjects is left for the reflection questions. All input PDFs are already on disk from Part 1 — no need to go back online.

Reference Prompt

Precise Version

You can also write it as precisely as an old-school batch-processing script: name the exact tool for converting PDF pages to images, the resolution, and the logic for judging each crop boundary. This is the most reliable version when a paper's layout stays consistent and questions are cleanly separated — but an exam paper has no URL or link text to hard-code the way a website does. The only thing you can pin down is the process and tooling; if a question spans a page break, or a year's layout suddenly shifts to two columns, Codex still has to make a judgment call on the spot.

Follow these steps to crop the Professional Subject (1) exam PDFs for the "電機與電子群資電類" (Electrical and
Electronics Group — Information/Electronics Track) for the 111 to 115 academic years into one image per
question, and build a JSON-style answer key:

1. For each academic year, read <year>/專業一題目.pdf (already downloaded in Part 1). Use pdftoppm or an
   equivalent tool to render every PDF page as a 300 DPI PNG image into a working folder.

2. Go through the rendered page images in order and find where each question (starting with "1.", "2.", and
   so on) begins and ends on the page. A question's range covers its stem, all answer choices, and any figure
   or table that belongs to it, up to where the next question number appears.

3. Using the range you identified, crop each question out of the page image and save it as its own PNG, named
   <year>Q<question number>.png (e.g. 111Q1.png, 111Q23.png), inside the images/<year>/ folder.

4. Read <year>/專業一答案.pdf (the standard answer key) and find the correct choice (A/B/C/D) for each
   question.

5. Collect every year's and every question's answer into a single JSON file, answer_key.json, in the form
   { "111Q1": "C", "111Q2": "D", ... }, with keys that exactly match the image filenames from step 3 (minus
   the extension).

6. If a question's number can't be clearly located on the page, a question spans two pages, or a question was
   officially voided/credited to everyone, stop and tell me what you actually see — don't guess where to crop
   or make up an answer.

Detailed Version

Here's a version that states the rules and acceptance criteria clearly without dictating which tool to use: where the input files are, the cropping and naming rules, that answers must come from the official PDF, and a request for Codex to flag exceptions and give a final count.

Please crop the Professional Subject (1) exam questions for "電機與電子群資電類" (Electrical and Electronics
Group — Information/Electronics Track) for the 111 to 115 academic years, from the PDFs already downloaded in
Part 1, into one image per question, and build a matching JSON answer key.

Input files: each year's <year>/專業一題目.pdf (exam) and <year>/專業一答案.pdf (standard answer key), already
downloaded in Part 1.

For each academic year:
1. Crop every question (stem, answer choices, and any figure or table) out of the exam PDF as its own PNG
   image.
2. Name each image <year>Q<question number>.png, e.g. 111Q1.png, 112Q15.png.
3. Put all of a year's images into images/<year>/.
4. Look up each question's correct answer (A/B/C/D) in the standard answer key PDF, and collect them into a
   JSON file, answer_key.json, using the same string as the image filename (without .png) as the key, e.g.
   "111Q1": "C".

While doing this:
- Each image must contain exactly one question — don't crop two questions into one image, and don't split one
  question across two images.
- Answers must come from the official standard answer key PDF — don't answer the questions yourself.
- If a year has non-consecutive question numbers, a missing page, or a question that was officially voided or
  credited to everyone, tell me explicitly which year and which question — don't skip it silently.
- When everything is done, list how many images were produced per year, and confirm the number of keys in
  answer_key.json matches the number of images.

Simple Version

The same task can also be stated as just the result you want, leaving "how to crop, what tool to use" up to Codex:

Take the 111 to 115 academic year Professional Subject (1) exam PDFs for "電機與電子群資電類" (Electrical and
Electronics Group — Information/Electronics Track) that I already downloaded in Part 1, crop out one image per
question, and name each one <year>Q<question number>.png, organized into one folder per year.
Then cross-reference the standard answer key PDF and build me a JSON answer key, using the same string as the
image filename as the key and the correct answer as the value.

Which of the three should you use? The precise version spells out the tool, resolution, and crop-boundary logic — most reliable when a paper's layout stays consistent and questions are cleanly separated. But an exam paper isn't a website: there's no URL or link text to pin down, only the process and tooling itself — and if a question spans a page break, or a year's layout suddenly shifts to two columns, Codex still has to judge it on the spot, so the precise version isn't necessarily more reliable than the detailed one. The detailed version only states the rules and acceptance criteria (one image per question, the naming rule, answers must come from the official PDF, what to do about exceptions) without dictating a specific tool or DPI, so Codex can pick whatever approach fits, and a tool-version change won't get the whole prompt stuck. The simple version doesn't even state the rules — just the result you want — leaving "how to crop, what tool" entirely to Codex; it's the least effort to write but the hardest to verify as thorough. Most of the time, the sweet spot sits between the detailed and simple versions: state clearly that it's one image per question, the naming rule, and that answers must match the official PDF, without dictating which cropping tool Codex should use.

Check Points

Reflection Questions

  1. If you crop every question using fixed page coordinates, would that still work for a different academic year with a different layout? Why could Part 1's site navigation version hard-code the entire link path, while this task can't hard-code the entire set of crop coordinates?
  2. If you wanted to run this practice on both Professional Subject (1) and (2), and both subjects number their questions starting from 1, what would go wrong with the <year>Q<question number> naming rule? How would you change the naming rule to avoid the collision?
  3. Without looking through every image by eye, how would you quickly confirm that Codex didn't drop a question's figure or crop into the neighboring question?
  4. Why should the answer key come from Codex reading the standard answer key PDF, rather than asking Codex to look at each question image and answer it directly? What's the reliability difference between the two approaches?