# unitexgramlab/unitex-core architecture

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

- Interactive diagram: https://gitdiagram.com/unitexgramlab/unitex-core
- Repository: https://github.com/unitexgramlab/unitex-core

## Overview

Unitex/GramLab Core is a multilingual, lexicon- and grammar-based corpus-processing NLP engine. A user supplies a tool request through the command-line interface or a language binding; the public tool interface dispatches it to processing capabilities, which produce corpus and linguistic outputs. The tree identifies those capability areas, but most tool implementations and dispatcher wiring were not excerpted, so those connections are shown as unverified rather than asserted. The internal layer includes Unicode, string, persistence, and callback interfaces used to support the engine and its integrations.

Main entry points: [`src/Main_UnitexTool.cpp`](https://github.com/unitexgramlab/unitex-core/blob/master/src/Main_UnitexTool.cpp) (Tool dispatcher), [`src/UnitexLibAndJni/fr_umlv_unitex_jni_UnitexJni.cpp`](https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexLibAndJni/fr_umlv_unitex_jni_UnitexJni.cpp) (Java binding), [`src/UnitexNet/UnitexNet.cpp`](https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexNet/UnitexNet.cpp) (.NET binding), [`src/UnitexTool.h`](https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexTool.h) (Tool API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and bindings"]
  node_tool_api["Tool API<br/>[UnitexTool.h]"]
  node_tool_dispatch["Tool dispatcher"]
  node_jni["Java binding"]
  node_net[".NET binding<br/>[UnitexNet.cpp]"]
  node_ruby["Ruby binding<br/>[UnitexRuby.cpp]"]
end

subgraph group_nlp["Corpus processing"]
  node_token["Tokenization<br/>[Tokenize.cpp]"]
  node_text_fst["Text automata<br/>[Txt2Tfst.cpp]"]
  node_locate["Grammar matching<br/>[Locate.cpp]"]
  node_tagger["Text tagging<br/>[Tagger.cpp]"]
  node_concord["Concordances<br/>[Concord.cpp]"]
  node_convert["Format conversion<br/>[Convert.cpp]"]
end

subgraph group_linguistic["Linguistic resources"]
  node_dictionary["Dictionary tools<br/>[Dico.cpp]"]
  node_multiflex["Inflection tools<br/>[MultiFlex.cpp]"]
  node_grammar["Grammar compilation<br/>[Grf2Fst2.cpp]"]
end

subgraph group_runtime["Runtime services"]
  node_unicode["Unicode I/O<br/>[Unicode.h]"]
  node_strings["Unitex strings<br/>[UnitexString.h]"]
  node_persistence["Persistence API"]
  node_file_io["File I/O API<br/>[UnitexLibIO.h]"]
  node_callbacks["Callback interfaces"]
  node_script_runner["Script runner<br/>[UniRunScript.cpp]"]
  node_file_unpack["File unpacking<br/>[FileUnPack.cpp]"]
  node_virtual_space["Virtual allocation"]
end

node_user(("Tool user"))

node_user -.->|"submits request"| node_tool_api
node_tool_api -.->|"dispatches tools"| node_tool_dispatch
node_jni -->|"runs tool"| node_tool_dispatch
node_net -->|"runs tool"| node_tool_dispatch
node_tool_dispatch -.->|"dispatches"| node_token
node_tool_dispatch -.->|"dispatches"| node_text_fst
node_tool_dispatch -.->|"dispatches"| node_locate
node_tool_dispatch -.->|"dispatches"| node_tagger
node_tool_dispatch -.->|"dispatches"| node_concord
node_tool_dispatch -.->|"dispatches"| node_convert
node_tool_dispatch -.->|"dispatches"| node_dictionary
node_tool_dispatch -.->|"dispatches"| node_multiflex
node_tool_dispatch -.->|"dispatches"| node_grammar
node_jni -->|"reads and writes"| node_file_io
node_net -->|"reads and writes"| node_file_io

click node_tool_api "https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexTool.h"
click node_tool_dispatch "https://github.com/unitexgramlab/unitex-core/blob/master/src/Main_UnitexTool.cpp"
click node_jni "https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexLibAndJni/fr_umlv_unitex_jni_UnitexJni.cpp"
click node_net "https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexNet/UnitexNet.cpp"
click node_ruby "https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexRuby/UnitexRuby.cpp"
click node_token "https://github.com/unitexgramlab/unitex-core/blob/master/src/Tokenize.cpp"
click node_text_fst "https://github.com/unitexgramlab/unitex-core/blob/master/src/Txt2Tfst.cpp"
click node_locate "https://github.com/unitexgramlab/unitex-core/blob/master/src/Locate.cpp"
click node_tagger "https://github.com/unitexgramlab/unitex-core/blob/master/src/Tagger.cpp"
click node_concord "https://github.com/unitexgramlab/unitex-core/blob/master/src/Concord.cpp"
click node_convert "https://github.com/unitexgramlab/unitex-core/blob/master/src/Convert.cpp"
click node_dictionary "https://github.com/unitexgramlab/unitex-core/blob/master/src/Dico.cpp"
click node_multiflex "https://github.com/unitexgramlab/unitex-core/blob/master/src/MultiFlex.cpp"
click node_grammar "https://github.com/unitexgramlab/unitex-core/blob/master/src/Grf2Fst2.cpp"
click node_unicode "https://github.com/unitexgramlab/unitex-core/blob/master/src/Unicode.h"
click node_strings "https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexString.h"
click node_persistence "https://github.com/unitexgramlab/unitex-core/blob/master/src/PersistenceInterface.h"
click node_file_io "https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexLibIO.h"
click node_callbacks "https://github.com/unitexgramlab/unitex-core/blob/master/src/AbstractFilePlugCallback.h"
click node_script_runner "https://github.com/unitexgramlab/unitex-core/blob/master/src/logger/UniRunScript.cpp"
click node_file_unpack "https://github.com/unitexgramlab/unitex-core/blob/master/src/logger/FileUnPack.cpp"
click node_virtual_space "https://github.com/unitexgramlab/unitex-core/blob/master/src/VirtOptimizations/VirtualSpaceManager.cpp"

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_tool_api,node_tool_dispatch,node_jni,node_net,node_ruby,node_user toneBlue
class node_token,node_text_fst,node_locate,node_tagger,node_concord,node_convert toneAmber
class node_dictionary,node_multiflex,node_grammar toneMint
class node_unicode,node_strings,node_persistence,node_file_io,node_callbacks,node_script_runner,node_file_unpack,node_virtual_space toneRose
```

## Components

### Entry and bindings

- [Tool API](https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexTool.h): `src/UnitexTool.h`
- [Tool dispatcher](https://github.com/unitexgramlab/unitex-core/blob/master/src/Main_UnitexTool.cpp): `src/Main_UnitexTool.cpp`
- [Java binding](https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexLibAndJni/fr_umlv_unitex_jni_UnitexJni.cpp): `src/UnitexLibAndJni/fr_umlv_unitex_jni_UnitexJni.cpp`
- [.NET binding](https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexNet/UnitexNet.cpp): `src/UnitexNet/UnitexNet.cpp`
- [Ruby binding](https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexRuby/UnitexRuby.cpp): `src/UnitexRuby/UnitexRuby.cpp`

### Corpus processing

- [Tokenization](https://github.com/unitexgramlab/unitex-core/blob/master/src/Tokenize.cpp): `src/Tokenize.cpp`
- [Text automata](https://github.com/unitexgramlab/unitex-core/blob/master/src/Txt2Tfst.cpp): `src/Txt2Tfst.cpp`
- [Grammar matching](https://github.com/unitexgramlab/unitex-core/blob/master/src/Locate.cpp): `src/Locate.cpp`
- [Text tagging](https://github.com/unitexgramlab/unitex-core/blob/master/src/Tagger.cpp): `src/Tagger.cpp`
- [Concordances](https://github.com/unitexgramlab/unitex-core/blob/master/src/Concord.cpp): `src/Concord.cpp`
- [Format conversion](https://github.com/unitexgramlab/unitex-core/blob/master/src/Convert.cpp): `src/Convert.cpp`

### Linguistic resources

- [Dictionary tools](https://github.com/unitexgramlab/unitex-core/blob/master/src/Dico.cpp): `src/Dico.cpp`
- [Inflection tools](https://github.com/unitexgramlab/unitex-core/blob/master/src/MultiFlex.cpp): `src/MultiFlex.cpp`
- [Grammar compilation](https://github.com/unitexgramlab/unitex-core/blob/master/src/Grf2Fst2.cpp): `src/Grf2Fst2.cpp`

### Runtime services

- [Unicode I/O](https://github.com/unitexgramlab/unitex-core/blob/master/src/Unicode.h): `src/Unicode.h`
- [Unitex strings](https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexString.h): `src/UnitexString.h`
- [Persistence API](https://github.com/unitexgramlab/unitex-core/blob/master/src/PersistenceInterface.h): `src/PersistenceInterface.h`
- [File I/O API](https://github.com/unitexgramlab/unitex-core/blob/master/src/UnitexLibIO.h): `src/UnitexLibIO.h`
- [Callback interfaces](https://github.com/unitexgramlab/unitex-core/blob/master/src/AbstractFilePlugCallback.h): `src/AbstractFilePlugCallback.h`
- [Script runner](https://github.com/unitexgramlab/unitex-core/blob/master/src/logger/UniRunScript.cpp): `src/logger/UniRunScript.cpp`
- [File unpacking](https://github.com/unitexgramlab/unitex-core/blob/master/src/logger/FileUnPack.cpp): `src/logger/FileUnPack.cpp`
- [Virtual allocation](https://github.com/unitexgramlab/unitex-core/blob/master/src/VirtOptimizations/VirtualSpaceManager.cpp): `src/VirtOptimizations/VirtualSpaceManager.cpp`

### Other components

- **Tool user**

## Connections

- Tool user → Tool API: submits request
- Tool API → Tool dispatcher: dispatches tools
- Java binding → Tool dispatcher: runs tool (evidence: `src/UnitexLibAndJni/fr_umlv_unitex_jni_UnitexJni.cpp`)
- .NET binding → Tool dispatcher: runs tool (evidence: `src/UnitexNet/UnitexNet.cpp`)
- Tool dispatcher → Tokenization: dispatches
- Tool dispatcher → Text automata: dispatches
- Tool dispatcher → Grammar matching: dispatches
- Tool dispatcher → Text tagging: dispatches
- Tool dispatcher → Concordances: dispatches
- Tool dispatcher → Format conversion: dispatches
- Tool dispatcher → Dictionary tools: dispatches
- Tool dispatcher → Inflection tools: dispatches
- Tool dispatcher → Grammar compilation: dispatches
- Java binding → File I/O API: reads and writes (evidence: `src/UnitexLibAndJni/fr_umlv_unitex_jni_UnitexJni.cpp`)
- .NET binding → File I/O API: reads and writes (evidence: `src/UnitexNet/UnitexNet.cpp`)
