Skip to main content

Crate megahal_gen

Crate megahal_gen 

Source
Expand description

MegaHAL reply generation: babble, seeding, bidirectional generation, and surprise evaluation.

This crate implements the core MegaHAL reply generation algorithm:

  1. Seed a starting symbol from the keyword list.
  2. Run a forward phase from the seed to generate the rest of the sentence.
  3. Run a backward phase from the seed to generate the beginning.
  4. Evaluate candidates by surprise scoring.
  5. Select the highest-scoring candidate.

It implements MegaHAL’s keyword-biased random walk: keywords encountered during the walk are greedily selected, while non-keywords fall back to probability-weighted selection.

Enums§

GenerationLimit
Controls how many candidate replies are generated before selecting the best.

Functions§

capitalize
Capitalize a token sequence per MegaHAL sentence-case rules.
generate_reply
Generate the best reply for given input tokens and keywords.