0% found this document useful (0 votes)
19 views14 pages

Class 10 NLP Study Notes

Natural Language Processing (NLP) is a subfield of AI focused on enabling computers to understand and process human languages, facilitating communication between humans and machines. NLP has various applications, including voice assistants, auto-generated captions, language translation, sentiment analysis, and text classification. The document outlines the stages of NLP, text processing techniques, and methods like Bag of Words and TF-IDF for analyzing and extracting meaningful information from text.

Uploaded by

mdmarwan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views14 pages

Class 10 NLP Study Notes

Natural Language Processing (NLP) is a subfield of AI focused on enabling computers to understand and process human languages, facilitating communication between humans and machines. NLP has various applications, including voice assistants, auto-generated captions, language translation, sentiment analysis, and text classification. The document outlines the stages of NLP, text processing techniques, and methods like Bag of Words and TF-IDF for analyzing and extracting meaningful information from text.

Uploaded by

mdmarwan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Natural Language Processing Class 10 Notes

What do you mean by natural languages processing?


Natural Language Processing, or NLP, is the subfield of AI that is focused on
enabling computers to understand and process human languages. Natural
Language Processing helps machines to understand and interpret human
language and operate accordingly. Natural Language are governed by set rules
that include syntax, lexicon, and semantics.

Why is NLP important?


Computers can only process electronic signals in the form of binary language.
Natural Language Processing facilitates this conversion to digital form from the
natural form. Thus, the whole purpose of NLP is to make communication
between computer systems and humans possible.

Definition: Natural Language Processing, or NLP, is the sub-field of AI that is


focused on enabling computers to analyse, understand and process human
languages to derive meaningful information from human language.

Various applications of NLP in everyday life

Voice assistants – Natural language processing is used in voice assistants like


Google Assistant, Siri, and Alexa. NLP helps to understand the spoken
commands from the users, process the language, and provide some meaningful
response. For example:

• Hey Google, set an alarm at 3.30 pm


• Hey Alexa, play some music
• Hey Siri, what’s the weather today.
Auto generated captions – Natural language processing can generate captions
automatically; NLP can transcribe spoken words into written text and can
enhance the viewing experience. YouTube, Google Meet, Hulu, and Netflix
automatically generate captions for their content. For example:

• Auto-generated captions on YouTube and Google Meet.


Language translation – Natural Language Processing uses neural translation
algorithms to translate from one language to another language. NLP is the
backbone of many translation services like Google Translate. For example:
• Google Translate
Sentiment analysis – Sentiment analysis is a natural language processing
technique that judge the emotion and the intent of the text. Sentiment analysis
classifies text as positive, negative, or neutral. This technique is used for
customer satisfaction and is used in business and in social media.

Text classification – Text classification plays an important role in natural


language processing. NLP helps the computer to understand and organize large
amounts of unstructured data. Text classification can filter the content, customer
feedback, and recommendation system.

Keyword extraction – Keyword extraction is useful in search engine


optimization; this feature helps to analyze and summarize large documents. It
helps the machine to understand the most important words and phrases from the
document.

Keyword Extraction Example

STEP – 1: Click on [Link]

In the above image, you can see that Google Natural Language extracts the
keywords from the paragraph. These keywords are used in the search engine to
understand the most important words and phrases from the text.
Stages of Natural Language Processing (NLP)
To process human language, machines rely on five different concepts like
lexicon, syntax, semantics, discourse integration and pragmatic analysis. This
stage works together to convert raw text to meaningful information.

Stage 1: Lexicon Analysis – Lexicon is the first phase in NLP. It works as a


collection of words just like a word dictionary. Lexicon first analyzes the text and
breaks it into paragraphs, sentences, and words. This is known as tokenization,
which helps to identify important information about the words or sentences.
Lexicon helps to identify the words, their parts of speech, synonyms, antonyms,
and possible meanings in different languages. For example, the word bank can
be used as a side of a river, or in a financial institution; the meaning of bank is
different.

