class

Xerp::Vectors::Trainer

Inherits Reference < Object

Coordinates token vector training for semantic expansion. v0.2 uses co-occurrence based vectors with two models:

  • cooc.line.v1: linear sliding-window co-occurrence (textual proximity)
  • cooc.scope.v1: level-based isolation (structural siblings)

Constructors

new(config : Config)
Source

Instance methods

all_metadata

Returns metadata for all trained models.

Source
clear(model : String | Nil = nil) : Nil

Clears vector training data. If model is nil, clears all models. Otherwise clears the specified model.

Source
metadata(model : String) : Hash(String, String) | Nil

Returns training metadata for a specific model, or nil if not trained.

Source
train(model : String | Nil = nil, window_size : Int32 = Cooccurrence::DEFAULT_WINDOW_SIZE, min_count : Int32 = Cooccurrence::DEFAULT_MIN_COUNT, top_neighbors : Int32 = Cooccurrence::DEFAULT_TOP_NEIGHBORS) : MultiModelTrainStats

Trains token vectors using co-occurrence method. If model is nil, trains both models. Otherwise trains the specified model.

Source
trained?(model : String | Nil = nil) : Bool

Returns whether vectors have been trained. If model is nil, checks if any model is trained. Otherwise checks if the specified model is trained.

Source