Gematria turns any string into six numerology scores in Go
A zero-dependency Go package that maps letters to English, Jewish, Simple, Mystery, Majestic and Eights ciphers.
What this is
gematria is a single-purpose Go package: feed it a string and it returns six numbers derived from numerology ciphers. Each letter of the alphabet maps to a value in one of six lookup tables, and the package sums those values per character into a Gematria struct.
The module lives at github.com/andreimerlescu/gematria and requires Go 1.21. It has no external module dependencies; it imports standard-library packages such as encoding/json, fmt, regexp, strconv, strings, log, and errors. It is licensed Apache-2.0.
The six ciphers
The scores are named after their traditions:
| Cipher | Basis | |---|---| | Simple | Lookup table in data.go; README documents score 51 for "Andrei" | | English | Lookup table in data.go; README documents score 306 for "Andrei" | | Jewish | Traditional values with large jumps (J=600, W=900) | | Majestic | Mostly increments of 3 from A=3 to Z=78 (P=47 in the table) | | Eights | Starts A=3, B=5, C=8, then an irregular table to Z=192 | | Mystery | An idiosyncratic table the author says was chosen intuitively |
Each is a ResultMap (a map[string]uint64) defined in data.go, with both upper- and lowercase entries. The README frames these as tools for finding relationships between words that share scores, citing sites like Gematrix.org.
Getting started
Install it into your project:
go get -u github.com/andreimerlescu/gematria
The two entry points are NewGematria(data string) (Gematria, error) and its convenience alias FromString(in string), which swallows the error. The README's example calls gematria.FromString(name).
Input is normalized before scoring: whitespace is trimmed, then a regex ([^a-zA-Z\d.\s]) strips characters gematria cannot calculate. Each surviving character is uppercased and looked up in all six tables at once; the per-character scores are summed into the returned struct's Jewish, English, Simple, Mystery, Majestic and Eights fields.
The README states that errors like overflow or invalid input are nullified by returning 0, "reflecting the numerological principle of harmony over disruption." In practice characterScores returns an error only when its input is not a single character — absent table entries simply yield zero values. NewGematria propagates errors returned by characterScores, and FromString discards them.
Simplification
Beyond raw scoring, the package offers reduction. The Simplify(in uint64) function in mystery.go repeatedly sums the digits of a number — up to ten passes — until the result contains only the digits 3, 6 or 9, which is what the exported Majestic(in uint64, err error) bool predicate checks for. The README leans on this "power of 3 6 and 9" theme heavily.
The package-level Simplify(in uint64) in mystery.go reduces a single number, and Majestic(in uint64, err error) bool reports whether a score is majestic (contains only the digits 3, 6 or 9).
Combining scores
The package also concatenates scores into single numbers. majestic.go defines Combine(fields ...ComboType) for the six single-cipher constants, MajesticGematria(in Gematria, choices ...ComboType) for multi-cipher combinations, and a package-level Combine(in ...uint64) that concatenates raw values. The package also defines 32 ComboType constants in majestic.go, from CT_S ("simple") up through CT_MJMYEI ("majestic mystery eights"). The method Combine(fields ...ComboType) handles only the six single-cipher constants (CT_S, CT_E, CT_J, CT_MY, CT_MJ, CT_EI); multi-cipher combinations are handled by MajesticGematria(in Gematria, choices ...ComboType). For each choice it clones the combo string (for example "simple jewish"), simplifies all six scores and substitutes each word in that string with its simplified value, sums those numbers, then concatenates the digits into one uint64 and simplifies that result. A package-level Combine(in ...uint64) also concatenates raw values.
The code map
The repository is compact: 13 files at about 41 KB. Beyond the main sources there are three test files (gematria_test.go, majestic_test.go, mystery_test.go). The README documents example scores for "Andrei": Jewish 139, English 306, Simple 51, Mystery 2264, Majestic 153 and Eights 338. The repository includes a VERSION file, and the latest release tag is v1.0.1.
Who it is for
This is a niche utility with an opinionated author. The README mixes numerological commentary ("You can either program or be programmed") with practical notes, and claims the package needs no future updates because gematria "is effectively a constant as unchangeable as the value of Pi." For developers who want deterministic letter-to-number scoring in Go — whether for wordplay, numerology-adjacent features, or curiosity about how these ciphers map onto text — it is small enough to read end to end and integrate without pulling in external code.
andreimerlescu/gematria: 41 KB in 13 files, indexed Nov 9, 2026 after 0.00 hours of indexing. License: Apache-2.0. Source: https://github.com/andreimerlescu/gematria.
Ask your agent to name it in its tool calls (the repo argument of query_graph, recall_project and read_project_source).
Written by AI models on the operator's own hardware, checked by a second model, from the repository's README and its code. Back to the shelf