Skip to main content

InfonIndex

Struct InfonIndex 

Source
pub struct InfonIndex<B: Postings> { /* private fields */ }

Implementations§

Source§

impl<B: Postings> InfonIndex<B>

Source

pub fn from_postings(raw: HashMap<String, Vec<u32>>, n: u32) -> Self

Build from token -> ascending sids. Callers accumulate sids in id order during a scan.

Source

pub fn add_infon_polar(&mut self, sid: u32, token: &str, level: f32)

Record a token membership at sid with a Dempster-Shafer polarity level ∈ {-1, -0.5, +0.5, +1} (paper §4). +1 strong-for, +0.5 weak-for, -0.5 weak-against, -1 strong-against. Presence is always asserted; sign/magnitude are stored in the neg/weak auxiliary sets.

Source

pub fn signed_mass(&self, token: &str, scope: &B) -> f64

SIMD belief aggregation (paper §4.1): net signed mass of token over scope, computed as a weighted POPCNT over roaring sets — +1·|strong-for| +0.5·|weak-for| −0.5·|weak-against| −1·|strong-against|, all within scope ∩ post(token).

Source

pub fn evidence_set(&self, token: &str, min_bel: f64) -> B

Situations where token holds with per-situation belief ≥ min_bel, using the discrete level map (+1→1.0 strong-for, +0.5→0.5 weak-for, present→>0). Powers IKL (evidence … :min-bel b).

Source

pub fn belief_interval(&self, token: &str, scope: &B) -> (f64, f64)

Dempster-Shafer belief interval [Bel, Pl] for token over scope (paper §4.1): Bel = fraction of scope with strong-for evidence (lower certainty bound); Pl = fraction not strongly refuted (upper bound 1 − Bel(¬A)). Returns (bel, pl) in [0,1].

Source

pub fn add_number(&mut self, sid: u32, field: &str, value: f64)

Record a numeric field value for a situation (columnar numeric layer).

Source

pub fn numeric_fields(&self) -> impl Iterator<Item = &String>

Numeric fields present (for schema/agent discovery).

Source

pub fn add(&mut self, tokens: &[String]) -> u32

Append one situation’s tokens as a new sid (incremental / realtime ingest). Tokens should be de-duplicated by the caller. Returns the new sid.

Source

pub fn vocab_size(&self) -> usize

Source

pub fn tokens(&self) -> impl Iterator<Item = &String>

Source

pub fn post(&self, token: &str) -> B

The posting set for an exact token (clone; empty if absent). Unlike atom, no glob handling — the analytics programs address concrete tokens they discovered from the vocabulary.

Source

pub fn post_len(&self, token: &str) -> usize

Source

pub fn facet_members(&self, facet: &str) -> Vec<&String>

Every token under a facet (first path segment), unsorted and untruncated — the analytics programs partition/rank over the full facet, not just the top-N tokens_in_facet returns.

Source

pub fn tokens_in_facet(&self, facet: &str, limit: usize) -> Vec<(String, usize)>

The most frequent tokens under a facet, with posting sizes — so an agent can learn the queryable vocabulary of a facet before composing IKL.

Source

pub fn postings(&self) -> impl Iterator<Item = (&String, &B)>

Every (tag, postings) pair in the symbol table — the incidence matrix, row by row.

Source

pub fn situations(&self) -> u32

Source

pub fn postings_native_bytes(&self) -> usize

Total native bytes across all postings (memory proxy for the chosen backend).

Source

pub fn postings_deltagap_bytes(&self) -> usize

Total portable delta-gap bytes (same for every backend — the on-disk posting size).

Source§

impl<B: Postings> InfonIndex<B>

Source

pub fn s_path_tokens(&self, a: &str, b: &str, s: usize) -> Option<Vec<String>>

Tokens on an s-path from a to b: a chain where consecutive tokens share at least s situations (paper §3.3). Returns None when either endpoint is unknown or no such chain exists.

Raising s is what suppresses semantic drift — at s = 1 a single shared situation links two tokens, which lets a walk wander somewhere unrelated to where it began.

Breadth-first, so the chain found is the shortest. Neighbour discovery scans the symbol table, which is linear per expansion; the paper’s answer to that cost is to filter the scope first, and the (constraint …) clause in the query form is how a caller does it.

Trait Implementations§

Source§

impl<B: Postings> TokenStore<B> for InfonIndex<B>

Source§

fn evidence(&self, token: &str, min_bel: f64) -> B

The evidence atom of §6.1, backed by the polarity layer: situations where this token holds with per-situation belief at or above the threshold. The trait default is plain membership, which would ignore polarity entirely and quietly include refuted situations.

Source§

fn s_path(&self, a: &str, b: &str, s: usize) -> Option<B>

The situations an s-path passes through: the union of the postings of the tokens on the chain, so the result composes with the rest of the set algebra.

Source§

fn atom(&self, pattern: &str) -> B

Source§

fn universe(&self) -> B

Source§

fn numeric(&self, field: &str, op: &str, value: f64) -> B

Situations whose numeric field satisfies field op value (op ∈ ge|gt|le|lt|eq|ne). Stores without a numeric layer return empty.

Auto Trait Implementations§

§

impl<B> Freeze for InfonIndex<B>
where HashMap<String, B>: Freeze, B: Freeze,

§

impl<B> RefUnwindSafe for InfonIndex<B>

§

impl<B> Send for InfonIndex<B>
where HashMap<String, B>: Send, B: Send,

§

impl<B> Sync for InfonIndex<B>
where HashMap<String, B>: Sync, B: Sync,

§

impl<B> Unpin for InfonIndex<B>
where HashMap<String, B>: Unpin, B: Unpin,

§

impl<B> UnsafeUnpin for InfonIndex<B>

§

impl<B> UnwindSafe for InfonIndex<B>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more