13 / 90

Day 13: テキストとデータの学習プロジェクト

既存の text_tools プロジェクトを、再現可能なコーパスからアーティファクトへのパイプラインとして完成させます。

自律学習と Python 480 分(8 時間の集中学習)
01 120 分

CLI コアの構築

エージェント支援は予測の記録後にのみ許可。生成された差分はすべて確認しテストすること。

前提条件

Day 01〜12: 文字列、辞書、ファイル、例外、テスト、ターミナル操作。

学習目標

projects/text_tools/core.py と cli.py を実装または精査し、統計、決定的な分割、出所マニフェスト、明示的なエンコーディングエラーを確認する。

手順

必須作業: この演習専用の private ワークスペースを作成し(WORKDIR=$(mktemp -d))、小さなコーパスを $WORKDIR/corpus.txt に書き込み、予測を記録してから、完全な呼び出し python3 projects/text_tools/cli.py --input "$WORKDIR/corpus.txt" --stats --json --split --output-dir "$WORKDIR/artifacts" を実行する。差分を確認し、--input、--stats、--split、--output-dir、--seed、--encoding、--errors を試す。任意作業: Python ドキュメントのリンクを比較する。

演習と予測

繰り返しトークン、CJK、発音記号付き文字、絵文字を含む小さなコーパスを使う。文字数とトークン数を予測してから stats.json と manifest.json を検証する — source_sha256 が元の入力バイト列の SHA256(例: sha256sum "$WORKDIR/corpus.txt")と一致し、input_decoding がエンコーディング・エラー処理・改行方針を記録していることも確認する。

Learning Project Submission & Evidence

0 / 4096 バイト
Declared Assistance Condition

Current Submitted Evidence Details

No submission recorded yet.
独立習得基準

学習者は実際の text_tools CLI を説明し実行でき、予測と証拠を記録しており、エージェントが書いた差分を独立した理解の証明とは主張しない。

ソースリソースと出所

linking PSF License Version 2

Python Standard Library: Built-in Types

著者・提供機関: Python Software Foundation | オリジナル出所URL ↗

該当セクション・タイムスタンプ: str methods and Unicode semantics used by analyze_text (split, join, isalpha, isdigit)

検証バージョンと日付: Python 3.12 documentation; verified 2026-10-30

選定理由:

Primary reference for the string methods and Unicode semantics behind corpus statistics.

ソース前提知識:

Study Days 01–12 Python fundamentals

安全フォールバック(オフライン回復性):

The lesson explains all required behavior locally and the reference implementation ships in the repository; pydoc mirrors the same documentation offline.

比較対象候補リソースと選定評価 (2)
GNU coreutils wc/split ↗ compared_rejected_for_day13 [GPL-3.0-or-later]

Powerful system tools, but the learning target is implementing and testing the behavior in Python, not delegating to platform-specific utilities.

Python HOWTO: Unicode ↗ compared_alternative [PSF License Version 2]

Deeper Unicode background for the encoding edge cases; str method reference remains the primary doc.

linking PSF License Version 2

argparse — Parser for command-line options, arguments and subcommands

著者・提供機関: Python Software Foundation | オリジナル出所URL ↗

該当セクション・タイムスタンプ: add_argument flags, choices, and type conversion used by cli.py

検証バージョンと日付: Python 3.12 documentation; verified 2026-10-30

選定理由:

Primary reference for the CLI flags the learner exercises on the real project.

ソース前提知識:

Study Days 01–12 Python fundamentals

安全フォールバック(オフライン回復性):

argparse is part of the standard library; python3 -c "import argparse; help(argparse)" works fully offline.

比較対象候補リソースと選定評価 (2)
Click package documentation ↗ compared_rejected_for_day13 [BSD-3-Clause]

Strong third-party CLI framework, but the project intentionally uses only the standard library so the exercise needs no extra dependency.

docopt ↗ compared_rejected_for_day13 [MIT]

Usage-string DSL for CLIs, but an external dependency is unjustified when argparse covers the project.

02 120 分

独立したコア実装

独立習得チェック: AI、写した答え、エージェント生成コードは不可。

前提条件

Day 13 アクティビティ 1 を完了し、参照タブをすべて閉じること。

学習目標

AI の支援なしに、実際のプロジェクトインターフェースに沿って統計または分割の限定関数を実装する。

手順

必須作業: 評価対象のインターフェースを 1 つだけ独立に実装し、どちらを選んだか明記する — analyze_text(text) -> dict(統計)または compute_splits(lines, train_ratio, val_ratio, test_ratio, seed) -> dict(分割)。その後、結果を先に予測した「別の新しい無支援入力」でテストする。任意作業: 提出後にのみ参考と比較する。正準の作例出力は公開の参考であり、隠れた評価ではない。

演習と予測

評価対象のインターフェースを 1 つ選んで宣言する。ルート A analyze_text(text) -> dict: 入力 'a a\n猫🙂' の完全な結果を予測する — キーは total_chars、total_tokens、vocab_size、char_vocab_size、token_frequencies、char_frequencies、min_token_length、max_token_length、avg_token_length、char_distribution。ルート B compute_splits(lines, train_ratio, val_ratio, test_ratio, seed) -> dict: ['a','b','c','d','e']、シード 7、比率 .6/.2/.2 で件数を予測し、インデックス集合が対ごとに互いに素であることを証明する。選んだルートが依拠する区別ルールも説明する(B: 等しいテキスト値でもインデックス単位のチェックが必要。A: 等しいテキスト値は語彙を水増ししない)。

独立習得基準

独自の新しい無支援入力での独立したコードが持ち出し動作チェックを通過し、文章の説明がインデックス漏洩・重複レコード・トークン/文字カウント・評価の限界を区別する。

ソースリソースと出所

