4 Commits
Author SHA1 Message Date
malonehunterandClaude Opus 4.7 a88532f421 v2.5: NetVoid 2026 review merge (+13,855) + calibrated classify_candidates tool
NetVoid shared CYPHERS_CLEANED_DDB_2026.txt (103,559 entries — she trimmed her 2023 starting db
in half via manual review). Of her 14,520 truly-new entries since 2023, 13,861 were missing
from our db; the new tools/classify_candidates.py filter passed 13,855 (drop rate 0.04%).

tools/classify_candidates.py is new — calibrated junk rubric that's permissive on modern
proper nouns, acronyms, brand names, and event-phrases with digits but still catches the
shared-consensus junk patterns. Designed for ecosystem reciprocity: NetVoid can apply the
same filter on her side so merges in either direction stay clean.

tools/normalize_caps.py fix: stopped using /usr/share/dict/words to disambiguate acronyms
from shouted dict-words. web2 (1934) accidentally contains 'maga', 'covid', 'la', 'ai',
'id', 'us', 'it', 'ice' as obscure historical/Latin/scientific terms which collided with
modern coinages and mangled 462 acronyms during the merge. New rule: all-caps multi-letter
token always preserved.

db 216,088 -> 229,943 (+6.4%). db.json/db_lite.json grow ~6% in lockstep; lite paint stays
~2s. Release assets ship per convention (every tagged release has both db files attached).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 06:21:50 -04:00
malonehunterandClaude Opus 4.7 de3f624b86 readme: fix license section (GPLv2 + AGPLv3 ciphers, not MIT)
The LICENSE file contains the GPLv2 text but README said 'MIT' — outright contradiction.
Updated to:
- assert GPLv2 for this project (matches LICENSE file)
- hedge honestly on original Gematro (open-source; original repo deleted, exact license
  unverifiable; this fork adopted GPLv2 when first enhanced/published)
- credit Alektryon's ciphers as AGPLv3 (attributed in CHANGELOG + ciphers.js)
- explain why MIT is incompatible (AGPL copyleft propagation)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 11:59:02 -04:00
malonehunterandClaude Opus 4.7 e50649767e readme: clarify that db.json + db_lite.json are attached to every tagged release
Convention going forward: every Release bundles both db files even if the database itself
didn't change between releases (e.g., v2.4.0 has the same db as v2.3.0). Makes the 'from
the latest release' instruction self-sufficient for newcomers landing on /releases/latest.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-30 07:55:55 -04:00
malonehunterandClaude Opus 4.7 4eb10f2bdb v2.4: decouple highlight-mode toggle + settings persistence + Cmd+click on Mac
Squashed port of the v2.4.0..v2.4.6 iteration on hypercypher production. The history-table
highlight semantics no longer follow the Cross/Same query match mode — a new ▼ toggle next
to the highlight box (styled like the ⚡ auto-match button, dim/lit on/off) controls them
independently. Cross/Same checkboxes now affect only the query/modal + export (as the names
suggest). optHltSameCipher and autoMatchEnabled both round-trip through localStorage now via
calcOptionsArr. Cmd+click on macOS now works as Ctrl+click does on Win/Linux (toggle a
history value into the highlight box) — macOS routes Ctrl+click to contextmenu so the
existing gesture was unreachable for Mac.

Pure client-side; no db change (v2.3 db.json + db_lite.json Release assets still valid).
Files: calc/calc.js, calc/highlighter.js, calc/init-variables.js, calc/styles.css, index.html.
Cache-bust calc v13 / highlighter v3 / init-variables v7 / styles v9.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-30 07:46:08 -04:00
10 changed files with 14328 additions and 22 deletions

No files matched your search

