This post was made public as part of the Data Science Blogathon
Introduction
This post is part of an ongoing blog series on natural language processing (PNL). In the previous post, we discuss some important NLP tasks. I hope that after reading that post you can understand the power of NLP in Artificial Intelligence. Then, in this part of this series, we will begin our discussion on semantic analysis, what is a level of NLP tasks, and we will see all the important terminologies or concepts in this analysis.
This is the part 9 from the blog series on the Step-by-Step Guide to Natural Language Processing.
Table of Contents
1. What is semantic analysis?
- Difference between semantic and lexical analysis
- Two parts of semantic analysis
2. Semantic analysis with Machine Learning
- Disambiguation of the meaning of the word
- Relations extraction
3. Semantic analysis items
- Hiponyms
- Homonimia
- Polisemia
- Synonyms
- Antonio
- Meronomía
4. Representation of meaning
- Building blocks of the semantic system
- Approaches to representations of meaning
- Need for representations of meaning
5. Lexical semantics
- Steps involved in lexical semantics
6. Semantic analysis techniques
- Text classification model
- Text extractor
Semantic analysis
Semantic analysis is the procedure of finding the meaning of the text. This analysis gives computers the power to understand and interpret sentences, paragraphs or full documents, analyzing their grammatical structure and identifying the relationships between individual words of the sentence in a particular context.
Therefore, the goal of semantic analysis is to extract the exact meaning or dictionary meaning from the text. The job of a semantic analyzer is to verify the meaning of the text.
As we have already commented that lexical analysis takes care of the meaning of words, then a question comes to mind:
How is semantic analysis different from lexical analysis?
Lexical analysis is based on smaller tokens but, Conversely, semantic analysis focuses on larger fragments.
Since semantic analysis focuses on larger fragments, we can divide the semantic analysis into the following two parts:
Study the meaning of the individual word
It is the first component of semantic analysis in which we study the meaning of individual words.. This component is known as lexical semantics.
Study the combination of individual words
In this component, we combine individual words to provide meaning to sentences.
NOTE:
As we comment, the most important task of semantic analysis is to find the proper meaning of the sentence.
As an example, consider the next sentence:
Sentence: Ram is great
In the previous sentence, the speaker is speaking of Lord Ram or a person whose name is Ram. This is why the task of obtaining the correct meaning of the sentence is essential..
Sentiment analysis with machine learning
We can make semantic analysis work automatically with the help of machine learning algorithms by feeding semantically enhanced machine learning algorithms with text data samples, we can train machines to make accurate predictions based on their previous results.
Although we implement a semantic approach to machine learning, There are several subtasks involved including
- Disambiguation of the meaning of the word
- Relations extraction.
Let's analyze each of the above tasks one by one in detail.
Disambiguation of the meaning of the word
As we have commented, natural language is ambiguous and polysemic; sometimes, the same word can have different meanings depending on its use in the sentence.
Therefore, in semantic analysis with machine learning, computers use word sense disambiguation to establish what meaning is correct in the given context.
As an example,
Consider the word: Orange
The word above can refer to a color, a fruit or even a city in Florida!
Image source: Google images
Relations extraction
In this homework, we try to detect the semantic relationships present in a text. As usual, relationships involve two or more entities, as people's names, places, company names, etc.
These entities are joined by means of a semantic category, What “works at”, “lives in”, “is the executive director of”, “based in”.
As an example, Consider the next sentence
Phrase: Steve Jobs is the founder of Apple, which is headquartered in California
The above sentence contains two different relationships:


