Meriem B.
·NLP basics·7 min

NLP basics: NLU, NLG, and core language tasks

A compact map of NLP, NLU, NLG, tokenization, entity extraction, and sentiment before embeddings enter the picture.

Language looks simple until software has to touch it.

"The bank approved my loan."
"I sat near the river bank."

Same word. Different meaning.

That is the annoying part of language: words carry context, order, tone, and relationships. A system cannot treat text as a flat list of words and expect to understand much.

One word, two meanings

The bank approved my loan.

bankfinanceloanaccount

I sat near the river bank.

bankriverwaterland

The model has to use nearby words to decide which meaning of bank is active.

This sits before the embedding/Transformer story: counting words to embeddings, then contextual embeddings to Transformers.

NLP

NLP means Natural Language Processing.

Basically: making software work with human language.

That includes things like:

classification
translation
summarization
question answering
chatbots
semantic search
speech-to-text
information extraction
sentiment analysis

The pattern is usually:

raw text -> useful structure or useful text

Example:

Input:
"I love this product."
 
Output:
sentiment = positive

NLP is the broad field. Two useful sub-ideas inside it:

NLU = reading / understanding
NLG = writing / generating
NLP, NLU, and NLG
User text

Book me a flight to Paris next Friday.

NLU

intent, destination, date, sentiment, entities

NLG

a natural-language response or summary

NLP is the full field. NLU is the reading side. NLG is the writing side.

NLU

NLU means Natural Language Understanding.

The job is to turn a messy sentence into meaning the system can use.

"Book me a flight to Paris next Friday."

Could become:

intent: book_flight
destination: Paris
date: next Friday

That is the useful part. The system is not only seeing words. It is pulling out a goal and the details attached to it.

NLU shows up in:

  • intent detection
  • named entity recognition
  • sentiment analysis
  • topic classification
  • search query understanding
  • support ticket routing

Most product workflows that start with natural language need some version of this.

NLG

NLG means Natural Language Generation.

This is the output side.

Examples:

  • writing an answer
  • summarizing a document
  • generating an email
  • producing a chatbot reply
  • translating text
  • explaining data in plain language

Translation uses both sides. The system has to understand the source text, then generate the target text.

Small map:

NLP = full field
NLU = understand text
NLG = generate text

Modern LLM apps usually combine all three: understand the request, retrieve or process information, then generate a useful answer.

Tokenization

Tokenization is the first boring thing that turns out not to be boring.

It breaks text into smaller units called tokens.

Tokens can be:

words
subwords
characters
punctuation

Example:

"Apple opened a new office in Paris."

can become:

["Apple", "opened", "a", "new", "office", "in", "Paris", "."]

Modern models often use subwords:

"unbelievable"
-> ["un", "believ", "able"]

The usual flow:

text
-> tokens
-> token IDs
-> embeddings
-> model

Tokenization affects cost, context length, search behavior, and weird edge cases with unfamiliar words.

Tokenization turns text into model-sized pieces

Apple opened a new office in Paris.

AppleopenedanewofficeinParis.
Appleid 314
openedid 405
aid 496
newid 587

After tokenization, each token can be mapped to an ID and then to an embedding vector.

Named entity recognition

Named Entity Recognition is usually shortened to NER.

It finds named things in text:

people
companies
locations
dates
money amounts
organizations
products

Example:

"Apple opened a new office in Paris on Monday."

NER output:

Apple  -> Organization
Paris  -> Location
Monday -> Date

This is where text starts becoming structured.

"Meeting with Sarah in London next Friday."

can become:

person: Sarah
location: London
date: next Friday

Once text becomes structured, applications can route it, search it, validate it, and store it more cleanly.

Named entity recognition highlights useful facts
Apple org opened a new office in Paris loc on Monday date.
Organization

Apple

Location

Paris

Date

Monday

NER turns unstructured text into fields an application can store, filter, or route.

Sentiment analysis

Sentiment analysis tries to detect tone or opinion.

Basic labels:

positive
negative
neutral

Examples:

"I love this app."
-> positive
 
"This app keeps crashing."
-> negative
 
"The app was updated yesterday."
-> neutral

It is used in reviews, surveys, support tickets, feedback analysis, and social monitoring.

The annoying part is sarcasm and context.

"Great, the app crashed again."

The word great looks positive. The sentence is not.

Sentiment analysis maps text to opinion
positive

I love this app. It is fast and easy to use.

negative

This app keeps crashing after the update.

neutral

The app was updated yesterday.

The simple version predicts positive, negative, or neutral. Real systems often need more nuance.

The map before embeddings

All of this points at the same problem:

How does text become something software can process?

Older NLP systems mostly counted words.

Modern systems try to represent meaning.

The rough path:

raw text
-> tokens
-> numbers
-> meaning-like representations
-> useful output

The compact version:

NLP = the whole field
NLU = interpret language
NLG = generate language
tokenization = split text into model-readable units
NER = extract named things
sentiment = estimate tone

Next problem: before embeddings, how did systems represent text?

That is where one-hot vectors, Bag of Words, and TF-IDF come in.