What is NLP?
Natural language processing (NLP) is the branch of artificial intelligence that enables computers to understand, interpret and generate human language, in text or speech. It combines linguistics (how language is structured) with computer science and machine learning (how to process it at scale).
NLP has two sides: natural language understanding (NLU), turning language into a representation the machine can reason with, and natural language generation (NLG), producing language from such a representation.
Role of NLP in artificial intelligence
- Communication between humans and machines: people can ask questions and give instructions in ordinary language, through chatbots, voice assistants and search boxes, instead of learning a formal command language.
- Access to knowledge: most human knowledge is stored as text. NLP lets AI systems read documents, extract facts, and answer questions from them.
- Reasoning input: an AI agent that plans or decides needs facts; NLP turns sentences into structured knowledge (entities, relations, events) that other parts of the system can use.
- Automation of language tasks: translation, summarisation, classification of emails and tickets, and sentiment analysis of reviews.
- Generation: writing replies, reports and explanations, so that AI systems can explain their results in words.
NLP was one of the original goals of AI; the Turing test itself is a conversation in natural language. Today, large language models built for NLP have also become general-purpose tools used across AI.
Phases of NLP
Classical NLP describes understanding as five phases, each working on a larger unit of language and resolving a different kind of ambiguity. We will follow one example through all five:
"The bank rejected Ravi's loan application because it was incomplete. He will apply again next month."
1. Lexical and morphological analysis
The text is split into sentences and words (tokenisation), and each word is analysed into its root and affixes (morphology). Each word gets a part-of-speech tag.
- Tokens: The / bank / rejected / Ravi / 's / loan / application / because / it / was / incomplete / .
- Morphology: rejected = reject + -ed (past tense); incomplete = in- + complete; application = apply + -ation.
- Part of speech: bank = noun, rejected = verb, incomplete = adjective.
2. Syntactic analysis (parsing)
The words are arranged into a grammatical structure according to the rules of the language, and sentences that break those rules are rejected. "Bank the rejected application loan" would fail here.
S
├── NP: The bank
└── VP: rejected
├── NP: Ravi's loan application
└── SBAR (clause): because it was incomplete
Parsing tells us that "the bank" is the subject and "Ravi's loan application" the object of "rejected".
3. Semantic analysis
The meaning of words and the sentence is determined. "Bank" is ambiguous (a river bank or a financial institution); next to "loan application", the financial sense is chosen (word sense disambiguation). The sentence is mapped to a meaning such as reject(agent: bank, object: application, owner: Ravi). A sentence can be grammatical and still meaningless, like "colourless green ideas sleep furiously"; semantic analysis is where that is detected.
4. Discourse integration
The meaning of a sentence depends on the sentences around it. Here, "it" must be resolved: it refers to the application, not the bank (coreference resolution). In the second sentence, "he" refers to Ravi, and "apply again" refers to applying for the same loan.
5. Pragmatic analysis
Finally, the text is interpreted in its real-world context and purpose. The reader infers that Ravi wants the loan, that the rejection was not final, and that completing the missing parts may lead to approval. Pragmatics also covers requests phrased as questions: "Can you check my application status?" is a request to check it, not a question about ability.
Phases at a glance
| Phase | Unit | Main question | Ambiguity resolved |
|---|---|---|---|
| Lexical / morphological | Words and their parts | What are the words and their forms? | Word boundaries, word forms |
| Syntactic | Sentence structure | How are the words grouped grammatically? | Structural ambiguity ("I saw the man with the telescope") |
| Semantic | Sentence meaning | What does the sentence literally mean? | Word senses ("bank") |
| Discourse | Several sentences | How do sentences connect? | Pronouns and references ("it", "he") |
| Pragmatic | Text in context | What does the speaker intend? | Intent and implied meaning |
How modern NLP relates to the phases
Systems built on neural networks, especially transformers, do not run five separate modules. One model learns all these levels together from data, and its internal layers are known to capture syntax and word sense to different degrees. The phases remain the clearest way to understand what any NLP system must handle, and libraries such as spaCy still expose them as separate steps (tokenisation, tagging, parsing, entity recognition). The three broad ways of building these systems are compared in approaches in NLP, and a symbolic meaning representation for the semantic phase is described in conceptual dependency.
To see the phases in code, work through NLP with spaCy or build a chatbot using Python and NLP. NLP is part of Uncodemy's Artificial Intelligence course.


