|
|
||
|---|---|---|
| .forgejo/workflows | ||
| docs | ||
| integration | ||
| locales | ||
| reversal | ||
| .gitignore | ||
| calibrate.go | ||
| calibrate_test.go | ||
| classify.go | ||
| classify_test.go | ||
| CLAUDE.md | ||
| compose.go | ||
| compose_test.go | ||
| context.go | ||
| context_test.go | ||
| debug.go | ||
| debug_test.go | ||
| go.mod | ||
| go.sum | ||
| grammar.go | ||
| grammar_test.go | ||
| handler.go | ||
| handler_test.go | ||
| hooks.go | ||
| hooks_test.go | ||
| i18n.go | ||
| i18n_test.go | ||
| language.go | ||
| language_test.go | ||
| loader.go | ||
| loader_test.go | ||
| localise.go | ||
| localise_test.go | ||
| numbers.go | ||
| numbers_test.go | ||
| README.md | ||
| REVIEW.md | ||
| service.go | ||
| service_test.go | ||
| time.go | ||
| time_test.go | ||
| transform.go | ||
| transform_test.go | ||
| types.go | ||
| types_test.go | ||
| validate.go | ||
| validate_test.go | ||
go-i18n
Grammar engine for Go. Provides forward composition primitives (PastTense, Gerund, Pluralize, Article, composite progress and label functions), a T() translation entry point with namespace key handlers, and a reversal engine that recovers base forms and grammatical roles from inflected text. The reversal package produces GrammarImprint feature vectors for semantic similarity scoring, builds reference domain distributions, performs anomaly detection, and includes a 1B model pre-sort pipeline for training data classification. Consumers bring their own translation keys; this library provides the grammatical machinery.
Module: forge.lthn.ai/core/go-i18n
Licence: EUPL-1.2
Language: Go 1.25
Quick Start
import "forge.lthn.ai/core/go-i18n"
// Grammar primitives
fmt.Println(i18n.PastTense("delete")) // "deleted"
fmt.Println(i18n.Gerund("build")) // "building"
fmt.Println(i18n.Pluralize("file", 3)) // "files"
// Translation with auto-composed output
fmt.Println(i18n.T("i18n.progress.build")) // "Building..."
fmt.Println(i18n.T("i18n.done.delete", "file")) // "File deleted"
// Reversal: recover grammar from text
tokeniser := reversal.NewTokeniser()
tokens := tokeniser.Tokenise("deleted the files")
imprint := reversal.NewImprint(tokens)
Documentation
- Architecture — grammar primitives, T() handlers, reversal engine, GrammarImprint, reference distributions, 1B pipeline
- Development Guide — building, testing, grammar table structure (critical: do not flatten JSON)
- Project History — completed phases and known limitations
Build & Test
go test ./...
go test -v ./reversal/
go test -bench=. ./...
go build ./...
Licence
European Union Public Licence 1.2 — see LICENCE for details.