Example,

Stage 2: Syntactic Analysis – The second phase of NLP is syntactic analysis. It


is the process of checking the grammar of sentences and phrases. It forms a
relationship among words and eliminates logically incorrect sentences. It has a
set of rules that helps to check the grammatical errors in the sentences.
Example,

Stage 3: Semantic Analysis – The third phase of NLP is Semantics Analysis.


Semantic analysis helps to find the meaning of words and sentences. It helps to
identify the meaning behind the words or sentences that make some logical
sense.

Stage 4: Discourse Integration – The fourth phase of NLP is discourse


integration. Discourse integration examines how words, phrases, and sentences
relate to each other within a text. It also finds the overall meaning of the
sentences; it also tries to understand what the overall message convey in the
text.
Stage 5: Pragmatic Analysis – The fifth phase of NLP is pragmatic analysis. In
this phase, sentences are checked for their relevance in the real world. the
machine wants to understand what the writer or speaker truly wants to convey,
because in the human language, words have different meanings in different
languages, and the machine wants to understand in what situation the message
is conveyed and what the writer intends to convey in the message.

Summary of NLP
What is chatbot?
One of the most common applications of Natural Language Processing is a
chatbot. Chatbots use artificial intelligence and natural language processing to
simulate human conversation through voice commands or text chats or both.
There are a lot of chatbots available and many of them use the same approach.

Differences between smart-bots and script-bots

The difference between smart-bots and script-bots are


What is text processing?
Text processing helps to transform the raw text into a machine-level format
where the machine can understand and analyze easily.

Text Normalization technique used in NLP


Text normalization helps in cleaning up the textual data in such a way that it
comes down to a level where its complexity is lower than the actual data. We
undergo several steps to normalize the text to a lower level; normalization makes
the sentence easier to understand by the machine.

Example: Ronaldo plays football everyday. He likes to play football while


running.

1. Sentence Segmentation

Under sentence segmentation, the whole corpus is divided into sentences. Each
sentence is taken as a different data so now the whole corpus gets reduced to
sentences.

Output:

1. Ronaldo plays football everyday.


2. He likes to play football while running.
2. Tokenisation

In tokenisation each sentence is then further divided into tokens. Tokens is a


term used for any word or number or special character occurring in a sentence.
Under tokenisation, every word, number and special character is considered
separately and each of them is now a separate token.

Output:

1. [Ronaldo][plays][football][everyday][.]
2. [He][likes][to][play][football][while][running][.]
3. Removing Stopwords, Special Characters and Numbers

In this step, the tokens which are not necessary are removed from the token list.
What can be the possible words which we might not require?

Output:

1. [Ronaldo][plays][football][everyday]
2. [likes][play][football][running]

4. Converting text to a common case

After the stopwords removal, we convert the whole text into a similar case,
preferably lower case. This ensures that the case-sensitivity of the machine does
not consider same words as different just because of different cases.

Output: 1. [ronaldo][plays][football][everyday]
2. [likes][play][football][running]

5. Stemming

In this step, the remaining words are reduced to their root words. In other words,
stemming is the process in which the affixes of words are removed and the
words are converted to their base form.

Output: 1. [ronaldo][play][football][everyday]
2. [like][play][football][runn]

6. Lemmatization

Stemming and lemmatization both are alternative processes to each other as the
role of both the processes is same – removal of affixes. But the difference
between both of them is that in lemmatization, the word we get after affix removal
(also known as lemma) is a meaningful one.

Output: 1. [ronaldo][play][football][everyday]
2. [like][play][football][run]
Bag of Word
Bag of Words is a Natural Language Processing model which helps in extracting
features out of the text which can be helpful in machine learning algorithms. In
bag of words, we get the occurrences of each word and construct the vocabulary
for the corpus.

Here is the step-by-step approach to implement bag of words algorithm:

