pub struct InferenceEngine { /* private fields */ }Expand description
Engine for inferring implicit relationships between entities
The inference engine analyzes entity co-occurrence patterns, proximity, and contextual clues to discover relationships that may not be explicitly stated in the text.
Implementations§
Source§impl InferenceEngine
impl InferenceEngine
Sourcepub fn new(config: InferenceConfig) -> Self
pub fn new(config: InferenceConfig) -> Self
Create a new inference engine with the given configuration
§Arguments
config- Configuration controlling inference thresholds and limits
Sourcepub fn infer_relationships(
&self,
target_entity: &EntityId,
relation_type: &str,
knowledge_graph: &KnowledgeGraph,
) -> Vec<InferredRelation>
pub fn infer_relationships( &self, target_entity: &EntityId, relation_type: &str, knowledge_graph: &KnowledgeGraph, ) -> Vec<InferredRelation>
Infer relationships for a target entity
Analyzes the knowledge graph to find entities that frequently co-occur with the target entity and have contextual evidence of a relationship.
§Arguments
target_entity- The entity to find relationships forrelation_type- The type of relationship to infer (e.g., “FRIENDS”)knowledge_graph- The knowledge graph containing entities and chunks
§Returns
Returns a vector of inferred relationships, sorted by confidence score,
limited to max_candidates from the configuration.
Sourcepub fn find_entity_by_name<'a>(
&self,
knowledge_graph: &'a KnowledgeGraph,
name: &str,
) -> Option<&'a Entity>
pub fn find_entity_by_name<'a>( &self, knowledge_graph: &'a KnowledgeGraph, name: &str, ) -> Option<&'a Entity>
Find an entity in the knowledge graph by name
Performs a case-insensitive substring search to find an entity whose name contains the given search string.
§Arguments
knowledge_graph- The knowledge graph to searchname- The name (or partial name) to search for
§Returns
Returns Some(&Entity) if a matching entity is found, None otherwise.
Auto Trait Implementations§
impl Freeze for InferenceEngine
impl RefUnwindSafe for InferenceEngine
impl Send for InferenceEngine
impl Sync for InferenceEngine
impl Unpin for InferenceEngine
impl UnsafeUnpin for InferenceEngine
impl UnwindSafe for InferenceEngine
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