Highlight whole noun phrases (1319 samples from cache / 4/4 predictions / 0 samples left to run), not bare numbers; score rule runs first so scores keep solid green

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sora 2026-09-11 03:09:15 +00:00
parent a8c04311c0
commit d7f06395a0

View File

@ -202,13 +202,6 @@ def _print_run_plan(console, args, model_spec):
def _narration(msg: str) -> str:
"""Icon + path-highlighting for narration lines (visual separation at
a glance; paths in cyan)."""
# semantic numbers get bold: samples counts, checkpoint fractions,
# generation counts, few-shot counts (curated, not rich's blanket highlight)
import re as _re0
msg = _re0.sub(r'(?<![\w/%.])(\d+(?:/\d+)?)(?=[\s]|$)',
r'[bold yellow]\1[/bold yellow]', msg)
icon = ''
m = msg.lower()
if m.startswith('loading/'):
@ -239,6 +232,14 @@ def _narration(msg: str) -> str:
if m:
return (f'{icon}{msg[:m.start()]}'
f'[bold green]{m.group(1)}[/bold green]')
# semantic PHRASES get color, not bare numbers: '164 samples from cache',
# '4/4 predictions' -- a lone number is easy to lose. Runs AFTER the
# score rule so scores keep their solid green.
import re as _re0
msg = _re0.sub(r'(?<![\w/%.])(\d+(?:/\d+)?(?:\s+[a-z-]+){0,4})(?=[\s,.]|$)',
r'[bold yellow]\1[/bold yellow]', msg)
# highlight any trailing path after '->'
if '-> ' in msg:
head, _, tail = msg.partition('-> ')