analyze_text#

langchain_community.callbacks.wandb_callback.analyze_text(text: str, complexity_metrics: bool = True, visualize: bool = True, nlp: Any = None, output_dir: str | Path | None = None) dict[source]#

Analyze text using textstat and spacy.

Parameters:
  • text (str) – The text to analyze.

  • complexity_metrics (bool) – Whether to compute complexity metrics.

  • visualize (bool) – Whether to visualize the text.

  • nlp (spacy.lang) – The spacy language model to use for visualization.

  • output_dir (str) – The directory to save the visualization files to.

Returns:

A dictionary containing the complexity metrics and visualization

files serialized in a wandb.Html element.

Return type:

(dict)