Skip to main content

SemanticDisk

Struct SemanticDisk 

Source
pub struct SemanticDisk { /* private fields */ }
Expand description

The taxonomy-embedded meaning space (see module docs).

Implementations§

Source§

impl SemanticDisk

Source

pub fn build(spec: &[(&str, usize)]) -> Result<Self, StoreError>

Build a semantic disk from a concept specification: (concept path, affinity dim) pairs — e.g. [("/trauma", 16), ("/cgt", 17), …]. Nested paths are allowed and embed with their real tree shape; missing ancestors are created automatically (they become unmapped, purely structural anchors).

Errors on an empty spec, duplicate concept paths, or duplicate dims.

Source

pub fn concepts(&self) -> Vec<&str>

The mapped concept paths, in canonical (sorted) order.

Source

pub fn position_of( &self, store: &Store, key: &str, ) -> Result<Option<Vec<f64>>, StoreError>

A node’s derived position in the concept disk, as f64 Poincaré coordinates. Ok(None) when the node has no positive affinity on any mapped dim (no concept position — same convention as empty semantic coords).

Source

pub fn concept_of( &self, store: &Store, key: &str, ) -> Result<Option<String>, StoreError>

Which concept a node belongs to right now: the anchor whose power cell contains the node’s derived position. Constant in data-node count (linear only in the anchor count — dozens). Ok(None) when the node has no concept position.

Compared against the node’s storage path, this is the miscategorization primitive: filed under /overig, classifies to /trauma.

Source

pub fn nearest( &self, store: &Store, key: &str, k: usize, ) -> Result<Vec<(String, f64)>, StoreError>

The k data nodes nearest to key in the concept disk (hyperbolic distance between derived positions), excluding key itself. Sorted ascending by (distance, key).

Source

pub fn nearest_to_weights( &self, store: &Store, weights: &[f64], k: usize, ) -> Result<Vec<(String, f64)>, StoreError>

The k data nodes nearest to an explicit affinity-weight vector (one weight per mapped concept, in Self::concepts order).

Source

pub fn classify_trajectory( &self, sample_dim_start: usize, samples: &[(u64, Vec<f64>)], ) -> Vec<(u64, String)>

Push a temporal trajectory readout through the anchor cells: for each (epoch, coords) sample — the shape HttHistory::trajectory returns — classify the derived position, yielding the node’s symbolic trajectory ((epoch, concept) pairs). Samples whose weights are all non-positive are omitted (no position at that epoch).

sample_dim_start is the first dimension index the samples cover (the dim_range.start the trajectory was read with); mapped dims outside the sampled range weigh zero.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.