NLP Tasks Overview

Back to Resources

NLP Tasks Overview

Overview
Task Families: Classification, "Multi"-classification, Generation
Common Pattern: Input text → Model → Output
Explanation

Most NLP tasks can be grouped by the kind of output the model produces. In Classification, the model reads a piece of text and returns a single label. In "Multi"-classification, the model returns one label for every token (word) in the input. In Generation, the model returns new text of its own. The sections below explain each task in these three families.

1. Classification

Input text goes into the model and a single label (for example, a class number) comes out.

1.1 Sentiment Extraction

Classification
Input: A sentence or document
Output: One label (e.g., positive / negative / neutral)
Explanation

Sentiment extraction identifies the opinion or emotional tone expressed in a piece of text. The model maps the whole text to a single class such as positive, negative, or neutral. It is widely used to analyze product reviews, social media posts, and customer feedback at scale. Sarcasm and mixed opinions make this task harder than it looks.

Example
Input : "The battery life is amazing and the screen is gorgeous!"
Output: Positive
    

1.2 Intent Detection

Classification
Input: A user utterance
Output: One intent label
Explanation

Intent detection determines what a user wants to achieve from a short message or query. The model picks one intent from a predefined list, such as "book_flight" or "check_balance". It is a core component of chatbots and voice assistants, because the detected intent decides which action the system takes next. It is often paired with entity extraction to fill in details like dates and places.

Example
Input : "Book me a flight to Dubai for tomorrow morning"
Output: book_flight
    

1.3 Language Detection

Classification
Input: A piece of text
Output: One language code
Explanation

Language detection identifies which language a given text is written in. The model uses clues such as character sets, common words, and character n-gram patterns to choose a language label. It is usually the first step in a multilingual pipeline, for example to route text to the right translation or search model. Very short texts and code-mixed text (such as Hinglish) are the main difficulties.

Example
Input : "Bonjour, comment allez-vous aujourd'hui ?"
Output: French (fr)
    

1.4 Topic Modeling

Classification
Input: A document (or a collection of documents)
Output: Topic label(s) or topic distribution
Explanation

Topic modeling discovers the main themes that run through a text or a large collection of documents. It can be supervised, where each document is assigned to a known category, or unsupervised, where methods such as LDA find groups of related words without any labels. Each document is then described by the topics it covers. It is useful for organizing news archives, support tickets, and research papers.

Example
Input : "The striker scored twice as the team secured a place in the final."
Output: Topic = Sports
    

2. "Multi"-classification

Input text goes into the model and a label is produced for every token (or for every part) of the input.

2.1 Part of Speech (POS) Tagging

Multi-classification
Input: A sequence of tokens
Output: One grammatical tag per token
Explanation

POS tagging assigns a grammatical category, such as noun, verb, adjective, or preposition, to every word in a sentence. The same word can take different tags depending on context, so the model must look at the surrounding words. For example, "book" is a noun in "read a book" but a verb in "book a ticket". POS tags are a basic building block for parsing and information extraction.

Example
Input : The   cat   sat   on   the   mat
Output: DET   NOUN  VERB  ADP  DET   NOUN
    

2.2 Named Entity Recognition (NER)

Multi-classification
Input: A sequence of tokens
Output: An entity tag per token (e.g., BIO scheme)
Explanation

NER finds and labels real-world entities in text, such as people, organizations, locations, dates, and amounts. Each token receives a tag showing whether it begins an entity, continues one, or is outside any entity. This turns unstructured text into structured data that can be searched or stored in a database. It is commonly used in resume parsing, news analysis, and medical record processing.

Example
Input : "Sundar Pichai announced a Google office in Bengaluru on Monday."
Output: Sundar Pichai -> PERSON | Google -> ORG | Bengaluru -> LOCATION | Monday -> DATE
    

2.3 Dependency Parsing

Multi-classification
Input: A sentence
Output: A head word and relation label for each word
Explanation

Dependency parsing analyzes the grammatical structure of a sentence by linking each word to the word it depends on. Every link carries a relation label, such as subject, object, or modifier, and the main verb usually becomes the root of the tree. This shows who did what to whom in the sentence. The result is useful for relation extraction, question answering, and grammar checking.

Example
Input : "She reads books"
Output: reads -> ROOT
        She   -> nsubj (subject of "reads")
        books -> obj   (object of "reads")
    

2.4 Constituency Parsing

Multi-classification
Input: A sentence
Output: A phrase-structure tree
Explanation

Constituency parsing breaks a sentence into nested phrases, such as noun phrases (NP) and verb phrases (VP), and builds a tree from them. Unlike dependency parsing, which links individual words, it groups words into larger units that act together. The tree shows how small phrases combine to form the full sentence. It is helpful for grammar analysis and for tasks that need phrase-level structure.

Example
Input : "The dog chased the ball"
Output: (S (NP The dog) (VP chased (NP the ball)))
    

3. Generation

Input text goes into the model and new output text is produced, whose length and content are not fixed in advance.

3.1 Machine Translation

Generation
Input: Text in a source language
Output: Text in a target language
Explanation

Machine translation automatically converts text from one language to another while keeping its meaning. The model reads the whole source sentence and then generates the target sentence word by word. Word order, grammar, and idioms differ between languages, so a good system cannot simply swap words one by one. Modern systems are built on sequence-to-sequence and Transformer models.

Example
Input : "How are you today?"   (English)
Output: "¿Cómo estás hoy?"      (Spanish)
    

3.2 Question Answering

Generation
Input: A question (optionally with a context passage)
Output: An answer in text form
Explanation

Question answering systems respond to a question written in natural language. In the extractive form, the answer is a span copied from a given passage; in the generative form, the model writes the answer in its own words. Some systems use only the knowledge stored in the model, while others retrieve documents first and answer from them. It powers search assistants, customer support bots, and reading comprehension tools.

Example
Context : "The Eiffel Tower was completed in 1889 in Paris."
Question: "When was the Eiffel Tower completed?"
Answer  : "1889"
    

3.3 Summarization

Generation
Input: A long document
Output: A shorter text with the key points
Explanation

Summarization condenses a long text into a shorter version that keeps the most important information. Extractive summarization selects key sentences from the original, while abstractive summarization writes new sentences that capture the meaning. The main challenge is to stay faithful to the source and avoid adding facts that were never stated. It is used for news digests, meeting notes, and research paper abstracts.

Example
Input : A 500-word article about a city's new metro line, covering its route,
        cost, opening date, and expected ridership.
Output: "The city opened a 20 km metro line on Monday, expected to carry
        200,000 riders daily."
    

3.4 Text Generation

Generation
Input: A prompt or the beginning of a text
Output: A continuation or a full new text
Explanation

Text generation produces new, fluent text from a prompt by predicting one token at a time, each based on the tokens before it. It is the basic mechanism behind large language models and can be used for stories, emails, code, and conversation. Settings such as temperature control how predictable or creative the output is. Because the model can sound confident even when it is wrong, the generated text needs to be checked for accuracy.

Example
Input : "Once upon a time, in a small village by the sea,"
Output: "there lived a fisherman who dreamed of sailing beyond the horizon..."