pub struct HeuristicSystem { /* private fields */ }Expand description
Main entry point for the heuristic scoring system
Implementations§
Source§impl HeuristicSystem
impl HeuristicSystem
Sourcepub fn new() -> Result<HeuristicSystem, ScribeError>
pub fn new() -> Result<HeuristicSystem, ScribeError>
Create a new heuristic system with default configuration
Sourcepub fn with_weights(
weights: HeuristicWeights,
) -> Result<HeuristicSystem, ScribeError>
pub fn with_weights( weights: HeuristicWeights, ) -> Result<HeuristicSystem, ScribeError>
Create with custom weights
Sourcepub fn with_v2_features() -> Result<HeuristicSystem, ScribeError>
pub fn with_v2_features() -> Result<HeuristicSystem, ScribeError>
Create with V2 features enabled
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 scanned 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 get_top_files<T>(
&mut self,
files: &[T],
top_k: usize,
) -> Result<Vec<(usize, ScoreComponents)>, ScribeError>where
T: ScanResult,
pub fn get_top_files<T>(
&mut self,
files: &[T],
top_k: usize,
) -> Result<Vec<(usize, ScoreComponents)>, ScribeError>where
T: ScanResult,
Get top-K files by heuristic score
Sourcepub fn get_template_boost(&self, file_path: &str) -> Result<f64, ScribeError>
pub fn get_template_boost(&self, file_path: &str) -> Result<f64, ScribeError>
Get template score boost for a file path
Sourcepub fn import_matches(&self, import_name: &str, file_path: &str) -> bool
pub fn import_matches(&self, import_name: &str, file_path: &str) -> bool
Check if two imports match (for import graph construction)
Trait Implementations§
Source§impl Debug for HeuristicSystem
impl Debug for HeuristicSystem
Source§impl Default for HeuristicSystem
impl Default for HeuristicSystem
Source§fn default() -> HeuristicSystem
fn default() -> HeuristicSystem
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HeuristicSystem
impl RefUnwindSafe for HeuristicSystem
impl Send for HeuristicSystem
impl Sync for HeuristicSystem
impl Unpin for HeuristicSystem
impl UnwindSafe for HeuristicSystem
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