1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! # score-set
//!
//! A Rust library for building **static weighted scoring operator sets**.
//!
//! It does not prescribe a unified input or context type. Instead it declares,
//! stores, normalizes, and combines a set of weighted operators — scoring is
//! done via a user-provided closure that can inject arbitrary runtime data.
//!
//! # Quick example
//!
//! ```ignore
//! use score_set::*;
//!
//! let gc = metric("gc")
//! .measure().by(|dna: &&str| gc_ratio(dna))
//! .map01().by(|raw: &f64, _: &&str| Value01::witness(*raw).unwrap());
//!
//! let len = metric("len")
//! .measure().by(|len: &usize| *len)
//! .map01().by(|raw: &usize, _: &usize| {
//! Value01::witness((*raw as f64 / 100.0).min(1.0)).unwrap()
//! });
//!
//! let ms = score_set! {
//! 2.0 => gc,
//! 3.0 => len,
//! }?;
//!
//! let dna = "ACGTACGT";
//! let score = ms.score().by(|(gc, len)| {
//! gc.contribute(gc.metric().eval(&dna))
//! + len.contribute(len.metric().eval(&dna.len()))
//! });
//! # Ok::<(), &'static str>(())
//! ```
// Public API
pub use Float;
// score_set! is exported at crate root via #[macro_export]
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;