pub struct ExplicitMemory {
pub facts: HashMap<String, Fact>,
pub concepts: HashMap<String, Concept>,
pub events: Vec<Event>,
pub relationships: HashMap<String, Vec<String>>,
}Fields§
§facts: HashMap<String, Fact>§concepts: HashMap<String, Concept>§events: Vec<Event>§relationships: HashMap<String, Vec<String>>Implementations§
Source§impl ExplicitMemory
impl ExplicitMemory
pub fn new() -> Self
Sourcepub fn store_fact(&mut self, statement: &str, source: &str, confidence: f32)
pub fn store_fact(&mut self, statement: &str, source: &str, confidence: f32)
Store a declarative fact
Sourcepub fn define_concept(&mut self, name: &str, definition: &str, abstraction: f32)
pub fn define_concept(&mut self, name: &str, definition: &str, abstraction: f32)
Define a concept
Sourcepub fn add_example(&mut self, concept: &str, example: &str)
pub fn add_example(&mut self, concept: &str, example: &str)
Add example to concept
Sourcepub fn record_event(
&mut self,
description: &str,
location: &str,
emotional_sig: f32,
)
pub fn record_event( &mut self, description: &str, location: &str, emotional_sig: f32, )
Record an event
Sourcepub fn relate_concepts(&mut self, concept1: &str, concept2: &str)
pub fn relate_concepts(&mut self, concept1: &str, concept2: &str)
Link concepts
Sourcepub fn recall_fact(&mut self, statement: &str) -> Option<(String, f32)>
pub fn recall_fact(&mut self, statement: &str) -> Option<(String, f32)>
Retrieve fact with confidence
Sourcepub fn get_concept(&self, name: &str) -> Option<&Concept>
pub fn get_concept(&self, name: &str) -> Option<&Concept>
Get concept definition
Sourcepub fn high_confidence_facts(&self, min_confidence: f32) -> Vec<&Fact>
pub fn high_confidence_facts(&self, min_confidence: f32) -> Vec<&Fact>
Get all facts sorted by confidence
Sourcepub fn recent_events(&self, count: usize) -> Vec<&Event>
pub fn recent_events(&self, count: usize) -> Vec<&Event>
Get recent events
pub fn save(&self, dir: &Path) -> Result<(), String>
pub fn load(dir: &Path) -> Result<Self, String>
pub fn load_or_init(dir: &Path) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExplicitMemory
impl RefUnwindSafe for ExplicitMemory
impl Send for ExplicitMemory
impl Sync for ExplicitMemory
impl Unpin for ExplicitMemory
impl UnsafeUnpin for ExplicitMemory
impl UnwindSafe for ExplicitMemory
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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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