Module encoder

Source
Expand description

§Object Encoder Module

This module implements an object encoder for hyperdimensional computing using vector symbolic architectures (VSAs). It takes as input a JSON object (using serde_json::Value) and produces an encoded hypervector. It maintains two codebooks:

  1. Token Codebook: Maps each unique JSON token (from keys or values) to a randomly generated hypervector.
  2. Object (Document) Codebook: Maps a stringified JSON object to its encoded hypervector.

Each key–value pair in the JSON object is encoded by binding the hypervector for the key with that for the value. The final object representation is computed by bundling all these bound hypervectors together.

This encoder is generic over any VSA type (i.e. any type implementing the VSA trait). The methods [token_codebook], [object_codebook], and [get_encoded_object] allow you to inspect or retrieve the generated codebooks.

Structs§

ObjectEncoder
An object encoder that produces hypervector encodings for JSON objects.