# nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation architecture

> Architecture diagram of the GitHub repository nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation
- Repository: https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation

## Overview

This repository is a CPU-based English-speech-to-German-text research prototype. Its main workflow extracts MFCC features, trains a GMM-HMM recognizer, decodes English text, aligns English/German sentence pairs, and translates English into German; an optional reliability-augmented HMM supplies posterior frame weights to decoding. Evaluation reports recognition and translation metrics, including the reliability ablation. The graph follows the README’s workflow and documented capabilities; unsampled module internals and runtime wiring are not inferred beyond those statements.

Main entry points: [`scripts/run_all.py`](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/run_all.py) (Study workflow), [`src/decode.py`](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/decode.py) (Lexicon-tree decoder), [`scripts/train_acoustic.py`](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/train_acoustic.py) (Acoustic training), [`scripts/train_alignment.py`](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/train_alignment.py) (Alignment training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data and features"]
  node_corpus[("CoVoST-2 access<br/>[common.py]")]
  node_feature["MFCC features<br/>[features.py]"]
  node_feature_build["Feature preparation<br/>[build_features.py]"]
end

subgraph group_recognition["Speech recognition"]
  node_acoustic_train["Acoustic training<br/>[train_acoustic.py]"]
  node_acoustic["GMM-HMM model<br/>[acoustic.py]"]
  node_gmm["Diagonal GMM<br/>[gmm.py]"]
  node_hmm["HMM inference<br/>[hmm.py]"]
  node_lexicon["Pronunciation lexicon<br/>[lexicon.py]"]
  node_lm_en["English bigram LM<br/>[lm.py]"]
  node_decoder["Lexicon-tree decoder<br/>[decode.py]"]
  node_reliability["RA-HMM weights<br/>[reliability.py]"]
end

subgraph group_translation["Word translation"]
  node_alignment_train["Alignment training<br/>[train_alignment.py]"]
  node_align["IBM1 and HMM alignment<br/>[align.py]"]
  node_translator["Monotone translator<br/>[translate.py]"]
  node_lm_de["German trigram LM<br/>[lm.py]"]
  node_textnorm["Text normalization<br/>[textnorm.py]"]
end

subgraph group_study["Research evaluation"]
  node_evaluation["WER BLEU chrF<br/>[eval.py]"]
  node_decode_eval["Recognition evaluation<br/>[decode_eval.py]"]
  node_reliability_eval["Reliability experiments<br/>[run_reliability.py]"]
  node_translation_eval["Translation evaluation<br/>[translate_eval.py]"]
  node_workflow["Study workflow<br/>[run_all.py]"]
end

node_audio(("English audio"))

node_audio -->|"provides recordings"| node_corpus
node_corpus -->|"streams dataset"| node_feature_build
node_feature_build -->|"builds features"| node_feature
node_feature -->|"trains from"| node_acoustic_train
node_acoustic_train -->|"fits model"| node_acoustic
node_acoustic -->|"contains emissions"| node_gmm
node_acoustic_train -->|"supports soft EM"| node_hmm
node_acoustic -->|"scores phones"| node_decoder
node_lexicon -->|"builds pronunciations"| node_decoder
node_lm_en -->|"scores word sequences"| node_decoder
node_reliability -->|"weights frames"| node_decoder
node_corpus -->|"supplies sentence pairs"| node_alignment_train
node_alignment_train -->|"trains alignment"| node_align
node_align -->|"initializes lexical table"| node_translator
node_alignment_train -->|"trains translation"| node_translator
node_translator -->|"scores German output"| node_lm_de
node_textnorm -->|"normalizes tokens"| node_lexicon
node_workflow -->|"runs features"| node_feature_build
node_workflow -->|"runs acoustic stage"| node_acoustic_train
node_workflow -->|"runs alignment stage"| node_alignment_train
node_workflow -->|"runs reliability stage"| node_reliability_eval
node_workflow -->|"runs decoding stage"| node_decode_eval
node_workflow -->|"runs translation stage"| node_translation_eval
node_decode_eval -->|"decodes speech"| node_decoder
node_decode_eval -->|"scores recognition"| node_evaluation
node_reliability_eval -->|"evaluates weights"| node_reliability
node_reliability_eval -->|"compares decoding"| node_decoder
node_translation_eval -->|"evaluates translation"| node_translator
node_translation_eval -->|"computes metrics"| node_evaluation

click node_corpus "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/common.py"
click node_feature "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/features.py"
click node_feature_build "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/build_features.py"
click node_acoustic_train "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/train_acoustic.py"
click node_acoustic "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/acoustic.py"
click node_gmm "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/gmm.py"
click node_hmm "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/hmm.py"
click node_lexicon "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/lexicon.py"
click node_lm_en "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/lm.py"
click node_decoder "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/decode.py"
click node_reliability "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/reliability.py"
click node_alignment_train "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/train_alignment.py"
click node_align "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/align.py"
click node_translator "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/translate.py"
click node_lm_de "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/lm.py"
click node_textnorm "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/textnorm.py"
click node_evaluation "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/eval.py"
click node_decode_eval "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/decode_eval.py"
click node_reliability_eval "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/run_reliability.py"
click node_translation_eval "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/translate_eval.py"
click node_workflow "https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/run_all.py"

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_corpus,node_feature,node_feature_build toneBlue
class node_acoustic_train,node_acoustic,node_gmm,node_hmm,node_lexicon,node_lm_en,node_decoder,node_reliability toneAmber
class node_alignment_train,node_align,node_translator,node_lm_de,node_textnorm toneMint
class node_evaluation,node_decode_eval,node_reliability_eval,node_translation_eval,node_workflow toneRose
class node_audio toneIndigo
```

## Components

### Data and features

- [CoVoST-2 access](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/common.py): `src/common.py`
- [MFCC features](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/features.py): `src/features.py`
- [Feature preparation](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/build_features.py): `scripts/build_features.py`

### Speech recognition

- [Acoustic training](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/train_acoustic.py): `scripts/train_acoustic.py`
- [GMM-HMM model](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/acoustic.py): `src/acoustic.py`
- [Diagonal GMM](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/gmm.py): `src/gmm.py`
- [HMM inference](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/hmm.py): `src/hmm.py`
- [Pronunciation lexicon](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/lexicon.py): `src/lexicon.py`
- [English bigram LM](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/lm.py): `src/lm.py`
- [Lexicon-tree decoder](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/decode.py): `src/decode.py`
- [RA-HMM weights](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/reliability.py): `src/reliability.py`

### Word translation

- [Alignment training](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/train_alignment.py): `scripts/train_alignment.py`
- [IBM1 and HMM alignment](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/align.py): `src/align.py`
- [Monotone translator](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/translate.py): `src/translate.py`
- [German trigram LM](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/lm.py): `src/lm.py`
- [Text normalization](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/textnorm.py): `src/textnorm.py`

### Research evaluation

- [WER BLEU chrF](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/src/eval.py): `src/eval.py`
- [Recognition evaluation](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/decode_eval.py): `scripts/decode_eval.py`
- [Reliability experiments](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/run_reliability.py): `scripts/run_reliability.py`
- [Translation evaluation](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/translate_eval.py): `scripts/translate_eval.py`
- [Study workflow](https://github.com/nunnajaswant-ship-it/uncertainty-aware-hmm-speech-translation/blob/master/scripts/run_all.py): `scripts/run_all.py`

### Other components

- **English audio**

## Connections

- English audio → CoVoST-2 access: provides recordings (evidence: `README.md`)
- CoVoST-2 access → Feature preparation: streams dataset (evidence: `README.md`)
- Feature preparation → MFCC features: builds features (evidence: `README.md`)
- MFCC features → Acoustic training: trains from (evidence: `README.md`)
- Acoustic training → GMM-HMM model: fits model (evidence: `README.md`)
- GMM-HMM model → Diagonal GMM: contains emissions (evidence: `src/acoustic.py`)
- Acoustic training → HMM inference: supports soft EM (evidence: `README.md`)
- GMM-HMM model → Lexicon-tree decoder: scores phones (evidence: `src/decode.py`)
- Pronunciation lexicon → Lexicon-tree decoder: builds pronunciations (evidence: `README.md`)
- English bigram LM → Lexicon-tree decoder: scores word sequences (evidence: `README.md`)
- RA-HMM weights → Lexicon-tree decoder: weights frames (evidence: `README.md`)
- CoVoST-2 access → Alignment training: supplies sentence pairs (evidence: `README.md`)
- Alignment training → IBM1 and HMM alignment: trains alignment (evidence: `README.md`)
- IBM1 and HMM alignment → Monotone translator: initializes lexical table (evidence: `README.md`)
- Alignment training → Monotone translator: trains translation (evidence: `README.md`)
- Monotone translator → German trigram LM: scores German output (evidence: `README.md`)
- Text normalization → Pronunciation lexicon: normalizes tokens (evidence: `src/lexicon.py`)
- Study workflow → Feature preparation: runs features (evidence: `README.md`)
- Study workflow → Acoustic training: runs acoustic stage (evidence: `README.md`)
- Study workflow → Alignment training: runs alignment stage (evidence: `README.md`)
- Study workflow → Reliability experiments: runs reliability stage (evidence: `README.md`)
- Study workflow → Recognition evaluation: runs decoding stage (evidence: `README.md`)
- Study workflow → Translation evaluation: runs translation stage (evidence: `README.md`)
- Recognition evaluation → Lexicon-tree decoder: decodes speech (evidence: `scripts/decode_eval.py`)
- Recognition evaluation → WER BLEU chrF: scores recognition (evidence: `scripts/decode_eval.py`)
- Reliability experiments → RA-HMM weights: evaluates weights (evidence: `scripts/run_reliability.py`)
- Reliability experiments → Lexicon-tree decoder: compares decoding (evidence: `scripts/run_reliability.py`)
- Translation evaluation → Monotone translator: evaluates translation (evidence: `scripts/translate_eval.py`)
- Translation evaluation → WER BLEU chrF: computes metrics (evidence: `scripts/translate_eval.py`)
