pub struct HeuristicScorer { /* private fields */ }Expand description
Main heuristic scorer that coordinates all scoring components
Implementations§
Source§impl HeuristicScorer
impl HeuristicScorer
Sourcepub fn new(weights: HeuristicWeights) -> HeuristicScorer
pub fn new(weights: HeuristicWeights) -> HeuristicScorer
Create a new scorer with given weights
Sourcepub fn default() -> HeuristicScorer
pub fn default() -> HeuristicScorer
Create a scorer with default weights
Sourcepub fn set_import_graph(&mut self, graph: ImportGraph)
pub fn set_import_graph(&mut self, graph: ImportGraph)
Set the import graph for centrality calculations
Sourcepub fn score_file<T>(
&mut self,
file: &T,
all_files: &[T],
) -> Result<ScoreComponents, ScribeError>where
T: ScanResult,
pub fn score_file<T>(
&mut self,
file: &T,
all_files: &[T],
) -> Result<ScoreComponents, ScribeError>where
T: ScanResult,
Score a single file within the context of all files
Sourcepub fn score_all_files<T>(
&mut self,
files: &[T],
) -> Result<Vec<(usize, ScoreComponents)>, ScribeError>where
T: ScanResult,
pub fn score_all_files<T>(
&mut self,
files: &[T],
) -> Result<Vec<(usize, ScoreComponents)>, ScribeError>where
T: ScanResult,
Score all files and return ranked results
Sourcepub fn score_with_preset<T>(
&mut self,
files: &[T],
preset: WeightPreset,
) -> Result<Vec<(usize, ScoreComponents)>, ScribeError>where
T: ScanResult,
pub fn score_with_preset<T>(
&mut self,
files: &[T],
preset: WeightPreset,
) -> Result<Vec<(usize, ScoreComponents)>, ScribeError>where
T: ScanResult,
Score files with custom weights for specific use cases
Sourcepub fn weights(&self) -> &HeuristicWeights
pub fn weights(&self) -> &HeuristicWeights
Get current weights
Sourcepub fn set_weights(&mut self, weights: HeuristicWeights)
pub fn set_weights(&mut self, weights: HeuristicWeights)
Update weights
Trait Implementations§
Source§impl Debug for HeuristicScorer
impl Debug for HeuristicScorer
Source§impl Default for HeuristicScorer
impl Default for HeuristicScorer
Source§fn default() -> HeuristicScorer
fn default() -> HeuristicScorer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HeuristicScorer
impl RefUnwindSafe for HeuristicScorer
impl Send for HeuristicScorer
impl Sync for HeuristicScorer
impl Unpin for HeuristicScorer
impl UnwindSafe for HeuristicScorer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more