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:
parent
a8c04311c0
commit
d7f06395a0
@ -202,13 +202,6 @@ def _print_run_plan(console, args, model_spec):
|
|||||||
def _narration(msg: str) -> str:
|
def _narration(msg: str) -> str:
|
||||||
"""Icon + path-highlighting for narration lines (visual separation at
|
"""Icon + path-highlighting for narration lines (visual separation at
|
||||||
a glance; paths in cyan)."""
|
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 = ''
|
icon = ''
|
||||||
m = msg.lower()
|
m = msg.lower()
|
||||||
if m.startswith('loading/'):
|
if m.startswith('loading/'):
|
||||||
@ -239,6 +232,14 @@ def _narration(msg: str) -> str:
|
|||||||
if m:
|
if m:
|
||||||
return (f'{icon}{msg[:m.start()]}'
|
return (f'{icon}{msg[:m.start()]}'
|
||||||
f'[bold green]{m.group(1)}[/bold green]')
|
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 '->'
|
# highlight any trailing path after '->'
|
||||||
if '-> ' in msg:
|
if '-> ' in msg:
|
||||||
head, _, tail = msg.partition('-> ')
|
head, _, tail = msg.partition('-> ')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user