# pipz35/asr-soccer-commentary architecture

> Architecture diagram of the GitHub repository pipz35/asr-soccer-commentary, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pipz35/asr-soccer-commentary
- Repository: https://github.com/pipz35/asr-soccer-commentary

## Overview

This research repository builds and evaluates soccer-domain Whisper ASR, chiefly to improve player and team name recognition. The workflow prepares GOAL commentary audio/transcripts, fine-tunes Whisper, applies roster prompting and sequence-bias decoding, then scores transcription and entity performance. Separate scripts cover GOAL and general ASR experiments and seen/unseen analysis. Edges reflect README statements or shown calls; several scripts are unsampled, so their internal wiring is not inferred.

Main entry points: [`scripts/prepare_finetune_data.py`](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/prepare_finetune_data.py) (Test segments), [`scripts/finetune_whisper_soccer.py`](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/finetune_whisper_soccer.py) (Whisper fine-tuning), [`scripts/whisper_combined.py`](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_combined.py) (Combined decoding), [`scripts/whisper_prompting_experiments.py`](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_prompting_experiments.py) (Roster prompting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_prepared_data["Fine-tune dataset"]
  node_prepared_data_v2["Dataset builder v2"]
  node_test_data["Test segments"]
end

subgraph group_model["ASR modeling"]
  node_finetune["Whisper fine-tuning"]
  node_finetuned_model["Fine-tuned model"]
end

subgraph group_experiments["Inference experiments"]
  node_prompting["Roster prompting"]
  node_prompting_v2["Prompting experiments v2"]
  node_shallow_fusion["Sequence biasing"]
  node_combined["Combined decoding"]
end

subgraph group_analysis["Evaluation and analysis"]
  node_evaluate["Fine-tuned evaluation"]
  node_goal_eval["GOAL baseline<br/>[whisper_goal.py]"]
  node_goal_save["GOAL prediction export"]
  node_error_analysis["Entity error analysis<br/>[error_analysis.py]"]
  node_seen_unseen["Seen/unseen analysis"]
  node_results["Experiment results"]
end

node_researcher(("Researcher"))
node_goaldata["GOAL annotations"]
node_soccer_audio["SoccerNet audio"]
node_whisper["Whisper Medium"]

node_goaldata -->|"provides annotations"| node_prepared_data
node_soccer_audio -->|"provides audio"| node_prepared_data
node_goaldata -->|"provides annotations"| node_prepared_data_v2
node_soccer_audio -->|"provides audio"| node_prepared_data_v2
node_prepared_data -->|"loads dataset"| node_finetune
node_whisper -->|"initializes"| node_finetune
node_finetune -->|"trains"| node_finetuned_model
node_finetuned_model -->|"decodes with"| node_prompting
node_finetuned_model -->|"decodes with"| node_prompting_v2
node_finetuned_model -->|"decodes with"| node_shallow_fusion
node_finetuned_model -->|"decodes with"| node_combined
node_test_data -.->|"evaluates on"| node_prompting
node_test_data -.->|"evaluates on"| node_prompting_v2
node_test_data -.->|"evaluates on"| node_shallow_fusion
node_test_data -.->|"evaluates on"| node_combined
node_test_data -.->|"evaluates on"| node_evaluate
node_whisper -->|"transcribes with"| node_goal_eval
node_whisper -->|"transcribes with"| node_goal_save
node_goal_save -->|"writes predictions"| node_error_analysis
node_finetuned_model -->|"evaluates"| node_evaluate
node_researcher -.->|"runs"| node_prepared_data
node_researcher -.->|"runs"| node_finetune
node_researcher -.->|"runs"| node_prompting
node_researcher -.->|"runs"| node_seen_unseen
node_finetuned_model -->|"evaluated by"| node_seen_unseen
node_combined -->|"saves results"| node_results

click node_prepared_data "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/prepare_finetune_data.py"
click node_prepared_data_v2 "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/prepare_finetune_data_v2.py"
click node_finetune "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/finetune_whisper_soccer.py"
click node_prompting "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_prompting_experiments.py"
click node_prompting_v2 "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_prompting_experiments_v2.py"
click node_shallow_fusion "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_shallow_fusion.py"
click node_combined "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_combined.py"
click node_test_data "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/prepare_finetune_data.py"
click node_evaluate "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/evaluate_finetuned.py"
click node_goal_eval "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_goal.py"
click node_goal_save "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_goal_save.py"
click node_error_analysis "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/error_analysis.py"
click node_seen_unseen "https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/seen_unseen_entity_analysis.py"
click node_results "https://github.com/pipz35/asr-soccer-commentary/blob/master/results/combined_results.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_prepared_data,node_prepared_data_v2,node_test_data toneBlue
class node_finetune,node_finetuned_model toneAmber
class node_prompting,node_prompting_v2,node_shallow_fusion,node_combined toneMint
class node_evaluate,node_goal_eval,node_goal_save,node_error_analysis,node_seen_unseen,node_results toneRose
class node_researcher,node_goaldata,node_soccer_audio,node_whisper toneIndigo
```

## Components

### Data preparation

- [Fine-tune dataset](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/prepare_finetune_data.py): `scripts/prepare_finetune_data.py`
- [Dataset builder v2](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/prepare_finetune_data_v2.py): `scripts/prepare_finetune_data_v2.py`
- [Test segments](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/prepare_finetune_data.py): `scripts/prepare_finetune_data.py`

### ASR modeling

- [Whisper fine-tuning](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/finetune_whisper_soccer.py): `scripts/finetune_whisper_soccer.py`
- **Fine-tuned model**

### Inference experiments

- [Roster prompting](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_prompting_experiments.py): `scripts/whisper_prompting_experiments.py`
- [Prompting experiments v2](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_prompting_experiments_v2.py): `scripts/whisper_prompting_experiments_v2.py`
- [Sequence biasing](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_shallow_fusion.py): `scripts/whisper_shallow_fusion.py`
- [Combined decoding](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_combined.py): `scripts/whisper_combined.py`

### Evaluation and analysis

- [Fine-tuned evaluation](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/evaluate_finetuned.py): `scripts/evaluate_finetuned.py`
- [GOAL baseline](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_goal.py): `scripts/whisper_goal.py`
- [GOAL prediction export](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/whisper_goal_save.py): `scripts/whisper_goal_save.py`
- [Entity error analysis](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/error_analysis.py): `scripts/error_analysis.py`
- [Seen/unseen analysis](https://github.com/pipz35/asr-soccer-commentary/blob/master/scripts/seen_unseen_entity_analysis.py): `scripts/seen_unseen_entity_analysis.py`
- [Experiment results](https://github.com/pipz35/asr-soccer-commentary/blob/master/results/combined_results.json): `results/combined_results.json`

### Other components

- **Researcher**
- **GOAL annotations**
- **SoccerNet audio**
- **Whisper Medium**

## Connections

- GOAL annotations → Fine-tune dataset: provides annotations (evidence: `scripts/prepare_finetune_data.py`)
- SoccerNet audio → Fine-tune dataset: provides audio (evidence: `scripts/prepare_finetune_data.py`)
- GOAL annotations → Dataset builder v2: provides annotations (evidence: `scripts/prepare_finetune_data_v2.py`)
- SoccerNet audio → Dataset builder v2: provides audio (evidence: `scripts/prepare_finetune_data_v2.py`)
- Fine-tune dataset → Whisper fine-tuning: loads dataset (evidence: `scripts/finetune_whisper_soccer.py`)
- Whisper Medium → Whisper fine-tuning: initializes (evidence: `scripts/finetune_whisper_soccer.py`)
- Whisper fine-tuning → Fine-tuned model: trains (evidence: `scripts/finetune_whisper_soccer.py`)
- Fine-tuned model → Roster prompting: decodes with (evidence: `README.md`)
- Fine-tuned model → Prompting experiments v2: decodes with (evidence: `scripts/whisper_prompting_experiments_v2.py`)
- Fine-tuned model → Sequence biasing: decodes with (evidence: `scripts/whisper_shallow_fusion.py`)
- Fine-tuned model → Combined decoding: decodes with (evidence: `scripts/whisper_combined.py`)
- Test segments → Roster prompting: evaluates on
- Test segments → Prompting experiments v2: evaluates on
- Test segments → Sequence biasing: evaluates on
- Test segments → Combined decoding: evaluates on
- Test segments → Fine-tuned evaluation: evaluates on
- Whisper Medium → GOAL baseline: transcribes with (evidence: `scripts/whisper_goal.py`)
- Whisper Medium → GOAL prediction export: transcribes with (evidence: `scripts/whisper_goal_save.py`)
- GOAL prediction export → Entity error analysis: writes predictions (evidence: `scripts/error_analysis.py`)
- Fine-tuned model → Fine-tuned evaluation: evaluates (evidence: `scripts/evaluate_finetuned.py`)
- Researcher → Fine-tune dataset: runs
- Researcher → Whisper fine-tuning: runs
- Researcher → Roster prompting: runs
- Researcher → Seen/unseen analysis: runs
- Fine-tuned model → Seen/unseen analysis: evaluated by (evidence: `scripts/seen_unseen_entity_analysis.py`)
- Combined decoding → Experiment results: saves results (evidence: `scripts/whisper_combined.py`)
