makepad/libs/score_pdf/src/confidence.rs
Admin 145d0b1fe2 score: the notation suite — engraving, layout, playback, midi and musicxml import, the physical piano model, and the score app
Squashed from work:
- score: a headless music engraving, playback and notation engine
- score: the notation app — pianist mode, editing, playback
- piano_model: it was a plucked string by construction, and 20 voicings
- score: one document you can pan, zoom and navigate
- piano_model: the body tap was a click, and the objective was rewarding noise
- score: add the sound panel and library modules
- piano_model: a second engine, and the attack that finally sounded right
- score: two instruments, reverb and brightness — and the rest of the panel gone
- score model: a note remembers how it was struck, and the score remembers the pedal
- score import: keep the velocities and the pedal the file was carrying
- score playback: play the performance, not a flattened copy of it
- score ui: the music list moves to the sidebar, and the view stops fighting itself
- score: the application ships its font and eight performances
- piano_model: a limiter that rides the music, so the knee stops shaping chords
- piano_model: the forte bell was the treble's dynamic slope, and the bass was dying at its own prompt rate
- piano_model: the bridge decides each partial's decay, and a fixed multiplier cannot say that
- piano_model: each partial gets its own two coupled modes, from the eigen algebra
- piano_model: a median that fell between the peaks made every bass partial a drain
- score-ai: LocalBroker — the seam's in-process implementation over the session engine (aicore P8)
- client + chat dispatcher: the dead wire comes out (aicore P7/P8)
- score_pdf: the score model grew a pedal map — the pdf importer initialises it
- libs: the zero-warning sweep — stitch casts say what they mean, xatlas keeps upstream's surface quietly
- score app: the shipped-piece test speaks the PERFORMANCES table
- zero-warning sweep, round three — the model lanes and the deep examples
2026-09-01 16:46:32 +02:00

75 lines
1.8 KiB
Rust

//! Per-attribute confidence and inspectable evidence.
#[derive(Clone, Debug, PartialEq)]
pub enum Evidence {
SmuflName(String),
SmuflCodepoint(char),
VendorAlias { vendor: String, source: String },
StructuralName(String),
GeometryMatch { canonical: String, distance: f32 },
StaffResidual(f32),
ClefInForce { primitive: u64 },
KeySignature(i8),
MeasureAccidental { primitive: u64 },
BeamLevels(u8),
FlagLevels(u8),
DotCount(u8),
StemDirection(i8),
SharedStem,
SamePitchEndpoints,
DifferentPitchEndpoints,
AttachmentDistance(f32),
MeterConflict,
NoEvidence(String),
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Verification {
Certain,
Inferred,
UserVerified,
Ambiguous,
Unavailable,
}
#[derive(Clone, Debug, PartialEq)]
pub struct Estimate<T> {
pub value: T,
pub probability: f32,
pub runner_up_margin: f32,
pub evidence: Vec<Evidence>,
pub verification: Verification,
}
impl<T> Estimate<T> {
pub fn new(
value: T,
probability: f32,
runner_up_margin: f32,
evidence: Vec<Evidence>,
verification: Verification,
) -> Self {
Self {
value,
probability: probability.clamp(0.0, 1.0),
runner_up_margin: runner_up_margin.clamp(0.0, 1.0),
evidence,
verification,
}
}
pub fn certain(value: T, evidence: Evidence) -> Self {
Self::new(value, 1.0, 1.0, vec![evidence], Verification::Certain)
}
pub fn inferred(value: T, probability: f32, evidence: Vec<Evidence>) -> Self {
Self::new(
value,
probability,
(probability - 0.5).max(0.0),
evidence,
Verification::Inferred,
)
}
}