pub struct SemanticDisk { /* private fields */ }Expand description
The taxonomy-embedded meaning space (see module docs).
Implementations§
Source§impl SemanticDisk
impl SemanticDisk
Sourcepub fn build(spec: &[(&str, usize)]) -> Result<SemanticDisk, StoreError>
pub fn build(spec: &[(&str, usize)]) -> Result<SemanticDisk, 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.
Sourcepub fn position_of(
&self,
store: &Store,
key: &str,
) -> Result<Option<Vec<f64>>, StoreError>
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).
Sourcepub fn concept_of(
&self,
store: &Store,
key: &str,
) -> Result<Option<String>, StoreError>
pub fn concept_of( &self, store: &Store, key: &str, ) -> Result<Option<String>, StoreError>
Which concept a node belongs to right now: the anchor whose
hyperbolic Voronoi 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.
Sourcepub fn nearest(
&self,
store: &Store,
key: &str,
k: usize,
) -> Result<Vec<(String, f64)>, StoreError>
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).
Sourcepub fn nearest_to_weights(
&self,
store: &Store,
weights: &[f64],
k: usize,
) -> Result<Vec<(String, f64)>, StoreError>
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).
Sourcepub fn classify_trajectory(
&self,
sample_dim_start: usize,
samples: &[(u64, Vec<f64>)],
) -> Vec<(u64, String)>
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.