1. Text Normalisation: Collect data and pre-process it


2. Create Dictionary: Make a list of all the unique words occurring in
the corpus. (Vocabulary)
3. Create document vectors: For each document in the corpus, find
out how many times the word from the unique list of words has
occurred.
4. Create document vectors for all the documents.
Example of Bag of Words

Step 1: Text Normalisation

• Sentence 1: i love my school


• Sentence 2: my school is amazing
Step 2: Create Dictionary

The unique words from both sentences:


i, love, my, school, is, amazing

Step 3: Create document vectors

Word Sentence 1 Sentence 2

i 1 0

love 1 0

my 1 1

school 1 1

is 0 1

amazing 0 1

Final Bag of Word Vectors are

• Sentence 1: [1, 1, 1, 1, 0, 0]
• Sentence 2: [0, 0, 1, 1, 1, 1]
TF-IDF: Term Frequency & Inverse Document Frequency
TF-IDF is a statistical method used in natural language processing to retrieve the
important word or unique word in a document, or you can say that TF-IDF helps
to identify the most meaningful word in the document. TF-IDF combines two
components: term frequency and inverse document frequency.

Term frequency

Term frequency is the frequency of a word in one document. Term frequency can
easily be found from the document The formula of term frequency are –
Inverse Document Frequency

Document Frequency is the number of documents in which the word occurs


irrespective of how many times it has occurred in those documents.

Finally, the formula of TF-IDF for any word W becomes:

TFIDF(W) = TF(W) * log( IDF(W) )

Example of TF-IDF Calculation

Step 1: Sample Documents

Document 1: I love my school.



Document 2: My school is amazing!

Step 2: Calculate TF

Formula for TF calculation are –

Document 1 Document 1 Document 2 Document 2


Word
Count TF Count TF

I 1 1 / 4 = 0.25 0 0/4=0

love 1 1 / 4 = 0.25 0 0/4=0


Document 1 Document 1 Document 2 Document 2
Word
Count TF Count TF

my 1 1 / 4 = 0.25 1 1 / 4 = 0.25

school 1 1 / 4 = 0.25 1 1 / 4 = 0.25

is 0 0/4=0 1 1 / 4 = 0.25

amazing 0 0/4=0 1 1 / 4 = 0.25

Step 3: Calculate IDF

Formula for IDF calculation are –

Word Document Frequency IDF Calculation IDF Score

I 1 log(2/1) 0.30

love 1 log(2/1) 0.30

my 2 log(2/2) 0.00

school 2 log(2/2) 0.00

is 1 log(2/1) 0.30
Word Document Frequency IDF Calculation IDF Score

amazing 1 log(2/1) 0.30

Step 4: Calculate TF-IDF Score

Formula for TF-IDF calculation are –

TFIDF(W) = TF(W) * log( IDF(W) )

Word Document 1 TF-IDF Document 2 TF-IDF

I 0.25 x 0.30 = 0.075 0.25 x 0.00 = 0.00

love 0.25 x 0.30 = 0.075 0.25 x 0.00 = 0.00

my 0.25 x 0.00 = 0.00 0.25 x 0.00 = 0.00

school 0.25 x 0.00 = 0.00 0.25 x 0.00 = 0.00

is 0.00 x 0.30 = 0.00 0.25 x 0.30 = 0.075

amazing 0.00 x 0.30 = 0.00 0.25 x 0.30 = 0.075

However, “my” and “school” have the lowest importance (TF-IDF = 0) because
they appear in both documents, making them less unique.

Common questions

Powered by AI

Text normalization in NLP involves transforming raw text into a standardized format to reduce complexity for machine processing . This process includes sentence segmentation, tokenization, removing stopwords and special characters, converting text to a common case, and stemming or lemmatization to produce base word forms . It is crucial because it ensures that variations in text do not mislead computational analysis, aiding in consistency and accuracy in understanding, which is fundamental for effective text analysis and natural language understanding tasks .

