Lesson 1 of 4 Text Analysis Concepts

Finding the Main Topics in Text with Keyword Extraction

This lesson explains keyword extraction, called key phrase extraction in Azure Language, which identifies the main concepts in a text. It answers the question what is this text about? without reading every word.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain how keyword extraction identifies important terms, including the idea behind TF-IDF.
  • Identify common uses of key phrases.
  • Choose between prebuilt key phrase extraction and a generative prompt.

How keyword extraction works

Earlier approaches scored words by how often they appear in one document compared with a whole collection, a statistic called term frequency-inverse document frequency (TF-IDF): a word that is frequent in this document but rare elsewhere is likely to be important. Modern services use language models that understand context and return multi-word key phrases, such as battery life or late delivery, rather than single words.

Azure Language key phrase extraction returns a list of phrases for each document. Generative models can also extract keywords when prompted, and can be told to use a fixed vocabulary of topics, which the prebuilt feature does not support.

True or false

How key phrases are found

Exam skills 1.3.2

Check four statements about keyword extraction.

Log in to try this activity Interactive activities are free with an account.

Uses

Key phrases support tagging and indexing documents for search, finding trending topics across thousands of reviews or support tickets, and giving readers a quick view of what a document covers. Combined with sentiment analysis, they show which topics customers are positive or negative about.

Prebuilt extraction or a generative prompt?

Both Azure Language and generative models can find the main topics in text, and the choice depends on what the application needs. Prebuilt key phrase extraction is consistent, fast and inexpensive, and it needs no prompt. A generative model is more flexible: it can map text to the organization's own list of topics, explain its choice or combine extraction with other tasks in one request. The following table compares them.

NeedBetter choice
Consistent phrases from large volumes of textAzure Language key phrase extraction
Topics from a fixed list chosen by the organizationGenerative model with instructions
No prompt design or model deploymentAzure Language key phrase extraction
Topics plus a short explanation or summaryGenerative model

For example, a retailer analysing 50,000 product reviews might run key phrase extraction to discover what customers talk about, then use a generative model to assign each review to one of ten categories that the product team defined.

Sort into groups

Prebuilt or prompt?

Exam skills 1.3.2

Choose between prebuilt key phrase extraction and a generative model for each need.

Log in to try this activity Interactive activities are free with an account.
Worked example

Summarizing feedback topics

A hotel chain receives 20,000 written guest comments a month and wants a dashboard of the topics guests mention most often, such as breakfast, pool and check-in wait. Which text analysis technique fits?

The goal is the main talking points across many texts, which is keyword (key phrase) extraction, with the phrases counted across all comments.

Entity detection would find named things such as hotel names and dates, not topics such as check-in wait. Sentiment analysis would show how guests feel but not what they talk about. Summarization would shorten each comment but not produce countable topics.

Check yourself

What question does key phrase extraction answer?

Show answer

What a text is about, as a list of main phrases, which are often several words long.

Exam Tips

Remember for the exam

  • Key phrase extraction answers what a text is about.
  • Key phrases are often multi-word phrases, not single words.
  • Combine key phrases with sentiment to see how people feel about each topic.