3 Home
Virgil edited this page 2026-02-19 15:58:36 +00:00

go-i18n Wiki

Grammar-aware internationalisation engine for Go. Module: `forge.lthn.ai/core/go-i18n`

This is a grammar engine — it provides primitives for composing and reversing grammatically correct text. It is NOT a translation file manager. Consumers bring their own translations.

Architecture

Layer Package Purpose
Forward Root Compose grammar-aware messages: T(), PastTense(), Gerund(), Pluralize(), Article()
Reverse `reversal/` Decompose text back to base forms with grammatical metadata
Imprint `reversal/` Lossy feature vector projection for grammar fingerprinting
Multiply `reversal/` Deterministic training data augmentation
Data `locales/` Grammar tables (JSON) — only `gram.*` data

Pages

Core Architecture

  • Forward-API — T(), grammar primitives, namespace handlers, Subject builder
  • Reversal-Engine — 3-tier tokeniser, matching, morphology rules, round-trip verification
  • GrammarImprint — Lossy feature vectors, weighted cosine similarity, confidence weighting
  • Multiplier — Deterministic variant generation, case preservation, round-trip guarantee

Data and Schema

Research and Benchmarks

Key API

```go // Forward composition i18n.T("i18n.progress.build") // "Building..." i18n.T("i18n.done.delete", "cache") // "Cache deleted" i18n.T("i18n.count.file", 5) // "5 files" i18n.PastTense("commit") // "committed" i18n.Article("SSH") // "an"

// Reverse grammar tok := reversal.NewTokeniser() tokens := tok.Tokenise("Deleted the configuration files") imp := reversal.NewImprint(tokens) sim := imp.Similar(otherImp) // 0.0-1.0

// Training data augmentation m := reversal.NewMultiplier() variants := m.Expand("Delete the file") // 4-7 grammatical variants ```

Quick Reference

```bash go test ./... # All tests go test -v ./reversal/ # Reversal engine tests go test -bench=. ./... # Benchmarks ```

Status

  • Phase 1 (Harden): Dual-class disambiguation in progress — design approved with review feedback
  • Phase 2 (Reference Distributions): 1B pre-classification pipeline + imprint calibration — tasks dispatched
  • Phase 3 (Multi-Language): French grammar tables — pending