pub struct WeaverKnowledgeBase { /* private fields */ }Expand description
Cross-domain knowledge base that accumulates successful strategies.
Implementations§
Source§impl WeaverKnowledgeBase
impl WeaverKnowledgeBase
Sourcepub fn record_strategy(&self, pattern: StrategyPattern)
pub fn record_strategy(&self, pattern: StrategyPattern)
Record a successful strategy.
Sourcepub fn list_strategies(&self) -> Vec<StrategyPattern>
pub fn list_strategies(&self) -> Vec<StrategyPattern>
List all learned strategies.
Sourcepub fn strategies_for(&self, domain: &str) -> Vec<StrategyPattern>
pub fn strategies_for(&self, domain: &str) -> Vec<StrategyPattern>
Find strategies relevant to a given domain (simple substring match).
Source§impl WeaverKnowledgeBase
impl WeaverKnowledgeBase
Sourcepub fn to_serializable(&self) -> SerializableKB
pub fn to_serializable(&self) -> SerializableKB
Convert to a serializable representation.
Sourcepub fn from_serializable(kb: SerializableKB) -> Self
pub fn from_serializable(kb: SerializableKB) -> Self
Reconstruct from a serializable representation.
Sourcepub fn save_to_file(&self, path: &Path) -> Result<(), WeaverError>
pub fn save_to_file(&self, path: &Path) -> Result<(), WeaverError>
Save the knowledge base to a JSON file.
Sourcepub fn load_from_file(path: &Path) -> Result<Self, WeaverError>
pub fn load_from_file(path: &Path) -> Result<Self, WeaverError>
Load the knowledge base from a JSON file.
Sourcepub fn learn_pattern(&self, pattern: StrategyPattern)
pub fn learn_pattern(&self, pattern: StrategyPattern)
Add a strategy pattern learned from a modeling session.
If a similar pattern exists (same decision_type and context), updates the existing pattern’s improvement based on new evidence. Otherwise, adds it as a new pattern.
Sourcepub fn find_patterns(
&self,
domain_characteristics: &[String],
) -> Vec<StrategyPattern>
pub fn find_patterns( &self, domain_characteristics: &[String], ) -> Vec<StrategyPattern>
Find applicable patterns for a domain given its characteristics.
Scores each pattern by how many of the provided characteristics appear in the pattern’s context. Returns patterns sorted by relevance (highest match score first).
Sourcepub fn pattern_count(&self) -> usize
pub fn pattern_count(&self) -> usize
Number of stored patterns.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WeaverKnowledgeBase
impl RefUnwindSafe for WeaverKnowledgeBase
impl Send for WeaverKnowledgeBase
impl Sync for WeaverKnowledgeBase
impl Unpin for WeaverKnowledgeBase
impl UnsafeUnpin for WeaverKnowledgeBase
impl UnwindSafe for WeaverKnowledgeBase
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
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>
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>
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