# shivaat/mtlb-struct architecture

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

- Interactive diagram: https://gitdiagram.com/shivaat/mtlb-struct
- Repository: https://github.com/shivaat/mtlb-struct

## Overview

MTLB-STRUCT trains and runs a BERT-based system for verbal multiword-expression tagging, optionally learning dependency parses jointly. The main workflow prepares PARSEME data, encodes examples, trains or loads a model, evaluates predictions, and converts token tags back to .cupt output. The README also documents configuration-driven training and saved-model testing. Some connections are based only on README statements because the testing entry point and several implementation details were not sampled.

Main entry points: [`code/main.py`](https://github.com/shivaat/mtlb-struct/blob/master/code/main.py) (Training entry point), [`code/model.py`](https://github.com/shivaat/mtlb-struct/blob/master/code/model.py) (Joint tagger), [`code/load_test.py`](https://github.com/shivaat/mtlb-struct/blob/master/code/load_test.py) (Saved-model testing), [`code/berteval.py`](https://github.com/shivaat/mtlb-struct/blob/master/code/berteval.py) (Evaluation loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Corpus preparation"]
  node_corpus_files["PARSEME data<br/>[train.cupt]"]
  node_corpus["Corpus structures<br/>[corpus.py]"]
  node_corpus_reader["Corpus reader<br/>[corpus_reader.py]"]
  node_preprocessing["Example encoding<br/>[preprocessing.py]"]
end

subgraph group_runtime["Training and inference"]
  node_config["Run configurations<br/>[config.json]"]
  node_main["Training entry point<br/>[main.py]"]
  node_load_test["Saved-model testing<br/>[load_test.py]"]
end

subgraph group_modeling["Model and evaluation"]
  node_bert["Pretrained BERT"]
  node_tagger["Joint tagger<br/>[model.py]"]
  node_evaluation["Evaluation loop<br/>[berteval.py]"]
  node_metrics["Tagging metrics<br/>[berteval.py]"]
end

subgraph group_results["Prediction output"]
  node_cupt_conversion["CUpt conversion<br/>[evaluation.py]"]
  node_predictions["Prediction files"]
end

node_researcher(("Researcher"))

node_researcher -->|"starts training"| node_main
node_config -->|"configures run"| node_main
node_corpus_files -->|"reads corpus"| node_corpus
node_corpus -->|"provides sentences"| node_corpus_reader
node_corpus_reader -->|"provides tagged sequences"| node_preprocessing
node_preprocessing -->|"prepares examples"| node_main
node_main -->|"trains model"| node_tagger
node_bert -->|"provides encoder"| node_tagger
node_main -->|"runs evaluation"| node_evaluation
node_evaluation -->|"scores batches"| node_tagger
node_evaluation -->|"computes metrics"| node_metrics
node_main -->|"converts predictions"| node_cupt_conversion
node_cupt_conversion -->|"writes CUpt"| node_predictions
node_researcher -->|"starts testing"| node_load_test
node_load_test -.->|"loads saved model"| node_tagger
node_load_test -->|"saves predictions"| node_predictions

click node_corpus_files "https://github.com/shivaat/mtlb-struct/blob/master/data/1.2/GA/train.cupt"
click node_corpus "https://github.com/shivaat/mtlb-struct/blob/master/code/corpus.py"
click node_corpus_reader "https://github.com/shivaat/mtlb-struct/blob/master/code/corpus_reader.py"
click node_preprocessing "https://github.com/shivaat/mtlb-struct/blob/master/code/preprocessing.py"
click node_config "https://github.com/shivaat/mtlb-struct/blob/master/code/configs/config.json"
click node_main "https://github.com/shivaat/mtlb-struct/blob/master/code/main.py"
click node_load_test "https://github.com/shivaat/mtlb-struct/blob/master/code/load_test.py"
click node_tagger "https://github.com/shivaat/mtlb-struct/blob/master/code/model.py"
click node_evaluation "https://github.com/shivaat/mtlb-struct/blob/master/code/berteval.py"
click node_metrics "https://github.com/shivaat/mtlb-struct/blob/master/code/berteval.py"
click node_cupt_conversion "https://github.com/shivaat/mtlb-struct/blob/master/code/evaluation.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_files,node_corpus,node_corpus_reader,node_preprocessing toneBlue
class node_config,node_main,node_load_test toneAmber
class node_bert,node_tagger,node_evaluation,node_metrics toneMint
class node_cupt_conversion,node_predictions toneRose
class node_researcher toneIndigo
```

## Components

### Corpus preparation

- [PARSEME data](https://github.com/shivaat/mtlb-struct/blob/master/data/1.2/GA/train.cupt): `data/1.2/GA/train.cupt`
- [Corpus structures](https://github.com/shivaat/mtlb-struct/blob/master/code/corpus.py): `code/corpus.py`
- [Corpus reader](https://github.com/shivaat/mtlb-struct/blob/master/code/corpus_reader.py): `code/corpus_reader.py`
- [Example encoding](https://github.com/shivaat/mtlb-struct/blob/master/code/preprocessing.py): `code/preprocessing.py`

### Training and inference

- [Run configurations](https://github.com/shivaat/mtlb-struct/blob/master/code/configs/config.json): `code/configs/config.json`
- [Training entry point](https://github.com/shivaat/mtlb-struct/blob/master/code/main.py): `code/main.py`
- [Saved-model testing](https://github.com/shivaat/mtlb-struct/blob/master/code/load_test.py): `code/load_test.py`

### Model and evaluation

- **Pretrained BERT**
- [Joint tagger](https://github.com/shivaat/mtlb-struct/blob/master/code/model.py): `code/model.py`
- [Evaluation loop](https://github.com/shivaat/mtlb-struct/blob/master/code/berteval.py): `code/berteval.py`
- [Tagging metrics](https://github.com/shivaat/mtlb-struct/blob/master/code/berteval.py): `code/berteval.py`

### Prediction output

- [CUpt conversion](https://github.com/shivaat/mtlb-struct/blob/master/code/evaluation.py): `code/evaluation.py`
- **Prediction files**

### Other components

- **Researcher**

## Connections

- Researcher → Training entry point: starts training (evidence: `README.md`)
- Run configurations → Training entry point: configures run (evidence: `README.md`)
- PARSEME data → Corpus structures: reads corpus (evidence: `code/corpus.py`)
- Corpus structures → Corpus reader: provides sentences (evidence: `code/corpus_reader.py`)
- Corpus reader → Example encoding: provides tagged sequences (evidence: `code/preprocessing.py`)
- Example encoding → Training entry point: prepares examples (evidence: `code/main.py`)
- Training entry point → Joint tagger: trains model (evidence: `code/main.py`)
- Pretrained BERT → Joint tagger: provides encoder (evidence: `code/model.py`)
- Training entry point → Evaluation loop: runs evaluation (evidence: `code/main.py`)
- Evaluation loop → Joint tagger: scores batches (evidence: `code/berteval.py`)
- Evaluation loop → Tagging metrics: computes metrics (evidence: `code/berteval.py`)
- Training entry point → CUpt conversion: converts predictions (evidence: `code/main.py`)
- CUpt conversion → Prediction files: writes CUpt (evidence: `code/evaluation.py`)
- Researcher → Saved-model testing: starts testing (evidence: `README.md`)
- Saved-model testing → Joint tagger: loads saved model
- Saved-model testing → Prediction files: saves predictions (evidence: `README.md`)
