Sentiment
Introduction
The goal of sentiment analysis is to automatically classify text data as positive, negative, or neutral based on the underlying sentiment expressed in the text.
To achieve this Lettria analyzes various linguistic features of the text, such as word choice, syntax, and sentiment-laden words or phrases.
These features are then fed into an algorithm, such as a machine learning model, which is trained to recognize patterns and trends in the data that are indicative of sentiment.
One approach to text sentiment analysis combines the strengths of rule-based algorithms that you can set up as part of your solution on the Lettria platform, with machine learning algorithms that are pre-trained, as well as a solution that is built on the platform with your own data and annotations.
This helps improve the accuracy and efficiency of the sentiment analysis process, as well as reduce the need for manual labeling or annotation of data.
Sentiment Format
Key | Type | Description |
---|---|---|
subsentences | Subsentence Sentiment [ ] | Subsentences Sentiment |
elements | Sentiment Element [ ] | Sentiment Elements |
values | Values | Values |
Subsentence Sentiment
Subsentence Sentiment Format
Key | Type | Description |
---|---|---|
start_id | Number | Start ID |
end_id | Number | End ID |
elements | Element [ ] | Elements |
sentence | String | Sentence |
values | Values | Values |
Subsentence Sentiment Example
{ "start_id": 0, "end_id": 2, "elements": [ { "target": null, "subject": { "lemma": "Victor", "source": "Victor", "index": 0 }, "value": 0.27, "source": { "index": 1, "lemma": "etre", "source": "est" } } ], "sentence": "Victor est la", "values" : { "positive": 0.454, "negative": 0, "total": 0.454 } }
Sentiment Element
Sentiment Element Format
Key | Type | Description |
---|---|---|
target | Target | Target |
subject | Subject | Subject |
value | Number | Value |
source | Source | Source |
Sentiment Element Example
{ "target": null, "subject": { "lemma": "Victor", "source": "Victor", "index": 0 }, "value": 0.27, "source": { "index": 1, "lemma": "etre", "source": "est" } }
Values
Values Format
Key | Type | Description |
---|---|---|
positive | Number | Positive |
negative | Number | Negative |
total | Number | Total |
Values Example
{ "positive": 0.27, "negative": 0, "total": 0.27 }
Target
Target Format
Key | Type | Description |
---|---|---|
index | Number | Index |
lemma | String | Lemma |
source | String | Source |
Target Example
{ "lemma": "immeuble", "source": "immeubles", "index": 6 }
Subject
Subject Format
Key | Type | Description |
---|---|---|
index | Number | Index |
lemma | String | Lemma |
source | String | Source |
Subject Example
{ "lemma": "Victor", "source": "Victor", "index": 0 }
Next steps
xxxxxxxxxx
---
title: "Sentiment in Sentence: Comprehension – Lettria API"
description: Sentiment analysis automatically classifies text data as positive, negative, or neutral, based on the underlying sentiment expressed in the text.
---
# Sentiment
## Introduction
The goal of sentiment analysis is to automatically classify text data as positive, negative, or neutral based on the underlying sentiment expressed in the text.
To achieve this Lettria analyzes various linguistic features of the text, such as word choice, syntax, and sentiment-laden words or phrases.
These features are then fed into an algorithm, such as a machine learning model, which is trained to recognize patterns and trends in the data that are indicative of sentiment.
One approach to text sentiment analysis combines the strengths of rule-based algorithms that you can set up as part of your solution on the Lettria platform, with machine learning algorithms that are pre-trained, as well as a solution that is built on the platform with your own data and annotations.
This helps improve the accuracy and efficiency of the sentiment analysis process, as well as reduce the need for manual labeling or annotation of data.
## Sentiment Format
{% table %}
- Key
- Type
- Description {% width="40%" %}
---
- `subsentences`
- [Subsentence Sentiment](/api-reference/comprehension/2.0/schemas/sentence/sentiment#subsentence-sentiment) [ ]
- Subsentences Sentiment
---
- `elements`
- [Sentiment Element](/api-reference/comprehension/2.0/schemas/sentence/sentiment#sentiment-element) [ ]
- Sentiment Elements
---
- `values`
- [Values](/api-reference/comprehension/2.0/schemas/sentence/sentiment#values)
- Values
---
{% /table %}
## Subsentence Sentiment
### Subsentence Sentiment Format
{% table %}
- Key
- Type
- Description {% width="40%" %}
---
- `start_id`
- `Number`
- Start ID
---
- `end_id`
- `Number`
- End ID
---
- `elements`
- [Element](/api-reference/comprehension/2.0/schemas/sentence/sentiment#element) [ ]
- Elements
---
- `sentence`
- `String`
- Sentence
---
- `values`
- [`Values`](/api-reference/comprehension/2.0/schemas/sentence/sentiment#values)
- Values
---
{% /table %}
### Subsentence Sentiment Example
```json
{
"start_id": 0,
"end_id": 2,
"elements": [
{
"target": null,
"subject": {
"lemma": "Victor",
"source": "Victor",
"index": 0
},
"value": 0.27,
"source": { "index": 1, "lemma": "etre", "source": "est" }
}
],
"sentence": "Victor est la",
"values" : { "positive": 0.454, "negative": 0, "total": 0.454 }
}
```
## Sentiment Element
### Sentiment Element Format
{% table %}
- Key
- Type
- Description {% width="40%" %}
---
- `target`
- [Target](/api-reference/comprehension/2.0/schemas/sentence/sentiment#target)
- Target
---
- `subject`
- [Subject](/api-reference/comprehension/2.0/schemas/sentence/sentiment#subject)
- Subject
---
- `value`
- `Number`
- Value
---
- `source`
- [Source](/api-reference/comprehension/2.0/schemas/sentence/sentiment#source)
- Source
---
{% /table %}
### Sentiment Element Example
```json
{
"target": null,
"subject": { "lemma": "Victor", "source": "Victor", "index": 0 },
"value": 0.27,
"source": { "index": 1, "lemma": "etre", "source": "est" }
}
```
## Values
### Values Format
{% table %}
- Key
- Type
- Description {% width="40%" %}
---
- `positive`
- `Number`
- Positive
---
- `negative`
- `Number`
- Negative
---
- `total`
- `Number`
- Total
---
{% /table %}
### Values Example
```json
{ "positive": 0.27, "negative": 0, "total": 0.27 }
```
## Target
### Target Format
{% table %}
- Key
- Type
- Description {% width="40%" %}
---
- `index`
- `Number`
- Index
---
- `lemma`
- `String`
- Lemma
---
- `source`
- `String`
- Source
---
{% /table %}
### Target Example
```json
{ "lemma": "immeuble", "source": "immeubles", "index": 6 }
```
## Subject
### Subject Format
{% table %}
- Key
- Type
- Description {% width="40%" %}
---
- `index`
- `Number`
- Index
---
- `lemma`
- `String`
- Lemma
---
- `source`
- `String`
- Source
---
{% /table %}
### Subject Example
```json
{ "lemma": "Victor", "source": "Victor", "index": 0 }
```
## Next steps
- [Emotion](/api-reference/comprehension/2.0/schemas/sentence/emotion)