# analyze_text

> **Function** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/callbacks/flyte_callback/analyze_text)

Analyze text using textstat and spacy.

## Signature

```python
analyze_text(
    text: str,
    nlp: Any = None,
    textstat: Any = None,
) -> dict
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `text` | `str` | Yes | The text to analyze. |
| `nlp` | `spacy.lang` | No | The spacy language model to use for visualization. (default: `None`) |

## Returns

`dict`

`dict` containing the complexity metrics and visualization
files serialized to HTML string.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/d5ea8358933260ad48dd31f7f8076555c7b4885a/libs/community/langchain_community/callbacks/flyte_callback.py#L39)