RedLectern topic

Natural language processing

Methods for analyzing and processing language beyond conversational LLMs.

For: Learners · developers.

After this page you can: Choose an approach to a language-processing task.

Page reviewed

Part of: Artificial Intelligence › AI foundations

About Natural language processing

Natural language processing (NLP) applies computational methods to human language. A text-processing program can manipulate and analyze language data, while an NLP system can be designed for a particular output, such as a category, a label for each word, a sentence structure, or a probability for a word sequence.

Choose an approach by starting with the output your task needs. Use classification when an input needs a category; use sequence labeling when each token needs a label; use parsing when you need sentence structure. A language model estimates probabilities for likely words or word sequences. These approaches can be combined, but they answer different questions.

For a first project, write down the input, the output, and a few representative examples. Then choose a method whose output matches the task. If the task depends on distinctions such as punctuation, capitalization, or word boundaries, check how the text is represented before selecting or training a method.

Start here

Learn the foundations

1.Choose the language taskStart by naming the output you need.

Start by naming the output you need. A document classifier assigns one or more category labels to an input; supervised classification learns from examples paired with labels. A language model instead assigns probabilities to likely next words or complete word sequences. These approaches answer different questions: use classification when the required output is a label from a task's label set, and consider a language model when the task requires estimating likely word sequences.

Write down whether the input is a document, sentence, or token sequence, and whether the requested output is a class, token labels, structure, or probability. That small specification helps distinguish tasks that can otherwise sound similar.

Natural language processing

Computational methods for analyzing, understanding, or generating human language.

Language model

A model that estimates patterns or probabilities in language.

Try it

For each request, choose a likely output type: mark each word as a noun or verb; label an email as spam or not spam; estimate which word is likely to follow “peanut butter and”.

The first needs token labels, the second needs a class label, and the third needs a probability over likely next words.

2.Prepare text for analysisBefore applying a method, decide how the text should be represented.

Before applying a method, decide how the text should be represented. Tokenization splits text into units such as words and punctuation; the resulting units are the input to later analysis. A document may also contain material, such as markup or headers, that is not part of the text you mean to analyze.

Preprocessing choices affect what information remains available. For example, lowercasing collapses distinctions between capitalized and lowercase forms, and removing punctuation discards punctuation tokens. Inspect a few examples from your data and keep only the transformations that fit the task. A word-counting exercise, a named-entity task, and a sentence-structure task may need different text handling.

Try it

You want to count how often the words “Maple” and “maple” occur, treating them as the same form. What preprocessing choice would help, and what distinction would it remove?

Lowercase the tokens before counting. This merges capitalized and lowercase forms, so the count no longer preserves that distinction.

3.Label words or analyze structureWhen the output belongs to individual words, use a tagging or sequence-labeling approach: a part-of-speech tagger attaches a word-class label to each word, and…

When the output belongs to individual words, use a tagging or sequence-labeling approach: a part-of-speech tagger attaches a word-class label to each word, and named-entity recognition identifies and labels entity mentions. When the output needs to show how a sentence is organized, use parsing. These outputs represent different levels of analysis, so choose according to what a later step needs to consume.

Some tasks need structured information rather than a full sentence analysis. Information extraction can identify entities and relations and represent them as structured data. For a small, defined set of questions, a system can also map sentence forms to meaning representations that can query a database. Begin with the narrowest output that answers your task.

Try it

A text tool must return every organization name and the location related to it. Should its immediate output be part-of-speech tags, a parse tree, or structured entity-relation records?

Structured entity-relation records fit the requested output: organization, relation, and location. Part-of-speech tags and a parse tree represent different kinds of linguistic structure.

Latest

No recent updates are available.

See the sources list

Books

Glossary

2 terms on this page.

Browse the AI glossary

Questions and comments