+64
View File
@@ -1,5 +1,69 @@
# Changelog
## v2.5 — NetVoid 2026 Manual Review Merge & Calibrated Junk Filter
### Added
- **+13,855 entries from NetVoid's 2026 manual curation pass** — modern political/conspiracy
phrases, historical event references, pop culture, esoteric concepts, tech/AI. Sourced from
`CYPHERS_CLEANED_DDB_2026.txt` which she's manually reviewing (A–R complete, S–Z in
progress). These are her truly-new additions since her 2023 starting db (14,520 total),
filtered through our calibrated junk rubric.
- **`tools/classify_candidates.py`** — new calibrated junk-rubric tool. Permissive on modern
proper nouns, brand names, acronyms (NASA/MAGA/COVID/AI/...), historical-event references,
and event-phrases with digits (`BLM 2020`, `COVID-19 Policy`, `Election Trump 2024`). Drops
only shared-consensus junk: pure foreign-script, single-letter pairs, keyboard-mash
patterns, bare spelled-numbers (no `[N]` annotation), repeated-word patterns, pure-date
constructions with year, long sentences with very low dictionary density. Drop rate on
NetVoid's 13,861 truly-new additions: 0.04% (6 entries). Reusable — takes any wordlist,
emits keep/drop decisions to JSONL or a plain keep-list. Designed for ecosystem reciprocity
so any merge in either direction stays clean.
### Fixed
- **`tools/normalize_caps.py` no longer mangles modern acronyms via dict-fallthrough.** The
old all-caps-multi-letter rule fell through to Title Case when the lowercase form was in
`/usr/share/dict/words` (web2 / Webster's 2nd, 1934), but web2 includes obscure
historical/Latin/scientific terms that overlap with modern acronyms: `maga`, `covid`, `la`,
`ai`, `id`, `us`, `it`, `ice` were all silently in the dict and being treated as "shouted
dict words" to title-case. Rule simplified to: all-caps multi-letter token → **always
preserve**. Trust the input. 462 acronyms preserved correctly in the NetVoid merge. The
trade-off — genuinely shouted normal words like `A BIG WIN FOR US` stay all-caps instead of
becoming Title Case — is rare in curated db entries and clearly the lesser evil.
### Changed
- Database: **216,088 → 229,943 entries** (+6.4%). `db.json` ~74.8 MB raw / ~32.0 MB gz.
`db_lite.json` ~18.4 MB raw / ~7.4 MB gz. Lite paint still ~2s. `databaseVersion` 3 → 4.
## v2.4 — Highlight-Mode Decouple Toggle & Settings Persistence
### Added
- **Highlight-mode toggle (▼)** next to the highlight box, styled like the ⚡ auto-match
button (dim/lit on/off). Decouples the history-table highlight semantics from the
Cross/Same query match mode:
- Dim (default) = "any matches" — light every cell whose value you typed (cross-style)
- Lit (toggled) = "same column matches only" — light only values that repeat within a
cipher column (same-cipher-pairing)
- The Cross/Same checkboxes in the options panel now affect only the query/modal +
export (as the names suggest); the history-table highlight has its own switch.
- **Settings persistence** for two opt flags that weren't round-tripping through
`localStorage`:
- `optHltSameCipher` (the new toggle) — added to `calcOptionsArr`
- `autoMatchEnabled` (the ⚡ button state) — was the lone outlier among the opt flags;
every other one persisted but this one re-read the device-aware default each page
load. Now persists; the device-aware default still applies for *first* visit per
device, then the user's choice sticks.
- **Cmd+click on macOS** for the "add value to highlight box" power-user gesture. macOS
hard-routes Ctrl+click to a `contextmenu` event (firing the right-click hideValue
toggle instead of the Ctrl+click branch), so the existing gesture was unreachable for
Mac users. The click handler now accepts `e.metaKey` alongside `ctrlIsPressed`.
### Notes
- Plain left-click on a history value still triggers the cross-table blink sweep
regardless of the new toggle — that's the quick "where else does this number appear?"
gesture and predates the match-mode flags. The new toggle governs persistent highlight
semantics (typing into the box, Cmd/Ctrl+click); the ephemeral blink stays mode-free.
- No database changes — the `db.json` / `db_lite.json` Release assets from v2.3 are still
valid; v2.4 ships no new assets.
## v2.3 — Proper-Case Normalization & +6,421 Common Words
### Changed
+5 -3
View File
@@ -59,7 +59,7 @@ git pull origin master
## Database
**216,088 curated entries** (Proper-Case normalized) — cleaned, enriched, and restored from the original user-search database.
**229,943 curated entries** (Proper-Case normalized) — cleaned, enriched, restored from the original user-search database, and extended with NetVoid's 2026 manual review additions.
- Proper-Case normalization with acronym / Roman-numeral / mixed-case protection (see `tools/normalize_caps.py`), plus +6,421 common words from the original 20K wordlist (v2.3)
- Specialty sets (Liber AL, Latin, Roman numerals, spelled-out numbers, Illuminati/esoteric terms)
@@ -71,7 +71,7 @@ git pull origin master
Out of the box the calculator runs in **live mode** — it loads `db.txt` and computes cipher values on the fly (works immediately, ~2-5s per query). For **instant matching** (~100ms), use the pre-computed JSON:
- **Download** the prebuilt **`db.json` and `db_lite.json`** from the [latest release](https://github.com/malonehunter/hyperdope-gematria/releases/latest) and drop them next to `index.html`, **or**
- **Download** the prebuilt **`db.json` and `db_lite.json`** from the [latest release](https://github.com/malonehunter/hyperdope-gematria/releases/latest) (both files are attached to every tagged release, even when the database itself didn't change) and drop them next to `index.html`, **or**
- **Rebuild** both from `db.txt`: `python3 tools/generate_db_json.py db.txt db.json` (emits `db.json` + `db_lite.json`).
With both present, the calculator **loads progressively**: `db_lite.json` (the default ciphers) paints in ~2s with immediate matching, then the full `db.json` streams in and swaps in the background. It auto-detects them (see `databaseMode` / `databaseLiteJsonUrl` in `config.js`). Bump `databaseVersion` in `config.js` whenever you update the databases to cache-bust browsers.
@@ -122,4 +122,6 @@ Append phrases as new lines to `db.txt`. File must start with `CREATE_GEMATRO_DB
## License
MIT
This project is licensed under the **GNU General Public License v2.0** — see [`LICENSE`](LICENSE).
It builds on the original Gematro project (open-source; the original repository has since been deleted, so the exact upstream license isn't independently verifiable — this fork adopted **GPLv2** when first enhanced and published). It also incorporates 11 ciphers ported from [Alektryon's fork](https://github.com/Alektryon/gematria), released under the **GNU Affero General Public License v3.0 (AGPLv3)** and attributed in `CHANGELOG.md` and `calc/ciphers.js`. Because it incorporates AGPL (copyleft) code, the combined work is distributed under copyleft terms and is **not** MIT-licensed.
+36 -4
View File
@@ -53,6 +53,10 @@ var optGemMultCharPosReverse = false; // value of each character is multiplied b
var optFiltSameCipherMatch = true; // DEFAULT: only phrases matching in the SAME cipher (tighter, more meaningful results)
var optFiltCrossCipherMatch = false; // phrases sharing a value across ANY enabled cipher (broader, noisier)
// History-table highlight-box mode, DECOUPLED from the query match mode above.
// false = light EVERY cell whose value you typed (default); true = only same-cipher pairs
// (values repeating within a column). Toggled by the ▦/▥ button next to #highlightBox.
var optHltSameCipher = false;
var alphaHlt = 0.15; // opacity for values that do not match - change value here and in conf_SOM()
var optAllowPhraseComments = true; // allow phrase comments, text inside [...] is not evaluated
@@ -92,7 +96,9 @@ var calcOptionsArr = [
"'optNumCalcMethod'+' = '+optNumCalcMethod",
"'optFiltCrossCipherMatch'+' = '+optFiltCrossCipherMatch",
"'optFiltSameCipherMatch'+' = '+optFiltSameCipherMatch",
"'optHltSameCipher'+' = '+optHltSameCipher",
"'optShowOnlyMatching'+' = '+optShowOnlyMatching",
"'autoMatchEnabled'+' = '+autoMatchEnabled",
"'optNewPhrasesGoFirst'+' = '+optNewPhrasesGoFirst",
"'optShowExtraCiphers'+' = '+optShowExtraCiphers",
"'optAllowPhraseComments'+' = '+optAllowPhraseComments",
@@ -336,6 +342,32 @@ function toggleAutoMatch() {
document.getElementById("phraseBox").focus();
}
// History-table highlight mode toggle (▼ single-icon, ⚡-pattern dim/lit).
// Decoupled from the Cross/Same query match mode.
// Sync the hltModeBtn UI (class + title) to the current optHltSameCipher value.
// Called by toggleHltMode() and from _dbLoaded() after settings restore from localStorage.
function syncHltModeBtn() {
var btn = document.getElementById("hltModeBtn");
if (btn === null) return;
if (optHltSameCipher) {
btn.classList.remove("hltModeOff");
btn.title = "Highlight: same column matches only — click for any matches";
} else {
btn.classList.add("hltModeOff");
btn.title = "Highlight: any matches (every cell with the value) — click for same column matches";
}
}
function toggleHltMode() {
optHltSameCipher = !optHltSameCipher;
syncHltModeBtn();
// re-render with the current highlight-box content
if (document.getElementById("highlightBox").value.replace(/ +/g, " ").trim() !== "") {
if (!optHltSameCipher) { autoHistoryTableLayout(); updateHistoryTable(); }
else { updateHistoryTableSameCiphMatch(); }
}
document.getElementById("phraseBox").focus();
}
$(document).ready(function () {
// Global Escape key handler
$(document).on("keydown", function(e) {
@@ -663,9 +695,9 @@ function conf_SOM() {
} else {
alphaHlt = 0.15;
}
if (optFiltCrossCipherMatch) {
if (!optHltSameCipher) {
updateTables();
} else if (optFiltSameCipherMatch) {
} else {
updateHistoryTableSameCiphMatch();
}
}
@@ -2235,8 +2267,8 @@ function updateHistoryTable(hltBoolArr) {
// if highlight mode is on
if (hltMode) {
// if cross cipher match and highlight box doesn't include number
if (optFiltCrossCipherMatch && !highlt_num.includes(gemVal)) {
// "all matches" highlight mode: dim any cell whose value isn't in the box
if (!optHltSameCipher && !highlt_num.includes(gemVal)) {
col = optColoredCiphers
? "hsl(" +
curCiph.H +
+2 -2
View File
@@ -499,7 +499,7 @@ function tdToggleHighlight(val){ // click on value in history table to toggle hi
hlt_val = JSON.stringify(highlt_num).replace(/,/g, " ") // to string
hlt_val = hlt_val.substring(1, hlt_val.length-1) // remove brackets
document.getElementById("highlightBox").value = hlt_val // update values inside textbox
if (optFiltCrossCipherMatch) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
if (!optHltSameCipher) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
return
}
@@ -508,5 +508,5 @@ function tdToggleHighlight(val){ // click on value in history table to toggle hi
document.getElementById("highlightBox").value += " " // append space if necessary
}
document.getElementById("highlightBox").value += val // append clicked value to Highlight textbox
if (optFiltCrossCipherMatch) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
if (!optHltSameCipher) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
};
+2 -2
View File
@@ -494,7 +494,7 @@ $(document).ready(function(){
autoHistoryTableLayout();
updateHistoryTable();
}
} else if (optFiltCrossCipherMatch) { autoHistoryTableLayout(); updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
} else if (!optHltSameCipher) { autoHistoryTableLayout(); updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
});
$("body").on("click", "td.hC", function () { // Cipher Name in history table (normal mode)
@@ -568,7 +568,7 @@ $(document).ready(function(){
$("body").on("click", ".tC", function (e) { // tC - history table cell
//console.log($(this).find(".gV").html()); // inner html of .gV found in "this"
var val = $(this).find(".gV").html(); // get gematria value from element
if(ctrlIsPressed) { // Ctrl + Left Click - toggle value inside highlight box
if(ctrlIsPressed || e.metaKey) { // Ctrl+Click (Win/Linux) or Cmd+Click (Mac) - toggle value inside highlight box
tdToggleHighlight(parseInt(val.trim(), 10)); // remove spaces, parse as integer and add (remove) to highlight box
} else { // Left Click only - temporary blinking effect
$( "table.HistoryTable td.tC > span:contains('"+val+"')" ).toggleClass('highlightValueBlink'); // add blinking effect
+17
View File
@@ -1034,6 +1034,21 @@ body {
#autoMatchBtn.matchOff {
opacity: 0.35;
}
#hltModeBtn {
background-color: var(--input-bg-accent);
padding: 0em;
margin: 0em 0em 0em 0.3em;
min-width: 32px;
max-width: 32px;
color: hsl(148, 65%, 58%);
font-size: 110%;
line-height: 1;
text-align: center;
vertical-align: middle;
}
#hltModeBtn.hltModeOff {
opacity: 0.35;
}
#calcNotification {
position: absolute;
left: 50%;
@@ -1056,6 +1071,7 @@ body {
#queryDBbtn:hover,
#enterPhraseBtn:hover,
#autoMatchBtn:hover,
#hltModeBtn:hover,
.queryPageBtn:hover {
background-color: var(--btn-hover-accent);
}
@@ -1067,6 +1083,7 @@ body {
#queryDBbtn:active,
#enterPhraseBtn:active,
#autoMatchBtn:active,
#hltModeBtn:active,
.queryPageBtn:active {
background-color: var(--btn-active-accent);
}
+13855
View File
File diff suppressed because it is too large. Load diff
+14 -5
View File
@@ -11,16 +11,16 @@
<!-- Android Web App - Add to Home Screen -->
<link rel="manifest" href="manifest.json" />
<script src="config.js?v=8"></script>
<script src="config.js?v=10"></script>
<script src="lib/jquery.min.js?v=2"></script>
<!-- html2canvas v1.0.0-alpha.12 -->
<script src="calc/gematria.js?v=2"></script>
<script src="calc/calc.js?v=6"></script>
<script src="calc/init-variables.js?v=5"></script>
<script src="calc/calc.js?v=13"></script>
<script src="calc/init-variables.js?v=7"></script>
<script src="calc/ciphers.js?v=5"></script>
<link rel="stylesheet" type="text/css" href="calc/styles.css?v=5" />
<link rel="stylesheet" type="text/css" href="calc/styles.css?v=9" />
<script>
window.onpaint = function () {
@@ -121,6 +121,13 @@
spellcheck="false"
autocomplete="off"
placeholder="highlight #s"
/><input
id="hltModeBtn"
class="hltModeOff"
type="button"
title="Highlight: any matches (every cell with the value) — click for same column matches"
value="▼"
onclick="toggleHltMode()"
/><span id="clearFilterButton"></span>
</div>
@@ -141,7 +148,7 @@
<script src="calc/breakdown.js?v=2"></script>
<script src="calc/highlighter.js?v=2"></script>
<script src="calc/highlighter.js?v=3"></script>
<script src="calc/export.js?v=2"></script>
<script src="calc/export-csv.js?v=2"></script>
<script src="calc/num-prop.js?v=2"></script>
@@ -183,6 +190,8 @@
var amb = document.getElementById("autoMatchBtn");
amb.classList.remove("hideValue");
if (!autoMatchEnabled) amb.classList.add("matchOff");
// Sync hltModeBtn to the (possibly restored from localStorage) optHltSameCipher value.
if (typeof syncHltModeBtn === "function") syncHltModeBtn();
}
// Background: fetch the full 69-cipher set, then swap it in for the lite set.
+324
View File
@@ -0,0 +1,324 @@
#!/usr/bin/env python3
"""Classify gematria-db candidate entries: keep vs drop, with bucket + reason.
Calibrated against the NetVoid 2026 manual-curation cross-check, which exposed the
older dict-ratio / has-digit / camel-mash rules over-flagging modern proper nouns,
brands, acronyms, and event phrases like 'COVID-19 Policy' or 'Donald Trump 2024'.
This filter is intentionally permissive on real-world entries (anything with a
proper-noun signal, any dict word, any digit, OR reasonable structure) and only
hard-drops the patterns both independent curation passes (ours + NetVoid's) agreed
were junk.
Usage:
python3 classify_candidates.py <input.txt> [--out <decisions.jsonl>] [--keep-list <keeps.txt>]
Input: one entry per line. Header line is auto-detected and skipped if it starts
with "CREATE_GEMATRO" or "GEMATRO_DB;" (Derek CSV — first column taken).
Output: prints bucket summary to stdout. Optional --out emits one JSON per line.
Optional --keep-list emits just the kept entries (one per line, no header).
"""
from __future__ import annotations
import json
import re
import sys
from pathlib import Path
def load_dict() -> set[str]:
for p in ("/usr/share/dict/words", "/etc/dictionaries-common/words"):
try:
with open(p, encoding="utf-8", errors="ignore") as f:
return {w.strip().lower() for w in f if w.strip()}
except FileNotFoundError:
continue
return set()
DICT = load_dict()
# ---- patterns ----
NON_ASCII = re.compile(r"[^\x00-\x7f]")
# True non-English-script (no ASCII letters at all)
ASCII_LETTERS_RE = re.compile(r"[A-Za-z]")
MONTH = r"(?:january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)"
ORDINAL = r"(?:first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|eighteenth|nineteenth|twentieth)"
NUMBER_WORD = r"(?:zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety|hundred|thousand|million|billion|and)"
# A "pure date" — calendar wording + REQUIRES a 4-digit year (so 'January 6' / 'April 1st'
# keep their cultural-reference meaning; 'June 28 1969' / 'February twenty eighth 1975' drop).
PURE_DATE_RE = re.compile(
rf"^\s*(?:{MONTH})(?:\s+(?:\d{{1,2}}|{ORDINAL}|{NUMBER_WORD}))*(?:\s*(?:st|nd|rd|th))?\s+\d{{4}}\s*$",
re.I,
)
# Pure spelled number (no other content). Optional [N] annotation kept = our convention.
SPELLED_NUMBER_RE = re.compile(
rf"^\s*(?:{NUMBER_WORD}\s*)+(?:\[\d+\])?\s*$",
re.I,
)
# Pure numeric (year, code, etc.) — usually meaningful in gematria context
PURE_NUMERIC_RE = re.compile(r"^\s*[\d\s/.\-:]+\s*(?:\[\d+\])?\s*$")
# All-caps short fragment — specifically the "A Z" / "B P" / "F O Y" single-letter-and-space pattern.
# Tightened: must be SINGLE letters separated by spaces. 'KSI', 'LMK', 'AC DC' all survive.
ALLCAPS_TINY_RE = re.compile(r"^[A-Z](?:\s+[A-Z])+$")
# Long consonant run within a SINGLE word (10+ consecutive consonants) = keyboard mash.
# Per-word check below avoids false positives like 'Music Industry Symbolism'.
LONG_CONSONANT_RE = re.compile(r"[bcdfghjklmnpqrstvwxyz]{10,}", re.I)
VOWELS = set("aeiouy")
def letters_only(s: str) -> str:
return re.sub(r"[^A-Za-z]", "", s)
def has_proper_noun_signal(words: list[str]) -> bool:
"""At least one capitalized, 3+ letter word with a vowel (e.g., 'Palantir', 'Netanyahu')."""
for w in words:
a = letters_only(w)
if len(a) >= 3 and a[0].isupper() and any(c.lower() in VOWELS for c in a):
return True
return False
def has_dict_word(words: list[str], min_len: int = 2) -> bool:
"""Has at least one English dictionary word. min_len=2 keeps 'is', 'an', 'to', 'by' as signals.
Single-character words ('a', 'i') still excluded.
"""
for w in words:
a = letters_only(w).lower()
if len(a) >= min_len and a in DICT:
return True
return False
def classify(entry: str) -> dict:
"""Return {classification, keep, reason}. Pure function, deterministic."""
raw = entry.rstrip()
if not raw.strip():
return {"classification": "empty", "keep": False, "reason": "empty"}
# 1. PURELY non-ASCII (zero ASCII letters) = wrong db for English ciphers.
# Entries with diacritics (Beyoncé, Oñaz, Æ) survive because they have ASCII letters too.
if NON_ASCII.search(raw) and not ASCII_LETTERS_RE.search(raw):
return {
"classification": "non-ascii-only",
"keep": False,
"reason": "entry has no ASCII letters (foreign script only)",
}
words = raw.split()
nw = len(words)
letters = letters_only(raw)
# 2. tiny fragment: ≤2 letters AND all-lowercase AND no digits.
# Catches 'aa', 'bb', 'cd' (mash); preserves 'YO', 'IQ', 'TF' (uppercase = intent),
# '4G', 'WW3', '3/11' (digits = intent), 'Yu' (mixed-case = name).
if (len(letters) <= 2
and raw == raw.lower()
and not any(c.isdigit() for c in raw)):
return {
"classification": "tiny-fragment",
"keep": False,
"reason": f"all-lowercase ≤2 letters, no digits — likely fragment",
}
# 3. all-caps single-letter pair pattern ('A Z', 'B P', 'F O Y') — not 3-letter acronyms
if ALLCAPS_TINY_RE.match(raw):
return {
"classification": "allcaps-tiny",
"keep": False,
"reason": "single-letter-spaces pattern (e.g. 'A Z', 'B P')",
}
# 4. short + no vowels + ALL-LOWERCASE + no digits = real keyboard mash.
# ('scr', 'wkqz' drop; 'LMK', 'xQc', 'WW3', '4G' survive because case/digits signal intent.)
if (len(letters) <= 5
and letters
and not any(c.lower() in VOWELS for c in letters)
and raw == raw.lower()
and not any(c.isdigit() for c in raw)):
return {
"classification": "no-vowel-mash",
"keep": False,
"reason": "all-lowercase ≤5 letters with no vowels (keyboard mash)",
}
# 5. long consonant run WITHIN A SINGLE WORD (10+ consecutive) = keyboard mash.
# Per-word check avoids cross-word false-positives like 'Music Industry Symbolism'.
for w in words:
if LONG_CONSONANT_RE.search(letters_only(w)):
return {
"classification": "consonant-run",
"keep": False,
"reason": f"single word with 10+ consonants ({w!r})",
}
# 6. same word repeated 3+ times ("Jew Jew Jew Jew Jew")
if nw >= 3 and len({w.lower() for w in words}) == 1:
return {
"classification": "repeated-word",
"keep": False,
"reason": f"same word x{nw}",
}
# 7. pure-date constructions (whole entry is just a calendar date)
if PURE_DATE_RE.match(raw):
return {
"classification": "pure-date",
"keep": False,
"reason": "entry is only a calendar date",
}
# 8. pure spelled-number entries — keep if [N] annotated (our convention), drop bare
if SPELLED_NUMBER_RE.match(raw):
if "[" in raw and "]" in raw:
return {
"classification": "spelled-number-annotated",
"keep": True,
"reason": "spelled number with [N] annotation (our convention)",
}
return {
"classification": "spelled-number-bare",
"keep": False,
"reason": "bare spelled number with no [N] annotation or context",
}
# 9. pure numeric (year/code) — almost always meaningful in gematria
if PURE_NUMERIC_RE.match(raw):
return {
"classification": "numeric",
"keep": True,
"reason": "pure numeric (year, code, date — usually meaningful)",
}
# 10. long scraped sentence (≥15 words AND low real-word density)
if nw >= 15:
dict_hits = sum(
1 for w in words if (a := letters_only(w).lower()) and len(a) >= 3 and a in DICT
)
if dict_hits < nw * 0.4:
return {
"classification": "long-scraped",
"keep": False,
"reason": f"long sentence (nw={nw}) with low dict density ({dict_hits} dict words)",
}
return {
"classification": "long-content",
"keep": True,
"reason": f"long sentence (nw={nw}) with real content",
}
# 11. final signal test: any of {dict word, proper-noun pattern, digit, uppercase letter}.
# An uppercase letter = intentional capitalization = signal of intent.
# ('AC DC' = band, 'KSI' = name, 'IOU' = abbr — all have uppercase so all survive.)
has_d = has_dict_word(words)
has_p = has_proper_noun_signal(words)
has_n = any(c.isdigit() for c in raw)
has_u = any(c.isupper() for c in raw)
if not (has_d or has_p or has_n or has_u):
return {
"classification": "no-signal",
"keep": False,
"reason": "no dict words, no proper-noun, no digits, no uppercase — likely junk",
}
# default: keep
return {
"classification": "keep",
"keep": True,
"reason": "passes filter",
}
def load_entries(path: Path) -> list[str]:
"""Auto-detect Gematro header + CSV format; return list of phrase strings."""
out: list[str] = []
with open(path, encoding="utf-8", errors="replace") as f:
first: str | None = None
for i, line in enumerate(f):
line = line.rstrip("\r\n")
if i == 0:
first = line
if line.upper().startswith("CREATE_GEMATRO") or line.startswith("GEMATRO_DB;"):
continue # header, skip
if line.strip():
out.append(line)
else:
if line.strip():
if first and first.startswith("GEMATRO_DB;"):
out.append(line.split(";")[0])
else:
out.append(line)
return out
def main(argv: list[str]) -> int:
if not argv or argv[0] in ("-h", "--help"):
print(__doc__)
return 0
inp = Path(argv[0])
out_path: Path | None = None
keep_path: Path | None = None
i = 1
while i < len(argv):
if argv[i] == "--out" and i + 1 < len(argv):
out_path = Path(argv[i + 1])
i += 2
elif argv[i] == "--keep-list" and i + 1 < len(argv):
keep_path = Path(argv[i + 1])
i += 2
else:
i += 1
entries = load_entries(inp)
decisions: list[dict] = []
keeps: list[str] = []
buckets: dict[str, int] = {}
for e in entries:
d = classify(e)
d["entry"] = e
decisions.append(d)
buckets[d["classification"]] = buckets.get(d["classification"], 0) + 1
if d["keep"]:
keeps.append(e)
if out_path:
with open(out_path, "w", encoding="utf-8") as f:
for d in decisions:
f.write(json.dumps(d, ensure_ascii=False) + "\n")
if keep_path:
with open(keep_path, "w", encoding="utf-8") as f:
f.write("\n".join(keeps) + "\n")
n = len(entries) or 1
kept = len(keeps)
dropped = n - kept
print(f"input: {len(entries):,} keep: {kept:,} ({kept/n*100:.1f}%) drop: {dropped:,} ({dropped/n*100:.1f}%)")
print("by classification:")
for b, c in sorted(buckets.items(), key=lambda x: -x[1]):
marker = "+" if classify_returns_keep_for_bucket(b, decisions) else "-"
print(f" {marker} {c:>7,} {b}")
return 0
def classify_returns_keep_for_bucket(bucket: str, decisions: list[dict]) -> bool:
"""Whether this bucket recommends keep (for stdout summary marker)."""
for d in decisions:
if d["classification"] == bucket:
return d["keep"]
return False
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
+9 -6
View File
@@ -46,13 +46,16 @@ def xform_word(w):
# mixed-case (an uppercase letter past the first, but NOT all-caps): preserve iPhone / eBay / McDonald
if w != w.lower() and w != w.upper() and not (w[0].isupper() and w[1:] == w[1:].lower()):
return w
# all-caps multi-letter token
# all-caps multi-letter token: preserve as-is. This single rule covers acronyms
# (NASA, FBI, MAGA, COVID), Roman numerals (XXXIII), modern shortforms (AI, LA, ID,
# KSI), and brand/band names (AC DC). We used to fall through to Title Case when the
# lowercased token was in /usr/share/dict/words, but that dict knows 'maga', 'covid',
# 'la', 'ai', 'id', 'us', 'it', 'ice' as words and was mangling 462 modern acronyms
# in NetVoid's 2026 additions. Trust the input: if it's typed all-caps, keep it.
# Cost: 'A BIG WIN FOR US' stays loud instead of becoming 'A Big Win For Us' — rare
# in curated db entries and clearly the lesser evil.
if w == w.upper() and len(letters) >= 2:
if is_roman(letters):
return w # XXXIII -> keep
if letters.lower() not in DICT:
return w # NASA / FBI / BMX -> keep (acronym)
# else: a real word shouted (BIG) -> fall through to Title Case
return w
# lowercase/mixed Roman numeral that isn't a real word: uppercase it (mmxlvi -> MMXLVI)
if len(letters) >= 2 and is_roman(letters) and letters.lower() not in DICT:
return w.upper()