GenerateMeta Wyam.TextGeneration

Procedurally generates metadata using flexible Rant text templates.

Package

This module exists in the Wyam.TextGeneration package which is not part of the core distribution. Add the following preprocessor directive to your configuration file to use it:
#n Wyam.TextGeneration
Alternatively, you can add all modules at once with the following preprocessor directive:
#n Wyam.All

Usage

  • GenerateMeta(string key, ContextConfig template)

    Uses a function to determine a text template which is processed and added as metadata for each document. This allows you to specify different metadata for each document depending on the context.

    • key

      The metadata key for the generated text.

    • template

      A delegate that returns the template to use.

  • GenerateMeta(string key, DocumentConfig template)

    Uses a function to determine a text template which is processed and added as metadata for each document. This allows you to specify different metadata for each document depending on the input.

    • key

      The metadata key for the generated text.

    • template

      A delegate that returns the template to use.

  • GenerateMeta(string key, params IModule[] modules)

    The specified modules are executed against an empty initial document and the resulting content from evaluating the entire child module chain is processed as a text template and added as metadata to each input document.

    • key

      The metadata key for the generated text.

    • modules

      The modules to execute.

  • GenerateMeta(string key, object template)

    The specified text template is processed and added as metadata for the specified key for every input document.

    • key

      The metadata key for the generated text.

    • template

      The template to use.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • IncludeNsfw(bool includeNsfw = true)

    Controls whether the dictionary will include NSFW content.

    • includeNsfw

      If set to true the dictionary will include NSFW content.

  • IncrementSeed(bool increment = true)

    Specifies whether to increment the seed for each document. If incrementing is not used, every document will get the same content for the same template.

    • increment

      If set to true the seed will be incremented for each document.

  • WithSeed(long seed)

    This allows you to set the seed used for text generation which can be handy for ensuring repeatable generations.

    • seed

      The seed to use.

GitHub