# Sentiment analysis

**Sentiment analysis** in [NLP](https://docs.chatlayer.ai/nlp/natural-language-processing-nlp) 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="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F6w56gc5xoB2eyJYWKM7N%2FScreenshot%202024-08-28%20at%2010.41.09.png?alt=media&#x26;token=b61ce513-3aa8-4ee2-a9df-7e997f6c27a1" 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="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FNRk7PejOgEmcBr9rk4d6%2FScreenshot%202024-08-28%20at%2010.42.10.png?alt=media&#x26;token=07070dbf-ed20-4863-a211-6aea1c0f7f28" 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](https://docs.chatlayer.ai/buildabot/emulator#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="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F4nnFTkdeTNRzlvt5bwMK%2FScreenshot%202024-08-28%20at%2010.46.51.png?alt=media&#x26;token=5873e1c8-cb6c-4ed6-b42f-6719b6b1ba96" 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**](https://docs.chatlayer.ai/buildabot/flow-logic/dialog-state/plugins) block to steer the conversation.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F4i3pg02QMz9D1OXoInvh%2FScreenshot%202024-08-28%20at%2010.57.05.png?alt=media&#x26;token=64d176db-ad4c-4963-aba8-39eb3a5fbdac" 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**](https://docs.chatlayer.ai/navigation/natural-language-processing-nlp/intents#test-your-nlp) button in your NLP tab.
{% endhint %}
