langchain_community.callbacks.wandb_callback.analyze_textΒΆ

langchain_community.callbacks.wandb_callback.analyze_text(text: str, complexity_metrics: bool = True, visualize: bool = True, nlp: Optional[Any] = None, output_dir: Optional[Union[str, Path]] = 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)