Voice assistants like Google Assistant, Siri, and Alexa use Natural Language Processing to understand spoken commands, process the language, and generate suitable responses . NLP enables these devices to convert speech into text (speech recognition), understand the context and intent behind user commands (semantic and pragmatic analysis), and respond accordingly, such as setting alarms or providing information . This involves various NLP tasks, including syntactic parsing, context recognition, and text-to-speech conversion.

Natural Language Processing relies on five main stages to process human language: Lexicon Analysis, Syntactic Analysis, Semantic Analysis, Discourse Integration, and Pragmatic Analysis. Lexicon Analysis involves breaking down text into tokens to understand parts of speech and meanings . Syntactic Analysis checks grammatical structure to form logical relationships . Semantic Analysis finds the meaning behind words and sentences to make logical sense . Discourse Integration examines the relationships within text to understand the overall message . Pragmatic Analysis assesses sentence relevance to deduce the intended message . Together, these stages convert raw text into meaningful information.

Stemming and lemmatization are both techniques used to reduce words to their base forms. Stemming reduces words to their root by removing affixes, often resulting in non-dictionary forms like 'runn' for 'running' . Lemmatization, on the other hand, reduces words to their dictionary form, like 'run,' ensuring the result is a valid word . Stemming might be preferred when speed is crucial and minor accuracy loss is acceptable, while lemmatization is better when correctness and interpretability are important, even if it is computationally more expensive .

Discourse integration in NLP examines how sentences and phrases relate within a text to understand the overall message, accounting for context and continuity in communication . It differs from semantic analysis, which focuses on deriving the literal meaning of individual words and phrases . While semantic analysis provides meaning on a micro-level, discourse integration stitches these meanings together on a macro-level, ensuring that the overall text makes sense as a cohesive unit .

The Bag of Words model facilitates feature extraction by quantifying text data into numerical vectors representing word frequency across a document corpus . It simplifies text processing by focusing on word occurrence while ignoring grammar and word order, allowing machine learning algorithms to process and analyze text data as numerical input. This significance lies in its ability to transform text into a structured form, which is essential for algorithms that require numerical input, thus enhancing tasks like text classification and information retrieval .

Keyword extraction in NLP enhances search engine optimization by identifying and summarizing the most important words and phrases in a document, which helps search engines understand content relevance and improve ranking . The processes involved include tokenization, where text is broken into words and phrases, and statistical analysis methods like TF-IDF to determine the importance of these words within the document. This allows machines to prioritize content based on context, making information retrieval more efficient and accurate .

Sentiment analysis in NLP evaluates the emotional tone behind text in social media and business to determine opinions or sentiments as positive, negative, or neutral . Techniques involved include tokenization, where the text is split into words or phrases, and machine learning models that analyze patterns in the text corresponding to different sentiments. In media monitoring, sentiment analysis helps brands gauge public opinion, track customer satisfaction, and respond to sentiment trends, facilitating real-time decision-making and strategy adjustments .

Smart-bots and script-bots differ primarily in their processing capabilities and adaptability. Smart-bots use AI and machine learning to interpret and learn from user interactions, allowing them to understand vague or complex queries and offer personalized responses . They improve over time with more interactions. Script-bots, however, follow predefined scripts and are limited to specific types of interactions with set responses . Smart-bots are advantageous in dynamic environments requiring adaptability, while script-bots are efficient for predictable scenarios with straightforward requirements.

TF-IDF, or Term Frequency-Inverse Document Frequency, helps identify important words by combining term frequency (the frequency of a word in a document) and inverse document frequency (how common or rare the word is across documents). This method distinguishes words that are common across documents but have specific importance within a single document. In NLP applications, TF-IDF is useful for highlighting terms that are more meaningful for specific tasks like search and information retrieval, since these terms contribute significantly to the content of a document .

You might also like