Score bars: rich-style half-cell glyphs (━━━╸╌╌) replacing block chars

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sora 2026-09-10 09:30:25 +00:00
parent 5c3d622f41
commit 075e8728cb

View File

@ -262,12 +262,19 @@ def _print_result_panel(console, rep, wall_s: float = 0.0):
body = Table(show_header=False, box=None, padding=(0, 2))
body.add_column('k', style='dim', no_wrap=True)
body.add_column('v', overflow='fold')
def score_bar(v, width=22):
# rich-Bar-style glyphs with half-cell precision: ━━━╸╌╌
filled = max(0.0, min(1.0, v)) * width
full = int(filled)
half = '' if filled - full >= 0.5 else ''
return '' * full + half + '' * (width - full - len(half))
for m, v in metrics:
if m == 'extraction_failure_rate':
continue
bar = Text('' * int(round(v * 24)) + '·' * (24 - int(round(v * 24))))
bar.stylize(color(v))
body.add_row(m, Text.assemble(f'{v * 100:6.1f}% ', bar))
body.add_row(m, Text.assemble(
(f'{v * 100:6.1f}% ', f'bold {color(v)}'),
(score_bar(v), color(v))))
stats = []
stats.append(f'n={rep.num_samples}')
if wall_s >= 1:
@ -343,12 +350,19 @@ def _print_result_panel(console, rep, wall_s: float = 0.0):
body = Table(show_header=False, box=None, padding=(0, 2))
body.add_column('k', style='dim', no_wrap=True)
body.add_column('v', overflow='fold')
def score_bar(v, width=22):
# rich-Bar-style glyphs with half-cell precision: ━━━╸╌╌
filled = max(0.0, min(1.0, v)) * width
full = int(filled)
half = '' if filled - full >= 0.5 else ''
return '' * full + half + '' * (width - full - len(half))
for m, v in metrics:
if m == 'extraction_failure_rate':
continue
bar = Text('' * int(round(v * 24)) + '·' * (24 - int(round(v * 24))))
bar.stylize(color(v))
body.add_row(m, Text.assemble(f'{v * 100:6.1f}% ', bar))
body.add_row(m, Text.assemble(
(f'{v * 100:6.1f}% ', f'bold {color(v)}'),
(score_bar(v), color(v))))
stats = []
stats.append(f'n={rep.num_samples}')
if wall_s >= 1: