Sentiment detection is a subfield of text mining and refers to the automatic evaluation of texts with the aim of recognizing an expressed attitude as positive or negative. Humans converse in natural languages, i.e. languages that, unlike formal languages, do not transmit meaning and information unambiguously and not only structurally, and whose automatic processing by computers is thus made more difficult.
Computational linguistics investigates how computers can still be used to analyze natural language. For a long time, it was hoped that artificial intelligence would try to create intelligent systems, but since even modern computers are still a long way from achieving this goal, the goals of language processing have been narrowed down to simpler but more promising methods. Such a goal is to work out specific knowledge from texts, e.g. the topic or – as in this case – the author’s attitude towards this topic. The field that deals with solving such tasks is called text mining, in reference to data mining, with which it shares the basic ideas. The methods used by sentiment detection come from fields such as statistics, machine learning and natural language processing.
The task of sentiment detection is approached by statistical methods. In addition, one can include the grammar of the utterances studied. Statistical analysis is based on a basic set of terms (or N-grams) with which positive or negative tendencies are associated. The frequencies of positive and negative terms in the analyzed text are compared and determine the presumed attitude.
---
The text is broken down and N successive fragments are grouped together as N-grams. The fragments can be letters, phonemes, words, and so on. N-grams are used in cryptology and corpus linguistics, especially in computational linguistics, quantitative linguistics and computer forensics. Individual words, complete sentences or complete texts are broken down into N-grams for analysis or statistical evaluation and summarized in data sets.

Image credit: https://github.com/declare-lab/awesome-sentiment-analysis
Based on this, machine learning algorithms can be applied. On the basis of pre-processed texts, for which the attitudes are known, such algorithms can also learn which tendency they belong to for other terms.
With the help of natural language processing techniques, knowledge of natural language can be incorporated into the decision. For example, if the grammar of the texts is analyzed, machine-learned patterns can be applied to the structure. Sentiment analysis related domains and topics can be listed as:
- Aspect-based Sentiment Analysis
- Multimodal Sentiment Analysis
- Contextual Sentiment Analysis
- Sentiment Reasoning
- Sarcasm Analysis
- Domain Adaptation
- Multilingual Sentiment Analysis
- Sentiment-aware NLG
- Bias in Sentiment Analysis Systems
- Robust Sentiment Analysis