chore: initialize baseline hyperdope-gematria target files on master
This commit is contained in:
commit
79b4503d6c
4 files changed
+92
No files matched your search
@@ -0,0 +1,14 @@
|
|||||||
|
// config.default.js — hyperdope-gematria configuration
|
||||||
|
const defaultConfig = {
|
||||||
|
databaseVersion: 26,
|
||||||
|
optAllowPhraseComments: true,
|
||||||
|
customCategories: {
|
||||||
|
"Ingglish / CCRU": [
|
||||||
|
"Alphanumeric Qabbala",
|
||||||
|
"Synx",
|
||||||
|
"Based Atlanteanism",
|
||||||
|
"Primes",
|
||||||
|
"Ordinal"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
CREATE_GEMATRO_DB
|
||||||
|
Alphanumeric Qabbala
|
||||||
|
Cybernetic Culture Research Unit
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Upstream-compatible tools/classify_candidates.py with [Ingglish: ...] recognition."""
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
def classify(line: str) -> dict:
|
||||||
|
s = line.strip()
|
||||||
|
if "[Ingglish:" in s and "]" in s:
|
||||||
|
return {"classification": "ingglish-curated", "keep": True, "reason": "curated Ingglish phonetic entry with English gloss"}
|
||||||
|
return {"classification": "standard", "keep": True, "reason": "standard entry"}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Upstream-compatible tools/normalize_caps.py for hyperdope-gematria."""
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
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 load_dict():
|
||||||
|
for p in ("/usr/share/dict/words", "/etc/dictionaries-common/words"):
|
||||||
|
if Path(p).exists():
|
||||||
|
return {w.strip().lower() for w in Path(p).read_text(encoding="utf-8", errors="ignore").splitlines() if w.strip()}
|
||||||
|
return set()
|
||||||
|
|
||||||
|
|
||||||
|
DICT = load_dict()
|
||||||
|
|
||||||
|
|
||||||
|
def is_roman(s):
|
||||||
|
return bool(s) and ROMAN.fullmatch(s) is not None
|
||||||
|
|
||||||
|
|
||||||
|
def xform_word(w):
|
||||||
|
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
|
||||||
|
if w != w.lower() and w != w.upper() and not (w[0].isupper() and w[1:] == w[1:].lower()):
|
||||||
|
return w
|
||||||
|
if w == w.upper() and len(letters) >= 2:
|
||||||
|
return w
|
||||||
|
if len(letters) >= 2 and is_roman(letters) and letters.lower() not in DICT:
|
||||||
|
return w.upper()
|
||||||
|
return w[:1].upper() + w[1:].lower()
|
||||||
|
|
||||||
|
|
||||||
|
def xform_line(line):
|
||||||
|
return " ".join(xform_word(w) for w in line.split())
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
sys.exit(0)
|
||||||
|
in_path, out_path = Path(sys.argv[1]), Path(sys.argv[2])
|
||||||
|
raw_lines = in_path.read_text(encoding="utf-8").splitlines()
|
||||||
|
header = raw_lines[0] if raw_lines and "GEMATRO" in raw_lines[0].upper() else "CREATE_GEMATRO_DB"
|
||||||
|
seen = set()
|
||||||
|
body = []
|
||||||
|
for line in raw_lines[1:]:
|
||||||
|
s = line.strip()
|
||||||
|
if not s:
|
||||||
|
continue
|
||||||
|
norm = xform_line(s)
|
||||||
|
key = norm.lower()
|
||||||
|
if key not in seen:
|
||||||
|
seen.add(key)
|
||||||
|
body.append(norm)
|
||||||
|
body.sort(key=lambda x: x.lower())
|
||||||
|
out_path.write_text("\n".join([header] + body) + "\n", encoding="utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in new issue
Block a user