pub struct RuleBasedClassifier { /* private fields */ }Expand description
Rule-based classifier Phase 1: Simple pattern matching on commit messages Phase 2: Will evolve to ML-based with user feedback
Implementations§
Source§impl RuleBasedClassifier
impl RuleBasedClassifier
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new rule-based classifier with predefined patterns
§Examples
use organizational_intelligence_plugin::classifier::RuleBasedClassifier;
let classifier = RuleBasedClassifier::new();Sourcepub fn classify_from_message(&self, message: &str) -> Option<Classification>
pub fn classify_from_message(&self, message: &str) -> Option<Classification>
Classify a defect based on commit message
§Arguments
message- Commit message text
§Returns
Some(Classification)if patterns matchNoneif no patterns match (not a defect fix)
§Examples
use organizational_intelligence_plugin::classifier::RuleBasedClassifier;
let classifier = RuleBasedClassifier::new();
let result = classifier.classify_from_message("fix: null pointer dereference");
assert!(result.is_some());Sourcepub fn classify_multi_label(
&self,
message: &str,
top_n: usize,
min_confidence: f32,
) -> Option<MultiLabelClassification>
pub fn classify_multi_label( &self, message: &str, top_n: usize, min_confidence: f32, ) -> Option<MultiLabelClassification>
Classify a defect with multi-label support (top-N categories)
Returns top-N categories that match patterns above the confidence threshold. Implements Section 5.3 Multi-Label Classification from nlp-models-techniques-spec.md
§Arguments
message- Commit message texttop_n- Maximum number of categories to return (default 3)min_confidence- Minimum confidence threshold (default 0.60)
§Returns
Some(MultiLabelClassification)if patterns matchNoneif no patterns match
§Examples
use organizational_intelligence_plugin::classifier::RuleBasedClassifier;
let classifier = RuleBasedClassifier::new();
let result = classifier.classify_multi_label(
"fix: null pointer in ast transform",
3,
0.60
);
assert!(result.is_some());
let classification = result.unwrap();
assert!(classification.categories.len() >= 1);
assert!(classification.categories.len() <= 3);Trait Implementations§
Auto Trait Implementations§
impl Freeze for RuleBasedClassifier
impl RefUnwindSafe for RuleBasedClassifier
impl Send for RuleBasedClassifier
impl Sync for RuleBasedClassifier
impl Unpin for RuleBasedClassifier
impl UnwindSafe for RuleBasedClassifier
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.