original_explanation Apache-2.0 AND CC-BY-SA-4.0 share-alike

Text and Data Tools Learning Project

著者・提供機関: Curriculum team (delivered in Ticket 16) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: projects/text_tools/core.py: analyze_text and compute_splits interfaces

検証バージョンと日付: Verified against the checked-in implementation on 2026-10-30

選定理由:

The actual project whose interfaces the learner re-implements independently, keeping the exercise tied to real artifacts.

ソース前提知識:

Study Days 01–12 Python fundamentals

安全フォールバック(オフライン回復性):

The implementation and its project manifest are committed in the repository and work offline.

比較対象候補リソースと選定評価 (2)
External toy CLI tutorials ↗ compared_rejected_for_day13 [PSF License Version 2]

Generic tutorials duplicate earlier days and disconnect the exercise from the deterministic data artifacts later experiments reuse.

CPython Lib/string.py reference implementation ↗ compared_alternative [PSF License Version 2]

Production string-tooling internals are instructive but heavier than the project's focused interfaces.

03 120 分

ホールドアウト動作チェックとデバッグ

エージェント支援型エンジニアリングチェック: エージェントを指揮し、差分を確認し、ホールドアウトチェックは自分で実行する。

前提条件

独立実装した関数と、クリーンな一時出力ディレクトリがあること。

学習目標

カリキュラムリポジトリを変更せずに実際の障害を診断する: 入力ファイル欠落、不正な UTF-8、空入力、不正な比率、非決定的な順序。

手順

必須作業: 各デバッグケースをプロセス分離された一時ディレクトリで実行し、終了ステータスと標準エラーを記録し、ホールドアウトデータからアーティファクトを再生成する。任意作業: エージェントにテスト案を提案させ、不安全またはトートロジーなテストを棄却する。

演習と予測

ホールドアウト動作チェックは空ファイル、壊れたバイト、多言語行、同じシードの 2 回実行を使う。どの呼び出しが成功し、どれが失敗し、どのアーティファクトのバイトが一致しなければならないかを予測する。

Learning Project Submission & Evidence

0 / 4096 バイト
Declared Assistance Condition

Current Submitted Evidence Details

No submission recorded yet.
独立習得基準

証拠にはコマンド、終了コード、観測出力、少なくとも 3 件の診断と対処が含まれ、サブプロセスの成功を習得と混同しない。

ソースリソースと出所

original_explanation Apache-2.0 AND CC-BY-SA-4.0 share-alike

Text and Data Tools Learning Project

著者・提供機関: Curriculum team (delivered in Ticket 16) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: cli.py error paths: missing input, strict decoding, --output-dir requirement, ratio validation

検証バージョンと日付: Verified against the checked-in implementation on 2026-10-30

選定理由:

Held-out debugging must target the real CLI seams and exit codes, not a simplified re-implementation.

ソース前提知識:

Study Days 01–12 Python fundamentals

安全フォールバック(オフライン回復性):

All debugging cases run on a temporary corpus in a disposable directory with no external services.

比較対象候補リソースと選定評価 (2)
External debugging courses ↗ compared_alternative [PSF License Version 2]

pdb documentation is a useful secondary reference, but the held-out cases exercise CLI behavior end to end.

pytest documentation ↗ compared_alternative [MIT]

Natural next step to formalize the held-out cases; the activity first exercises the CLI seams directly.

04 120 分

プロジェクトレポート: 前提と限界

独立習得チェック: 最初の無支援レポートを先に確定・提出する。後の AI による文章磨きは別ラベルの非評価アーティファクトであり、独立した証拠を置き換えない。

前提条件

前の 3 つのアクティビティを完了し、証拠を保持していること。

学習目標

決定的なデータ準備が後のトークナイザ・モデル実験とどう結びつくかを、前提と限界を明示した短いレポートにまとめる。

手順

必須作業: まず無支援のレポートを書いて確定(提出・日付記録)する — ソースの帰属、エンコーディング、トークン定義、分割比率/シード、リーク方針、観測した計測値、再現性、限界を含める。後の支援付き推敲は別ラベルのアーティファクトであり確定版を置き換えない。支援で実質的な欠落が判明した場合は、習得とみなす前に新たな無支援チェックで回復する。任意作業: このプロジェクトを変更せずに後のトークナイザ実験を提案する。

演習と予測

固定された train/validation/test アーティファクトが Makemore、minbpe、NanoGPT で再利用できる理由と、固定分割がモデルの汎化を証明しない理由を説明する。

独立習得基準

レポートが完全で、実際のプロジェクトアーティファクトを引用し、少なくとも 3 つの前提と 3 つの限界を列挙し、確定済みの無支援ドラフトと別ラベルの支援付き推敲を区別している。

ソースリソースと出所

original_explanation Apache-2.0 AND CC-BY-SA-4.0 share-alike

Text and Data Tools Learning Project

著者・提供機関: Curriculum team (delivered in Ticket 16) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: manifest.json fields: source_sha256, split ratios/counts/hashes, leakage_check, environment, created_at

検証バージョンと日付: Verified against the checked-in implementation on 2026-10-30

選定理由:

The report must cite the real manifest and artifacts the learner generated, preserving attribution to the project.

ソース前提知識:

Study Days 01–12 Python fundamentals

安全フォールバック(オフライン回復性):

Report evidence consists of local artifacts and command output captured in earlier activities.

比較対象候補リソースと選定評価 (2)
Google Technical Writing One ↗ compared_alternative [CC BY 4.0 (course content)]

Solid general technical-writing training, but the report rubric here is specific to the project's manifest fields and provenance.

Write the Docs: Beginner's guide to documentation ↗ compared_alternative [CC BY-NC-SA 4.0]

General documentation guidance; the report rubric remains bound to this project's manifest fields.