use crate::corpus::TraceCorpus;
use crate::score::ScoredPattern;
use fabula::pattern::Pattern;
pub trait CandidateGenerator {
fn generate(&mut self, corpus: &TraceCorpus, budget: usize) -> Vec<Pattern<String, String>>;
fn feedback(&mut self, scored: &[ScoredPattern<String, String>]);
fn name(&self) -> &str;
}
pub trait PatternEvaluator {
fn evaluate(&self, pattern: &Pattern<String, String>, corpus: &TraceCorpus) -> f64;
fn name(&self) -> &str;
}
pub trait PatternFilter {
fn accept(&self, scored: &ScoredPattern<String, String>) -> bool;
}
pub struct ThresholdFilter {
pub threshold: f64,
pub weights: std::collections::HashMap<String, f64>,
}
impl PatternFilter for ThresholdFilter {
fn accept(&self, scored: &ScoredPattern<String, String>) -> bool {
scored.score.composite(&self.weights) >= self.threshold
}
}