Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4eb10f2bdb | ||
|
|
202fe8ed04 | ||
|
|
bcd1308020 | ||
|
|
a71eee7e07 |
No files matched your search
@@ -1,5 +1,54 @@
|
||||
# Changelog
|
||||
|
||||
## 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
|
||||
- **Database normalized to Proper Case** — every word's first letter capitalized, while
|
||||
preserving acronyms (NASA), Roman numerals (XXXIII), and mixed-case brands (iPhone).
|
||||
~60% of entries re-cased for consistent skimming. Only the 5 **case-sensitive** ciphers
|
||||
(Alphanumeric Case Sensitive, Capitals Added/Mixed, Reverse Caps Added/Mixed) change value;
|
||||
every other cipher lowercases input first, so their values are unaffected.
|
||||
|
||||
### Added
|
||||
- **+6,421 common English words** filled in from the original Gematro 20K wordlist (short /
|
||||
no-vowel fragments dropped). **209,667 → 216,088 entries.**
|
||||
|
||||
### Tools
|
||||
- `tools/normalize_caps.py` — the smart Proper-Case pass: dictionary-aware acronym detection,
|
||||
strict Roman-numeral + mixed-case preservation, digit/`[bracket]` passthrough. Reusable on
|
||||
any Gematro `db.txt`.
|
||||
|
||||
## v2.2 — Progressive Loading, Curated Default Loadout & 11 New Ciphers
|
||||
|
||||
### Added
|
||||
|
||||
@@ -59,8 +59,9 @@ git pull origin master
|
||||
|
||||
## Database
|
||||
|
||||
**209,667 curated entries** — cleaned, enriched, and restored from the original user-search database.
|
||||
**216,088 curated entries** (Proper-Case normalized) — cleaned, enriched, and restored from the original user-search database.
|
||||
|
||||
- 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)
|
||||
- Restoration of ~20k entries an earlier over-aggressive cleanup had removed (concentrated at the alphabet "ends" — A/B/C/X/Y/Z)
|
||||
- ~7.7k recovered Thelemic/Hermetic terms (CCRU/Numogram, Crowley, Rosicrucian)
|
||||
|
||||
+54
-6
@@ -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",
|
||||
@@ -266,8 +272,9 @@ function createCiphersMenu() {
|
||||
'<input class="intBtn3 ciphPresetBtn" type="button" value="Empty" onclick="disableAllCiphers()">';
|
||||
o +=
|
||||
'<input class="intBtn3 ciphPresetBtn" type="button" value="Base" onclick="enableBaseCiphers()">';
|
||||
o +=
|
||||
'<input class="intBtn3 ciphPresetBtn" type="button" value="Default" onclick="enableDefaultCiphers()">';
|
||||
if (typeof CALC_CONFIG !== 'undefined' && Array.isArray(CALC_CONFIG.recommendedCiphers) && CALC_CONFIG.recommendedCiphers.length > 0)
|
||||
o +=
|
||||
'<input class="intBtn3 ciphPresetBtn" type="button" value="Curated" onclick="enableRecommendedCiphers()">';
|
||||
o +=
|
||||
'<input class="intBtn3 ciphPresetBtn" type="button" value="All (EN)" onclick="enableAllEnglishCiphers()">';
|
||||
o +=
|
||||
@@ -335,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) {
|
||||
@@ -662,9 +695,9 @@ function conf_SOM() {
|
||||
} else {
|
||||
alphaHlt = 0.15;
|
||||
}
|
||||
if (optFiltCrossCipherMatch) {
|
||||
if (!optHltSameCipher) {
|
||||
updateTables();
|
||||
} else if (optFiltSameCipherMatch) {
|
||||
} else {
|
||||
updateHistoryTableSameCiphMatch();
|
||||
}
|
||||
}
|
||||
@@ -1623,6 +1656,21 @@ function enableBaseCiphers() {
|
||||
updateTables(); // update
|
||||
}
|
||||
|
||||
// "Curated" preset: the fork's recommended extended loadout (CALC_CONFIG.recommendedCiphers,
|
||||
// = the lite-db set, so all match instantly). Button only renders when that list is non-empty.
|
||||
function enableRecommendedCiphers() {
|
||||
prevCiphIndex = -1; // reset cipher selection
|
||||
var rec = (typeof CALC_CONFIG !== 'undefined' && Array.isArray(CALC_CONFIG.recommendedCiphers)) ? CALC_CONFIG.recommendedCiphers : [];
|
||||
var cur_chkbox;
|
||||
for (i = 0; i < cipherList.length; i++) {
|
||||
var on = rec.indexOf(cipherList[i].cipherName) > -1;
|
||||
cipherList[i].enabled = on;
|
||||
cur_chkbox = document.getElementById("cipher_chkbox" + i);
|
||||
if (cur_chkbox !== null) cur_chkbox.checked = on;
|
||||
}
|
||||
updateTables(); // update
|
||||
}
|
||||
|
||||
function toggleCipherCategory(ciph_cat) {
|
||||
prevCiphIndex = -1; // reset cipher selection
|
||||
// Check if custom config category
|
||||
@@ -2219,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
@@ -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(); }
|
||||
};
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,11 @@ var CALC_CONFIG = {
|
||||
// defaultEnabledCiphers: ["Ordinal", "Reduction", "Reverse Ordinal", "Reverse Reduction"],
|
||||
defaultEnabledCiphers: [],
|
||||
|
||||
// Optional "Curated" preset button — a one-click extended loadout. Empty/omitted => no
|
||||
// button shown. Keep in sync with the lite db.json (tools/generate_db_json.py LITE_CIPHERS).
|
||||
// Example: recommendedCiphers: ["Ordinal", "Reduction", "Alphanumeric Qabbala", ...],
|
||||
recommendedCiphers: [],
|
||||
|
||||
// --- Custom Cipher Categories ---
|
||||
// Group ciphers into custom menu sections. Ciphers are referenced by
|
||||
// their exact name from ciphers.js. They still appear in their original
|
||||
|
||||
+14
-5
@@ -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.
|
||||
|
||||
@@ -19,7 +19,7 @@ from pathlib import Path
|
||||
from all_ciphers import get_ciphers, compute_value
|
||||
|
||||
# Lite db.json cipher subset for progressive first-paint. MUST stay in sync with
|
||||
# production config.js `defaultEnabledCiphers` (the default 16-cipher loadout).
|
||||
# production config.js `recommendedCiphers` (the 16-cipher "Curated" set).
|
||||
LITE_CIPHERS = [
|
||||
"Ordinal", "Reduction", "Reverse Ordinal", "Reverse Reduction",
|
||||
"Standard", "Latin (Jewish)", "English Sumerian", "Satanic Gematria",
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Normalize a Gematro db.txt to Proper Case.
|
||||
|
||||
Rule (NetVoid's "capitalise first letter of every word, keep 3-letter agencies",
|
||||
done smartly): capitalize the first letter of every word and lowercase the rest,
|
||||
BUT preserve:
|
||||
- acronyms e.g. NASA, FBI, BMX (all-caps tokens that aren't dictionary words)
|
||||
- Roman numerals e.g. XXXIII, II, and lowercase mmxlvi -> MMXLVI
|
||||
- mixed-case e.g. iPhone, eBay, McDonald (internal capitals)
|
||||
- digits / [bracket] annotations -> left untouched
|
||||
|
||||
Only the 5 case-sensitive ciphers (Alphanumeric Case Sensitive, Capitals Added/Mixed,
|
||||
Reverse Caps Added/Mixed) change value; every other cipher lowercases first.
|
||||
|
||||
Usage: python3 normalize_caps.py <in.txt> <out.txt> [--report]
|
||||
Output is deduped (case-insensitive) and re-sorted (case-insensitive), matching the
|
||||
db.txt invariants.
|
||||
"""
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def load_dict():
|
||||
try:
|
||||
return {w.strip().lower() for w in open("/usr/share/dict/words", errors="ignore") if w.strip()}
|
||||
except FileNotFoundError:
|
||||
return set()
|
||||
|
||||
|
||||
DICT = load_dict()
|
||||
ROMAN = re.compile(r"M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})", re.I)
|
||||
|
||||
|
||||
def is_roman(s):
|
||||
return bool(s) and ROMAN.fullmatch(s) is not None
|
||||
|
||||
|
||||
def xform_word(w):
|
||||
# digits / brackets: leave entirely alone (numbers, [N] annotations)
|
||||
if any(c.isdigit() for c in w) or "[" in w or "]" in w:
|
||||
return w
|
||||
letters = re.sub(r"[^A-Za-z]", "", w)
|
||||
if not letters:
|
||||
return 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
|
||||
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
|
||||
# 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()
|
||||
# normal word: Title Case
|
||||
return w[:1].upper() + w[1:].lower()
|
||||
|
||||
|
||||
def xform(line):
|
||||
return " ".join(xform_word(w) for w in line.split())
|
||||
|
||||
|
||||
def main():
|
||||
inp, outp = Path(sys.argv[1]), Path(sys.argv[2])
|
||||
report = "--report" in sys.argv[3:]
|
||||
lines = [l.rstrip("\r\n") for l in open(inp, encoding="utf-8")]
|
||||
header = lines[0] if lines and "GEMATRO" in lines[0].upper() else None
|
||||
body = [l for l in (lines[1:] if header else lines) if l.strip()]
|
||||
|
||||
out = [xform(l) for l in body]
|
||||
changed = [(a, b) for a, b in zip(body, out) if a != b]
|
||||
|
||||
# case-insensitive dedup (collapses any case-variants merged by the transform) + re-sort
|
||||
seen = {}
|
||||
for o in out:
|
||||
seen.setdefault(o.lower(), o)
|
||||
dedup = sorted(seen.values(), key=lambda s: s.lower())
|
||||
removed = len(out) - len(dedup)
|
||||
|
||||
with open(outp, "w", encoding="utf-8") as f:
|
||||
if header:
|
||||
f.write(header + "\n")
|
||||
f.write("\n".join(dedup) + "\n")
|
||||
|
||||
print(f"dict words: {len(DICT):,}")
|
||||
print(f"in={len(body):,} changed={len(changed):,} ({len(changed)/len(body)*100:.0f}%) "
|
||||
f"case-dups removed={removed:,} out={len(dedup):,}")
|
||||
|
||||
if report:
|
||||
import random
|
||||
print("\n--- rule demo (hardcoded) ---")
|
||||
for s in ["NASA conspiracy", "World War II", "xxxiii", "mmxlvi", "iPhone",
|
||||
"the FBI and CIA", "a BIG WIN for US", "a bmx god", "eBay", "apple"]:
|
||||
print(f" {s!r:22} -> {xform(s)!r}")
|
||||
print("\n--- 18 real before -> after (changed entries) ---")
|
||||
random.seed(5)
|
||||
for a, b in random.sample(changed, 18):
|
||||
print(f" {a!r}\n -> {b!r}")
|
||||
# protection counts
|
||||
kept_acro = sum(1 for l in dedup for w in l.split()
|
||||
if w == w.upper() and len(re.sub(r"[^A-Za-z]", "", w)) >= 2
|
||||
and not is_roman(re.sub(r"[^A-Za-z]", "", w)))
|
||||
kept_roman = sum(1 for l in dedup for w in l.split()
|
||||
if w == w.upper() and is_roman(re.sub(r"[^A-Za-z]", "", w)) and len(w) >= 2)
|
||||
print(f"\n all-caps acronym tokens preserved: {kept_acro:,}")
|
||||
print(f" all-caps Roman-numeral tokens: {kept_roman:,}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user