# analyze_text

> **Function** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/callbacks/mlflow_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`) |
| `textstat` | `Any` | No | The textstat library to use for complexity metrics calculation. (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/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/callbacks/mlflow_callback.py#L77)