Natural language processing: how computers parse and produce text
Natural language processing (NLP) is a subfield of AI that uses machine learning to enable computers to understand, interpret, and generate human language. It combines computational linguistics with statistical models and deep learning to handle tasks like sentiment analysis, translation, and chatbots. Modern NLP relies on transformer architectures and large language models to achieve high performance.

What NLP does
Natural language processing (NLP) is a subfield of computer science and artificial intelligence that uses machine learning to enable computers to understand and communicate with human language, as described by IBM's NLP overview. It combines computational linguistics, which is the rule-based modeling of human language, with statistical modeling, machine learning, and deep learning.
NLP allows computers and digital devices to recognize, understand, and generate text and speech. It powers everyday applications such as search engines, chatbots, voice-operated GPS systems, and digital assistants. In business, NLP helps automate repetitive tasks like customer support and document processing, and it improves data analysis by extracting insights from unstructured text such as customer reviews and social media posts.
NLP also enhances search by understanding the intent behind user queries, providing more accurate and contextually relevant results than keyword matching alone. Additionally, NLP powers content generation, where pre-trained models can create human-like text for articles, reports, and marketing copy.
Approaches and tasks
There are several approaches to NLP. Supervised NLP trains software with labeled inputs and outputs, learning to produce correct outputs from unknown inputs. Unsupervised NLP uses statistical language models to predict patterns from unlabeled data, such as autocomplete features in text messaging, according to AWS's NLP explanation.
NLP includes two key subtopics: natural language understanding (NLU) and natural language generation (NLG). NLU focuses on analyzing the meaning behind sentences, allowing software to find similar meanings in different sentences or process words with different meanings. NLG focuses on producing conversational text based on keywords or topics, enabling chatbots to converse with customers.
Common NLP tasks include sentiment analysis, entity analysis, content classification, and syntax analysis. For example, Google Cloud's NLP page notes that entity analysis can find and label fields within documents, and content classification can categorize documents into hundreds of general categories like sports and entertainment.
How NLP works: from words to vectors
Most NLP systems use machine learning algorithms to understand how words are used. Input text is converted into word vectors, which are mathematical representations of words, using techniques such as word embedding. Each word is turned into a series of numbers that a deep learning model, such as an RNN, LSTM, or transformer, can process to grasp context, as explained in the NVIDIA glossary on NLP.
These deep learning models provide outputs for specific language tasks like next word prediction and text summarization. However, word-embedding can struggle with nuances, such as the same representation for 'bass' in 'bass fish' and 'bass player'. BERT, which stands for Bidirectional Encoder Representations from Transformers, is designed to read text in both directions, allowing it to understand and retain context more effectively than other encoding methods.
The BERT paper on arXiv introduces a model that learns deep bidirectional representations from unlabeled text by considering both the left and right context of every word in all layers. This pre-trained model can be fine-tuned with just one additional output layer to achieve strong results on a wide range of tasks, such as question answering and language inference.
Learning and resources
NLP is a crucial part of AI, and deep learning approaches have obtained very high performance on many NLP tasks. Stanford's CS224N course provides a thorough introduction to neural networks for NLP, covering both the basics of deep learning and current research on large language models, as described on the Stanford CS224N course page.
The course teaches students to design, implement, and understand their own neural network models using the PyTorch framework. It covers applications such as web search, customer service, language translation, and virtual agents.
For a comprehensive reference, the textbook Speech and Language Processing by Dan Jurafsky and James H. Martin is available as a draft online. It covers topics from words and tokens to transformers and pretraining, and includes chapters on machine translation, speech recognition, and dialogue systems.
| Approach | Description | Example task |
|---|---|---|
| Supervised NLP | Trains with labeled inputs and outputs | Document categorization |
| Unsupervised NLP | Uses statistical language models on unlabeled data | Autocomplete in text messaging |
| Natural language understanding (NLU) | Analyzes meaning behind sentences | Sentiment analysis |
| Natural language generation (NLG) | Produces conversational text | Chatbot responses |
| Word embedding | Converts words to numerical vectors | Input for deep learning models |
| Transformer models | Process text in parallel, handle context | Question answering |
Frequently asked questions
What is natural language processing?
Natural language processing (NLP) is a subfield of AI that uses machine learning to enable computers to understand, interpret, and generate human language, combining computational linguistics with statistical and deep learning models.
What are the main approaches to NLP?
The main approaches include supervised NLP, which trains on labeled data, and unsupervised NLP, which uses statistical language models on unlabeled data. NLP also includes natural language understanding (NLU) and natural language generation (NLG).
How does NLP work?
NLP works by converting text into word vectors, which are numerical representations, and feeding them into deep learning models like RNNs, LSTMs, or transformers. These models learn patterns and context to perform tasks like translation or sentiment analysis.
What is BERT?
BERT (Bidirectional Encoder Representations from Transformers) is a language representation model that pre-trains deep bidirectional representations from unlabeled text, allowing it to understand context better and achieve strong results on many NLP tasks.
What are common NLP applications?
Common applications include email spam filters, spell checkers, language translation, sentiment analysis, semantic search, chatbots, and voice assistants, as well as automating customer support and document processing.