Skip to content

Commit d4b7f9c

Browse files
author
Sherry Yang
committed
Add language concept module.
1 parent ea5bad7 commit d4b7f9c

14 files changed

+326
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.introduction-language.introduction
3+
title: Introduction
4+
metadata:
5+
title: Introduction
6+
description: "Introduction"
7+
ms.date: 5/21/2025
8+
author: wwlpublish
9+
ms.author: sheryang
10+
ms.topic: unit
11+
ms.custom:
12+
- N/A
13+
durationInMinutes: 1
14+
content: |
15+
[!include[](includes/1-introduction.md)]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.introduction-language.how-it-works
3+
title: How it works
4+
metadata:
5+
title: How it works
6+
description: "How it works"
7+
ms.date: 5/21/2025
8+
author: wwlpublish
9+
ms.author: sheryang
10+
ms.topic: unit
11+
ms.custom:
12+
- N/A
13+
durationInMinutes: 6
14+
content: |
15+
[!include[](includes/2-how-it-works.md)]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.introduction-language.text-analysis
3+
title: Understand text analysis
4+
metadata:
5+
title: Understand text analysis
6+
description: "Understand text analysis"
7+
ms.date: 5/21/2025
8+
author: wwlpublish
9+
ms.author: sheryang
10+
ms.topic: unit
11+
ms.custom:
12+
- N/A
13+
durationInMinutes: 5
14+
content: |
15+
[!include[](includes/3-text-analysis.md)]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.introduction-language.knowledge-check
3+
title: Module assessment
4+
metadata:
5+
title: Module assessment
6+
description: "Knowledge check"
7+
ms.date: 5/21/2025
8+
author: wwlpublish
9+
ms.author: sheryang
10+
ms.topic: unit
11+
ms.custom:
12+
- N/A
13+
durationInMinutes: 3
14+
quiz:
15+
title: "Check your knowledge"
16+
questions:
17+
- content: "What is the primary purpose of tokenization in natural language processing (NLP)?"
18+
choices:
19+
- content: "To translate text into another language."
20+
isCorrect: false
21+
explanation: "Incorrect."
22+
- content: "To summarize large documents."
23+
isCorrect: false
24+
explanation: "Incorrect."
25+
- content: "To break down text into smaller units for analysis."
26+
isCorrect: true
27+
explanation: "Correct."
28+
- content: "What is the primary purpose of named entity recognition in text analysis?"
29+
choices:
30+
- content: "To detect the sentiment of a document."
31+
isCorrect: false
32+
explanation: "Incorrect."
33+
- content: "To identify and categorize entities such as people, places, and organizations."
34+
isCorrect: true
35+
explanation: "Correct."
36+
- content: "To summarize long documents."
37+
isCorrect: false
38+
explanation: "Incorrect."
39+
- content: "Which of the following best describes the function of key phrase extraction?"
40+
choices:
41+
- content: "It links entities to external sources like Wikipedia."
42+
isCorrect: false
43+
explanation: "Incorrect."
44+
- content: "It identifies the most important concepts from unstructured text."
45+
isCorrect: true
46+
explanation: "Correct."
47+
- content: "It removes irrelevant information from the text."
48+
isCorrect: false
49+
explanation: "Incorrect."
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.introduction-language.summary
3+
title: Summary
4+
metadata:
5+
title: Summary
6+
description: "Summary"
7+
ms.date: 5/21/2025
8+
author: wwlpublish
9+
ms.author: sheryang
10+
ms.topic: unit
11+
ms.custom:
12+
- N/A
13+
durationInMinutes: 1
14+
content: |
15+
[!include[](includes/5-summary.md)]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
In order for computer systems to interpret the subject of a text in a similar way humans do, they use **natural language processing** (NLP), an area within AI that deals with understanding written or spoken language, and responding in kind. *Text analysis* describes NLP processes that extract information from unstructured text.
2+
3+
Natural language processing might be used to create:
4+
5+
- A social media feed analyzer that detects sentiment for a product marketing campaign.
6+
- A document search application that summarizes documents in a catalog.
7+
- An application that extracts brands and company names from text.
8+
9+
In this module, you'll explore natural language processing.
10+
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
Let's examine some general principles and common techniques used to perform text analysis and other natural language processing (NLP) tasks.
2+
3+
Some of the earliest techniques used to analyze text with computers involve statistical analysis of a body of text (a *corpus*) to infer some kind of semantic meaning. Put simply, if you can determine the most commonly used words in a given document, you can often get a good idea of what the document is about.
4+
5+
## Tokenization
6+
7+
The first step in analyzing a corpus is to break it down into *tokens*. For the sake of simplicity, you can think of each distinct word in the training text as a token, though in reality, tokens can be generated for partial words, or combinations of words and punctuation.
8+
9+
For example, consider this phrase from a famous US presidential speech: `"we choose to go to the moon"`. The phrase can be broken down into the following tokens, with numeric identifiers:
10+
11+
```
12+
1. we
13+
2. choose
14+
3. to
15+
4. go
16+
5. the
17+
6. moon
18+
```
19+
20+
Notice that `"to"` (token number 3) is used twice in the corpus. The phrase `"we choose to go to the moon"` can be represented by the tokens :::no-loc text="{1,2,3,4,3,5,6}":::.
21+
22+
> [!NOTE]
23+
> We've used a simple example in which tokens are identified for each distinct word in the text. However, consider the following concepts that may apply to tokenization depending on the specific kind of NLP problem you're trying to solve:
24+
>
25+
> - **Text normalization**: Before generating tokens, you may choose to *normalize* the text by removing punctuation and changing all words to lower case. For analysis that relies purely on word frequency, this approach improves overall performance. However, some semantic meaning may be lost - for example, consider the sentence `"Mr Banks has worked in many banks."`. You may want your analysis to differentiate between the person `"Mr Banks"` and the `"banks"` in which he has worked. You may also want to consider `"banks."` as a separate token to `"banks"` because the inclusion of a period provides the information that the word comes at the end of a sentence
26+
> - **Stop word removal**. Stop words are words that should be excluded from the analysis. For example, `"the"`, `"a"`, or `"it"` make text easier for people to read but add little semantic meaning. By excluding these words, a text analysis solution may be better able to identify the important words.
27+
> - **n-grams** are multi-term phrases such as `"I have"` or `"he walked"`. A single word phrase is a `unigram`, a two-word phrase is a `bi-gram`, a three-word phrase is a `tri-gram`, and so on. By considering words as groups, a machine learning model can make better sense of the text.
28+
> - **Stemming** is a technique in which algorithms are applied to consolidate words before counting them, so that words with the same root, like `"power"`, `"powered"`, and `"powerful"`, are interpreted as being the same token.
29+
30+
## Frequency analysis
31+
32+
After tokenizing the words, you can perform some analysis to count the number of occurrences of each token. The most commonly used words (other than *stop words* such as `"a"`, `"the"`, and so on) can often provide a clue as to the main subject of a text corpus. For example, the most common words in the entire text of the `"go to the moon"` speech we considered previously include `"new"`, `"go"`, `"space"`, and `"moon"`. If we were to tokenize the text as `bi-grams` (word pairs), the most common `bi-gram` in the speech is `"the moon"`. From this information, we can easily surmise that the text is primarily concerned with space travel and going to the moon.
33+
34+
> [!TIP]
35+
> Simple frequency analysis in which you simply count the number of occurrences of each token can be an effective way to analyze a single document, but when you need to differentiate across multiple documents within the same corpus, you need a way to determine which tokens are most relevant in each document. *Term frequency - inverse document frequency* (TF-IDF) is a common technique in which a score is calculated based on how often a word or term appears in one document compared to its more general frequency across the entire collection of documents. Using this technique, a high degree of relevance is assumed for words that appear frequently in a particular document, but relatively infrequently across a wide range of other documents.
36+
37+
## Machine learning for text classification
38+
39+
Another useful text analysis technique is to use a classification algorithm, such as *logistic regression*, to train a machine learning model that classifies text based on a known set of categorizations. A common application of this technique is to train a model that classifies text as *positive* or *negative* in order to perform *sentiment analysis* or *opinion mining*.
40+
41+
For example, consider the following restaurant reviews, which are already labeled as **0** (*negative*) or **1** (*positive*):
42+
43+
```
44+
- *The food and service were both great*: 1
45+
- *A really terrible experience*: 0
46+
- *Mmm! tasty food and a fun vibe*: 1
47+
- *Slow service and substandard food*: 0
48+
```
49+
50+
With enough labeled reviews, you can train a classification model using the tokenized text as *features* and the sentiment (0 or 1) a *label*. The model will encapsulate a relationship between tokens and sentiment - for example, reviews with tokens for words like `"great"`, `"tasty"`, or `"fun"` are more likely to return a sentiment of **1** (*positive*), while reviews with words like `"terrible"`, `"slow"`, and `"substandard"` are more likely to return **0** (*negative*).
51+
52+
## Semantic language models
53+
54+
As the state of the art for NLP has advanced, the ability to train models that encapsulate the semantic relationship between tokens has led to the emergence of powerful language models. At the heart of these models is the encoding of language tokens as vectors (multi-valued arrays of numbers) known as *embeddings*.
55+
56+
It can be useful to think of the elements in a token embedding vector as coordinates in multidimensional space, so that each token occupies a specific "location." The closer tokens are to one another along a particular dimension, the more semantically related they are. In other words, related words are grouped closer together. As a simple example, suppose the embeddings for our tokens consist of vectors with three elements, for example:
57+
58+
```
59+
- 4 ("dog"): [10.3.2]
60+
- 5 ("bark"): [10,2,2]
61+
- 8 ("cat"): [10,3,1]
62+
- 9 ("meow"): [10,2,1]
63+
- 10 ("skateboard"): [3,3,1]
64+
```
65+
66+
We can plot the location of tokens based on these vectors in three-dimensional space, like this:
67+
68+
![A diagram of tokens plotted on a three-dimensional space.](../media/example-embeddings-graph.png)
69+
70+
The locations of the tokens in the embeddings space include some information about how closely the tokens are related to one another. For example, the token for `"dog"` is close to `"cat"` and also to `"bark"`. The tokens for `"cat"` and `"bark"` are close to `"meow"`. The token for `"skateboard"` is further away from the other tokens.
71+
72+
The language models we use in industry are based on these principles but have greater complexity. For example, the vectors used generally have many more dimensions. There are also multiple ways you can calculate appropriate embeddings for a given set of tokens. Different methods result in different predictions from natural language processing models.
73+
74+
A generalized view of most modern natural language processing solutions is shown in the following diagram. A large corpus of raw text is tokenized and used to train language models, which can support many different types of natural language processing task.
75+
76+
![A diagram of the process to tokenize text and train a language model that supports natural language processing tasks.](../media/language-model.png)
77+
78+
Common NLP tasks supported by language models include:
79+
- Text analysis, such as extracting key terms or identifying named entities in text.
80+
- Sentiment analysis and opinion mining to categorize text as *positive* or *negative*.
81+
- Machine translation, in which text is automatically translated from one language to another.
82+
- Summarization, in which the main points of a large body of text are summarized.
83+
- Conversational AI solutions such as *bots* or *digital assistants* in which the language model can interpret natural language input and return an appropriate response.
84+
85+
Next, let's learn more about the capabilities made possible by langauge models.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
Text analysis includes:
2+
3+
- **Named entity recognition** identifies people, places, events, and more. This feature can also be customized to extract custom categories.
4+
- **Entity linking** identifies known entities together with a link to Wikipedia.
5+
- **Personal identifying information (PII) detection** identifies personally sensitive information, including personal health information (PHI).
6+
- **Language detection** identifies the language of the text and returns a language code such as "en" for English.
7+
- **Sentiment analysis and opinion mining** identifies whether text is positive or negative.
8+
- **Summarization** summarizes text by identifying the most important information.
9+
- **Key phrase extraction** lists the main concepts from unstructured text.
10+
11+
## Entity recognition and linking
12+
13+
An entity is an item of a particular type or a category; and in some cases, subtype, such as those as shown in the following table.
14+
15+
|Type|SubType|Example|
16+
|---|---|---|
17+
|Person||"Bill Gates", "John"|
18+
|Location||"Paris", "New York"|
19+
|Organization||"Microsoft"|
20+
|Quantity|Number|"6" or "six"|
21+
|Quantity|Percentage|"25%" or "fifty percent"|
22+
23+
*Entity linking* helps disambiguate entities by linking to a specific reference.
24+
25+
For example, suppose you want to detect entities in the following restaurant review:
26+
27+
> "*I ate at the restaurant in Seattle last week.*"
28+
29+
|Entity|Type|SubType|
30+
|---|---|---|
31+
|Seattle|Location||
32+
|last week|DateTime|DateRange|
33+
34+
35+
## Sentiment analysis and opinion mining
36+
37+
Sentiment analysis is
38+
39+
Scores indicate how likely the provided text is a particular sentiment.
40+
41+
For example, the following two restaurant reviews could be analyzed for sentiment:
42+
43+
> *Review 1*: "*We had dinner at this restaurant last night and the first thing I noticed was how courteous the staff was. We were greeted in a friendly manner and taken to our table right away. The table was clean, the chairs were comfortable, and the food was amazing.*"
44+
45+
and
46+
47+
> *Review 2*: "*Our dining experience at this restaurant was one of the worst I've ever had. The service was slow, and the food was awful. I'll never eat at this establishment again.*"
48+
49+
The sentiment score for the first review might be:
50+
Document sentiment: positive
51+
Positive score: .90
52+
Neutral score: .10
53+
Negative score: .00
54+
55+
The second review might return a response:
56+
Document sentiment: negative
57+
Positive score: .00
58+
Neutral score: .00
59+
Negative score: .99
60+
61+
## Key phrase extraction
62+
63+
Key phrase extraction identifies the main points from text. Consider the restaurant scenario discussed previously. If you have a large number of surveys, it can take a long time to read through the reviews. Instead, you can use the key phrase extraction capabilities of the Language service to summarize the main points.
64+
65+
You might receive a review such as:
66+
67+
> "*We had dinner here for a birthday celebration and had a fantastic experience. We were greeted by a friendly hostess and taken to our table right away. The ambiance was relaxed, the food was amazing, and service was terrific. If you like great food and attentive service, you should try this place.*"
68+
69+
Key phrase extraction can provide some context to this review by extracting the following phrases:
70+
- birthday celebration
71+
- fantastic experience
72+
- friendly hostess
73+
- great food
74+
- attentive service
75+
- dinner
76+
- table
77+
- ambiance
78+
- place
79+
80+
As well as using sentiment analysis to determine that this is a positive review, you can also use the key phrase service to identify important elements of the review.
81+
82+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
In this module, you have learned about text analytics and concepts such as tokenization, frequency analysis, and text classification. You've also been introduced to semantic language models that encode language tokens as vectors for grouping related words. The module further delved into the application of these techniques in natural language processing tasks like text analysis, sentiment analysis, machine translation, summarization, and conversational AI solutions.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
### YamlMime:Module
2+
uid: learn.wwl.introduction-language
3+
metadata:
4+
title: Introduction to natural language processing
5+
description: "Introduction to natural language processing"
6+
ms.date: 5/21/2025
7+
author: wwlpublish
8+
ms.author: sheryang
9+
ms.topic: module
10+
ms.collection: wwl-ai-copilot
11+
ms.custom:
12+
- N/A
13+
ms.service: azure-ai-language
14+
ai-usage: ai-assisted
15+
title: Introduction to natural language processing
16+
summary: Explore natural language processing (NLP).
17+
abstract: Explore natural language processing (NLP).
18+
prerequisites: Ability to navigate the Azure portal
19+
iconUrl: /learn/achievements/analyze-text-with-text-analytics-service.svg
20+
levels:
21+
- beginner
22+
roles:
23+
- ai-engineer
24+
- data-scientist
25+
- developer
26+
- solution-architect
27+
- student
28+
products:
29+
- ai-services
30+
subjects:
31+
- natural-language-processing
32+
units:
33+
- learn.wwl.introduction-language.introduction
34+
- learn.wwl.introduction-language.how-it-works
35+
- learn.wwl.introduction-language.text-analysis
36+
- learn.wwl.introduction-language.knowledge-check
37+
- learn.wwl.introduction-language.summary
38+
badge:
39+
uid: learn.wwl.introduction-language.badge

0 commit comments

Comments
 (0)