# Sentiment analysis

**Sentiment analysis** in [NLP](/nlp/natural-language-processing-nlp.md) refers to the process of automatically determining and categorizing the emotional tone or attitude expressed in a user's input, enabling the bot to respond appropriately based on the detected sentiment.

On Chatlayer, sentiment analysis consists in:

* a `name`: either neutral, positive or negative.
* a `score`: ranging from 0 to 1.&#x20;

## Enable sentiment analysis

To enable sentiment analysis in your NLP:

1. Go to any page under your **NLP** tab.

<figure><img src="/files/h0ZCaiFaoJU8o5GErI4f" alt="" width="375"><figcaption><p>Access your NLP settings under your NLP tab.</p></figcaption></figure>

2. Click on the **Settings** button at the top right corner.
3. Toggle on the **Sentiment analysis**.

<figure><img src="/files/KHp4q5LgDEq4nJoxpUx2" alt=""><figcaption></figcaption></figure>

4. Click **Save**.

## Access sentiment analysis in the user session

To access the sentiment analysis in the user session:

1. Use the bot [Debugger](/buildabot/emulator.md#debug-your-bot) inside your **Emulator**.
2. Find the `sentiment` under nlp. It consists of:
   * `name`: the name of the sentiment, either positive, negative, or neutral.
   * the `score` of that sentiment.

<figure><img src="/files/tY3rj9OMIfNuYtbSOz2I" alt="" width="310"><figcaption><p>Access your user's sentiment from the Debugger.</p></figcaption></figure>

3. Clik on the **3 dots** next to the sentiment `name` or `score` to copy its path or value and use them inside a [**Condition**](/buildabot/flow-logic/dialog-state/plugins.md) block to steer the conversation.

<figure><img src="/files/tbmKLqz0U6x0Z0Lwhbvs" alt="" width="375"><figcaption><p>Copy the sentiment path or value to steer the conversation.</p></figcaption></figure>

{% hint style="info" %}
You can check the sentiment of an utterance also under the [**Test**](/navigation/natural-language-processing-nlp/intents.md#test-your-nlp) button in your NLP tab.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chatlayer.ai/nlp/natural-language-processing-nlp/sentiment-analysis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
