pub struct IntentClassifier;Expand description
Rule-based intent classifier.
All methods take &self and are safe to call from multiple threads once
the classifier has been constructed.
Implementations§
Source§impl IntentClassifier
impl IntentClassifier
Sourcepub fn extract_features(&self, text: &str) -> IntentFeatures
pub fn extract_features(&self, text: &str) -> IntentFeatures
Extract surface-level features from text.
Sourcepub fn classify(&self, text: &str) -> IntentCategory
pub fn classify(&self, text: &str) -> IntentCategory
Classify the intent of text into a single IntentCategory.
Uses the highest-confidence category from classify_with_confidence.
Sourcepub fn classify_with_confidence(&self, text: &str) -> Vec<(IntentCategory, f64)>
pub fn classify_with_confidence(&self, text: &str) -> Vec<(IntentCategory, f64)>
Return a score for every IntentCategory, sorted highest-first.
Scores are not probabilities; they are rule weights in [0.0, 1.0].
Sourcepub fn batch_classify(&self, texts: &[&str]) -> Vec<IntentCategory>
pub fn batch_classify(&self, texts: &[&str]) -> Vec<IntentCategory>
Classify a slice of texts, returning one IntentCategory per item.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IntentClassifier
impl RefUnwindSafe for IntentClassifier
impl Send for IntentClassifier
impl Sync for IntentClassifier
impl Unpin for IntentClassifier
impl UnsafeUnpin for IntentClassifier
impl UnwindSafe for IntentClassifier
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request