Image source: Google images
Semantic analysis items
Some important items of semantic analysis are the following:
Hiponyms
Represents the link between a generic definition and the instances of that generic term. Here the generic term is known as a hyperonym and its instances are called hyponyms..
As an example,
The word color is hypernym, and the colors blue, yellow, green, etc. are hyponyms.
Homonimia
It can be defined as the words that have the same spelling or the same form but that have different and unrelated meanings.
As an example,
The word “Bat” is a homonymy word.
The previous word is homonymy because a bat can be an implement in two ways:
- To hit a ball
- The bat is also a nocturnal flying mammal.
Polisemia
Polysemy is a Greek word, what does it mean “Many signs”. It is a word or phrase with a different but related meaning. In other words, we can say that polysemy has the same spelling but different and related meanings.
As an example,
The word "Bank" is a Polysemy word.
The word above is a polysemy word that has the following meanings:
- A financial institution.
- The building in which the institution is located.
- A synonym for "trust".
Difference between polysemy and homonymy
Both polysemy and homonymy have the same syntax or spelling, but the main difference between them is that in polysemy, the meanings of the words are related, but in the homonymy, the meanings of the words are unrelated.
As an example, if it's the same word “Bank” as mentioned previously, we can write the meaning as
- ‘A financial institution’ O
- ‘The bank of a river’.
Then, becomes an example of a homonym, since the meanings are not related to each other.
Synonyms
Represents the link between two lexical items in different ways but that express the same or a close meaning.
As an example,
‘author/writer’, ‘fate/destiny'
Antonio
It is the link between two lexical items that have symmetry between their semantic components with respect to an axis. The scope of the antonym is as follows:
Property application or not:
As an example,
‘life/death’, "Certainty / uncertainty"
Scalable property application:
As an example,
‘rich/poor’, ‘hot/cold’
One-use application:
As an example,
‘father/son’, ‘moon/sun’
Meronomía
It is established as the logical arrangement of text and words that denotes a constituent part or member of something.
As an example,
A segment of an orange
Representation of meaning
Semantic analysis creates a representation of the meaning of a sentence. But before delving into the concept and approaches related to the representation of meaning, we must first understand the basic components of the semantic system.
Building blocks of the semantic system
While they represent the meaning of the words, the following building blocks play an important role:
Entities
Represents the individual, as a particular organization, Location, name of the people, etc.
As an example,
Punjab, China, Chirag, Kshitiz all are entities.
Concepts
Represents the general category of individuals as a person, town, etc.
Relations
Represents the link between entities and concepts.
As an example,
Sentence: Ram is a person
Predicates
Represents the verbal structures.
As an example,
Semantic roles and Case Grammar
Now, we have a brief idea of the representation of meaning that shows how to put together the basic components of semantic systems. In other words, shows how to join entities, concepts, relationships and predicates to describe a situation. It also makes it possible to reason about the semantic world.
Approaches to representations of meaning
Semantic analysis uses the following approaches to the representation of meaning:
- First-order predicate logic (FOPL)
- Semantic networks
- Marcos
- Conceptual dependency (CD)
- Rules-based architecture
- Case grammar
- Concept graphics
Need for representations of meaning
The reasons behind the need for representation of meaning are as follows:
Linking of linguistic items to non-linguistic items
With the help of the representation of meaning, we can link linguistic items with non-linguistic items.
Representing variety at the lexical level
With the help of the representation of meaning, we can unambiguously represent canonical forms at the lexical level.
Can be used to reason
Representation of meaning can be used for reasoning to verify what is correct in the world, as well as to extract knowledge with the help of semantic representation.
Lexical semantics
It is the first part of the semantic analysis, in which we study the meaning of individual words. Include words, subpalabras, afias (subunits), compound words and also phrases. All the words, subpalabras, etc. are collectively known as lexical items.
In simple words, we can say that lexical semantics represents the link between lexical items, the meaning of sentences and sentence syntax.
The steps that we have to follow when doing lexical semantics are the following:
- Classification of lexical items.
- Lexical item decomposition.
- In addition, the differences are analyzed, as well as the similarities between various lexical-semantic structures.
Semantic analysis techniques
We can use either of the two semantic analysis techniques below depending on the type of information you would like to obtain from the data provided..
- text classification model(which assigns predefined categories to text)
- text extractor (that extracts particular information from the text).
Semantic classification models
Classification of topics
Based on content, This model sort the text into predefined categories. In a company, customer service teams may want to categorize support tickets as they enter their help desk and, according to category, they will distribute the work.
With the help of semantic analysis, machine learning tools can recognize a ticket as a “Payment problem” or a“Shipping problem”.
Sentiment analysis
In sentiment analysis, our goal is to detect emotions like positive, negative or neutral in a text to denote urgency.
As an example, Tag Twitter mentions by sentiment to get an idea of how customers are feeling about your product and to be able to identify dissatisfied customers in real time.
Classification by intention
We can classify the text according to the requirements of the new user.
You can use these types of templates to label your sales emails as “Interested” O “Not interested” to proactively reach users who want to try your product.
Semantic extraction models
Keyword extraction
It is used for find relevant words and expressions in a text. This technique is used separately or can be used in conjunction with one of the above methods to gain more valuable information..
As an example, it could analyze the keywords in a bunch of tweets that have been categorized as "negative" and detect which words or topics are mentioned the most frequently.
Entity extraction
The idea of entity extraction is identify named entities in text, as people's names, companies, places, etc.
This can be useful for a customer service team to automatically extract product names, shipping numbers, emails and any other relevant data from customer support tickets.
This ends our Part 9 from the blog series on natural language processing!
Other blog posts of mine
You can also check out my previous blog posts.
Past Data Science Blog Posts.
Here it is my Linkedin profile in case you want to connect with me. I will be happy to be connected with you.
For any query, can you send me an email at Gmail.
Final notes
Thank you for reading!
I hope you liked the post. If you like, share it with your friends also. Anything not mentioned or do you want to share your thoughts? Feel free to comment below and I'll get back to you. 😉
The media shown in this post is not the property of DataPeaker and is used at the author's discretion.



