aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/numspell.py
diff options
context:
space:
mode:
authorElvis Claros Castro <elvis@claros.ar>2026-09-26 20:50:41 -0300
committerElvis Claros Castro <elvis@claros.ar>2026-09-26 20:50:41 -0300
commitfafaebb051907a848a9406f9da19669c81a83a3b (patch)
treec30ea26e6b549e5523af2bae5c39569e9a946b12 /scripts/numspell.py
parent59355909f2de9236af8168a26c70bcf6caa3b285 (diff)
download100cia-videos-main.tar.gz
100cia-videos-main.zip
Translate code, comments and logs to English; English README; configurable paths and env varsHEADmain
Identifiers, docstrings, comments and console messages are now in English. Narration, subtitles and on-screen text stay in Spanish (they are the video content). The Blender <-> Godot physics protocol uses English keys and body prefixes chosen to keep the original creation order, so cached simulations and renders stay bit-identical. The old Spanish environment variable names are still accepted.
Diffstat (limited to 'scripts/numspell.py')
-rw-r--r--scripts/numspell.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/scripts/numspell.py b/scripts/numspell.py
index 2e416e3..9b5979e 100644
--- a/scripts/numspell.py
+++ b/scripts/numspell.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-"""Pasa los numeros de una transcripcion a palabras, para poder compararla
-con el guion (que escribe todo en letras)."""
+"""Turns the numbers in a transcription into words, so it can be compared
+with the script (which spells everything out)."""
import re
U = ["cero", "uno", "dos", "tres", "cuatro", "cinco", "seis", "siete", "ocho", "nueve",
@@ -30,11 +30,11 @@ def spell_int(n):
return _lt1000(n)
if n < 1000000:
m, r = divmod(n, 1000)
- pre = "mil" if m == 1 else _lt1000(m) + " mil"
- return pre + (" " + _lt1000(r) if r else "")
+ pre_frames = "mil" if m == 1 else _lt1000(m) + " mil"
+ return pre_frames + (" " + _lt1000(r) if r else "")
m, r = divmod(n, 1000000)
- pre = "un millon" if m == 1 else _lt1000(m) + " millones"
- return pre + (" " + spell_int(r) if r else "")
+ pre_frames = "un millon" if m == 1 else _lt1000(m) + " millones"
+ return pre_frames + (" " + spell_int(r) if r else "")
def _tok(m):
@@ -42,10 +42,10 @@ def _tok(m):
s = re.sub(r"\.(?=\d{3}\b)", "", s) # 384.000 -> 384000
if "," in s:
a, b = s.split(",", 1)
- ent = spell_int(int(a or 0))
+ whole = spell_int(int(a or 0))
dec = " ".join(U[int(c)] for c in b if c.isdigit())
- return f"{ent} coma {dec}"
- if "." in s: # 0.5 estilo ingles
+ return f"{whole} coma {dec}"
+ if "." in s: # 0.5 English style
a, b = s.split(".", 1)
return f"{spell_int(int(a or 0))} coma " + " ".join(U[int(c)] for c in b if c.isdigit())
return spell_int(int(s))