Ragex.Embeddings.TextGenerator (Ragex v0.38.0)

View Source

Generates embeddable text descriptions from code entities.

Converts modules, functions, and other code entities into natural language descriptions suitable for embedding generation and semantic search.

Functions enriched with MetaAST metadata (from Ragex.Analyzers.Metastatic) include a complexity summary in their text, derived from the per-function metrics that analyzer actually produces:

  • :cyclomatic / :cognitive -- complexity scores
  • :max_nesting -- deepest nesting level
  • :function_metrics.statement_count -- number of statements
  • :loc.logical -- logical lines of code

Summary

Functions

Generates text for a call relationship.

Generates text description for a function.

Generates text description for a function with its body/implementation.

Generates text for an import relationship.

Generates text description for a module.

Functions

call_text(call_data)

@spec call_text(map()) :: String.t()

Generates text for a call relationship.

Describes which function calls which other function.

function_text(function_data)

@spec function_text(map()) :: String.t()

Generates text description for a function.

Includes function signature, module context, documentation, visibility, and any MetaAST semantic metadata (async, macro, guards, decorators, annotations).

function_with_code_text(function_data, code_snippet)

@spec function_with_code_text(map(), String.t() | nil) :: String.t()

Generates text description for a function with its body/implementation.

Includes signature and code snippet for more detailed semantic search.

import_text(import_data)

@spec import_text(map()) :: String.t()

Generates text for an import relationship.

Describes which module imports which other module.

module_text(module_data)

@spec module_text(map()) :: String.t()

Generates text description for a module.

Includes module name, documentation, and metadata.