pub struct Rules { /* private fields */ }Expand description
A rules file, parsed and checked against the questions it will read.
Implementations§
Source§impl Rules
impl Rules
Sourcepub fn graph_text(&self, reply: Option<&DecisionResponse>) -> Result<String>
pub fn graph_text(&self, reply: Option<&DecisionResponse>) -> Result<String>
The rules for a terminal: each rule as a tree of its operators down to its terms, what it
concludes, and then the final scores and each output’s merged shape. With reply, every node
carries its number; without it, this is the structure alone. Ends with a newline.
Source§impl Rules
impl Rules
Sourcepub fn graph_svg(&self, reply: Option<&DecisionResponse>) -> Result<String>
pub fn graph_svg(&self, reply: Option<&DecisionResponse>) -> Result<String>
The rules as an SVG image: a row per rule with its premises (each question’s levels or
options as bars of their probabilities, the term’s own in bold), the tree of operators that
combine them, and its conclusion (an item’s bar, or an output’s set clipped at the rule’s
score); then a final column with every item against the threshold and each output’s merged
shape and its centre. Without reply, the structure alone.
Source§impl Rules
impl Rules
Sourcepub fn parse<'a>(
text: &str,
questions: impl IntoIterator<Item = (&'a str, &'a Question)>,
) -> Result<Rules, String>
pub fn parse<'a>( text: &str, questions: impl IntoIterator<Item = (&'a str, &'a Question)>, ) -> Result<Rules, String>
The rules in text (TOML), for a reply to questions. Every term is checked against the
questions here, before anything is asked; the error says what is wrong and where.
Sourcepub fn evaluate(&self, reply: &DecisionResponse) -> Result<Outcome>
pub fn evaluate(&self, reply: &DecisionResponse) -> Result<Outcome>
The outcome reply gives: every then, in the order the file first names it, with its
score and the rules behind it.