In the past couple of months, I have been knee-deep into NLP so much that I decided to write this article to share all my learnings about how to leverage NLP to learn more about your customers and do better marketing.
But, I cannot write about NLP (Natural Language Processing) without mentioning Alan Turing first. So, to give this article the proper justice, let’s start there.
Born in 1912, Alan Turing was a mathematician, logician, and computer scientist who left a massive mark on the world of technology.
At a time when computers were still in their infancy and the world was grappling with the atrocities of war, Turing’s brilliance stood out. His foundational work on computable numbers and algorithms laid the groundwork for what we now know as modern computing.
During World War II, Turing’s ingenuity found its calling at Bletchley Park, where he spearheaded efforts to crack the Enigma code used by the Axis forces. This endeavor was no small feat. His team’s success in decrypting encrypted messages was pivotal in altering the war’s course.
Beyond his wartime contributions, Turing’s theoretical ponderings extended to the concept of machine intelligence. He posed a question that continues to resonate in our discussions today: Can machines think like humans? This question, known as the “Turing test,” set the stage for exploring artificial intelligence in the years to come.
AI History Crash-Course
In the first half of the 20th century, science fiction familiarized the world with the concept of artificially intelligent robots. It began with the “heartless” Tin man from the Wizard of Oz and continued with the humanoid robot that impersonated Maria in Metropolis. By the 1950s, we had a generation of scientists, mathematicians, and philosophers with the concept of artificial intelligence (or AI) culturally assimilated in their minds. One such person was Alan Turing, a young British polymath who explored the mathematical possibility of artificial intelligence. Turing suggested that humans use available information as well as reason in order to solve problems and make decisions, so why can’t machines do the same thing? This was the logical framework of his 1950 paper, Computing Machinery and Intelligence in which he discussed how to build intelligent machines and how to test their intelligence.
The History of Artificial Intelligence – Harvard Business School
Turing said, “Hey if humans can use information and reason to solve problems, why can’t machines do the same thing?” This was the central theme of his paper, “Computing Machinery and Intelligence,” written in 1950.
But there were obstacles. Computers needed some upgrades; they couldn’t store commands back then; they could only follow them. Plus, they were very costly to use. The turning point came in 1956 at a conference called the Dartmouth Summer Research Project on Artificial Intelligence.
From the late 1950s to 1974, AI had a golden era. Computers became more affordable, and people started making programs that could solve problems and even understand spoken language. There was a lot of excitement and government funding to fuel this progress.
However, AI’s grand goals hit some roadblocks. Computers didn’t have enough power to understand language or tackle complex problems properly. The 1980s brought new ideas like “deep learning” and systems that mimicked human experts, but the ultimate AI dream was still a way off.
The 1990s marked a significant moment. AI was back in the spotlight with big achievements like IBM’s computer defeating a chess champion and speech recognition technology becoming a reality. But as the years went by, AI had its ups and downs. It wasn’t until we hit the age of “big data” that AI started to shine, especially in industries like technology, banking, and marketing.
Key Knowledge
What is Natural Language Processing (NLP)?
Fast forward to today, and we find Turing’s legacy alive and well in Natural Language Processing. AI is getting REALLY good at understanding language.
This field helps machines understand, interpret, and generate human language, a capability changing how we interact with technology. Turing’s early insights into computation and machine intelligence have laid the foundation for NLP’s capabilities, enabling machines to comprehend and communicate with us in ways that were once the stuff of science fiction.
Natural language it’s just the languages humans use (English, German, Hindu, etc.) to express thoughts, feelings, and ideas. It involves words, grammar, and cultural context to convey meaning effectively.
In AI and linguistics, natural language processing (NLP) is a field that makes computers understand, interpret, and generate human language.
NLP acts as a bridge between human communication and computational analysis, allowing machines to work with both written and spoken natural language. This capability leads to various applications, ranging from chatbots and virtual assistants to sentiment analysis and language translation.
I was officially introduced to NLP and its capabilities back in late 2021 by Milly KC and Mike Robins when together with them, we recorded a demo to showcase how you can do Sentiment Analysis in Google Sheets using Natural Language Processing.
Since that demo, I have spent a lot of time researching natural language, linguistics, and natural language processing APIs and how to use these tools for better marketing.
I hope this article will inspire you to apply these tactics to your day-to-day work and improve your research and data analysis.
Key Knowledge
We cannot talk about NLP without quickly mentioning LLMs – Large Language Models. Why? Because you are probably using one almost every day, either for work, fun, or for cringy LinkedIn posts.
A large language model (LLM) is an AI-powered system that has been trained on vast amounts of text data to acquire language-related knowledge and generate human-like responses. These models utilize deep learning techniques, particularly a type of neural network called a transformer, to process and comprehend language patterns. With their massive size and extensive training, these models possess a remarkable capacity for understanding and generating text.
Large language models like GPT-3.5 are designed to be versatile and adaptive. They can perform a wide range of language-related tasks, including text completion, translation, summarization, sentiment analysis, question answering, and even creative writing. These models excel in natural language understanding, allowing them to comprehend complex queries and produce accurate and meaningful responses.
Source: Iguazio
Essential Concepts in Natural Language Processing
As soon as you start digging deeper into this field, there will be many new concepts and terms you will have to understand. Below I have made a table of the most used ones and the ones I have encountered in my research and work. I will link a trustworthy source on each concept below so you can expand your learning further.
The table reads best on a desktop (sorry about that)
Concept | Explanation | Application |
---|---|---|
Tokenization | Breaking text into smaller units, such as words or phrases, to analyze or process them individually. | Text analysis, language understanding |
Part-of-Speech (POS) Tagging | Language Translation | Syntax analysis, language understanding |
Named Entity Recognition (NER) | Identifying and classifying specific entities (such as names, dates, locations) in text, providing context and enhancing understanding. | Information extraction, entity analysis |
Sentiment Analysis (SA) | Determining the emotional tone of a text, whether positive, negative, or neutral, to gauge public opinion or sentiment towards a subject. | Social media monitoring, reviews analysis |
Machine Translation | Converting spoken language into written text allows machines to understand and process spoken words. | Automatically translating text from one language to another enabling cross-lingual communication. |
Natural Language Generation (NLG) | Creating coherent and contextually relevant text, often used in chatbots or automated content creation. | Chatbots, content creation |
Syntax Parsing | Analyzing the grammatical structure of a sentence to understand relationships between words and phrases. | Parsing sentences, language understanding |
Speech Recognition | Converting spoken language into written text allows machines to understand and process spoken words. | Voice assistants, transcription |
Coreference Resolution | Identifying when two or more words or phrases refer to the same entity in a text, ensuring proper comprehension. | Text coherence, information extraction |
Word Embeddings | Mapping words or phrases to numerical vectors, capturing semantic relationships, and enhancing machine understanding of context. | Semantic analysis, language modeling |
Sentiment Analysis
Being in tune is one of the most important things to me as a technical marketer.
Being in tune with my clients that I consult, being in tune with the market, being in tune with the products, and ultimately, being in tune with the voice of the customer. So when I took upon the challenge of rebuilding the experimentation services for my current employer, Media Monks, marrying experimentation and data science was a no-brainer for me.
By joining forces with the experts in this field like Julien Coquet, Krassimir Bambalov, and Gonzalo Hernandez, I knew we would deliver clients better research data and better data analysis that can fuel evidence-based experimentation programs. (PS: I couldn’t ask for a better team and a better inspiration than these guys. Thank you)
Doing Sentiment Analysis was our first project working together, and it quickly expanded and evolved into semantic analysis as we became more knowledgeable of the datasets we used.
But, before we dig deeper into why you should care about this and how you should employ this technique in your own business or with your clients, let’s align on some fundamental knowledge.
While there isn’t a single “first” instance of sentiment analysis, its roots can be traced back to research and academic papers from the 2000s.
The field has evolved with more advanced machine-learning techniques, larger datasets, and improved language models. Sentiment analysis is now widely used in various industries for brand monitoring, customer feedback analysis, social media monitoring, and more.
Sentiment analysis is a natural language processing (NLP) technique that involves the application of machine learning and text analysis to decipher the sentiment expressed in textual data. This technique leverages a combination of linguistic patterns, contextual understanding, and machine learning algorithms to determine whether a given piece of text carries a positive, negative, or neutral sentiment.
To break it down further: Imagine a dataset of customer reviews or social media posts. Sentiment analysis algorithms dissect the text, examining individual words, phrases, and grammatical structures. By associating these linguistic elements with pre-labeled sentiments from a training dataset, the algorithm learns to recognize patterns corresponding to different emotional tones.
For example, let’s consider product reviews. The project I mentioned above was about analyzing 500k app reviews available on the AppStore and Google PlayStore.
The sentiment analysis model assesses the language used in each review, identifying keywords and expressions that indicate positive sentiments like ‘amazing,’ ‘excellent,’ or negative emotions like ‘disappointing’ and ‘frustrating.’ It then computes a sentiment score based on the prevalence of such terms and their emotional associations.
Example:
The Sentiment Analysis feature of the Google Cloud Natural Language Processing (NLP) analyzes the sentiment expressed in a given text, determining whether it is positive, negative, or neutral. It uses machine learning algorithms to understand the overall sentiment and emotion conveyed in the text, providing a sentiment score and magnitude.
The API can analyze the sentiment expressed in the text and classify it as positive=1, negative=-1, or neutral=0. Additionally, the API provides a magnitude score that quantifies the intensity of the sentiment.
In practical business scenarios, sentiment analysis can quickly become indispensable.
For instance, when we launch a new product feature, we can apply sentiment analysis to customer feedback. By analyzing the sentiment in these reviews, we gain insights into how well-received the feature is and whether adjustments are necessary.
Also, sentiment analysis is invaluable for monitoring brand perception, gauging customer satisfaction, and surfacing actionable insights from unstructured text data.
Is Sentiment Analysis Enough? Well, no. Enter Semantic Analysis.
While sentiment analysis offers valuable insights into the emotional tone of the text, it also has limitations. And as mentioned, we understood that as soon as we got deeper into the data, and were able to identify a lot more opportunities in it. Remember, our project was about analyzing 500k reviews on the AppStore and Google PlayStore.
The primary goal of sentiment analysis is to gauge the sentiment behind the words, whether they indicate positive feedback, negative criticism, or a neutral stance.
Semantic analysis, on the other hand, is a broader concept. It involves understanding the meaning of a text beyond just its individual words. Semantic analysis aims to comprehend the relationships between words, phrases, and sentences to grasp the deeper context and intent of the text. This can include identifying entities (e.g., people, places), relationships, concepts, and the text’s overall structure.
The possibilities within Semantic Analysis are endless
One of the fascinating aspects of semantic analysis is its ability to identify and classify named entities within the text. Named entities can include names of people, places, dates, organizations, and more.
This capability I mentioned above in Essential NLP Concepts, Entity Recognition (NER), contributes to a deeper understanding of the context and connections in the text.
For instance, imagine analyzing news articles about a company’s financial performance. Semantic analysis with NER not only deciphers sentiments but also pinpoints mentions of key economic indicators or market trends.
This enriched analysis empowers businesses to gain insights beyond the surface sentiment, enabling more informed strategic decisions.
Another direction you can go in Semantic Analysis is using Zero-Shot Classification.
Zero-shot text classification is a task in natural language processing where a model is trained on a set of labeled examples but is then able to classify new examples from previously unseen classes.
HuggingFace – Zero-Shot Classification
Zero-shot classification extends the prowess of semantic analysis by allowing us to venture beyond predefined labels. It’s like having a text detective that can explore new territories of information and still make informed judgments.
This dynamic of semantic analysis and zero-shot classification surfaces new dimensions of text understanding.
Returning to my reviews project, let’s reimagine the use case of analyzing reviews about a new product launch.
Semantic analysis deciphers sentiments and topics, while zero-shot classification takes it further by predicting how customers categorize these reviews. This dual approach enables us to fine-tune strategies based on a multi-dimensional understanding of customer feedback.
Example:
Result after using Zero-Shot Classification Model from HuggingFace:
(PS: you can test this through the interface too, but keep in mind A LOT of people do this on the interface, so sometimes you will get the “overloaded” message. Using the code won’t create the same issues.)
The zero-shot model enables data classification not used during the model’s training process. It is beneficial for cases where labeled data is insufficient for inference.
You can specify custom labels and utilize a classifier to assign a probability to each label.
Key Knowledge
The table reads best on a desktop (sorry about that)
Name | Description | Application |
---|---|---|
Zero-Shot Classification | Making predictions for text categories not seen during training, using the model’s understanding of relationships. | Categorizing text into various topics, even those not explicitly covered during training. |
Multi-Class Classification | Assigning a single category label from multiple predefined categories to a given piece of text. | Chatbots, virtual assistants, and understanding user input for better interaction. |
Multi-Label Classification | Assigning multiple category labels from predefined categories to a single piece of text. | Tagging content with relevant topics or attributes, such as news categorization. |
Hierarchical Classification | Document categorization, sentiment analysis, and topic classification. | Organizing content in a hierarchical manner, such as classifying products in e-commerce. |
Binary Classification | Assigning one of two possible categories to a given piece of text. | Spam detection, sentiment analysis (positive/negative), binary sentiment classification. |
Intent Classification | Identifying the user’s intention or purpose behind a query or sentence. | Social media monitoring, understanding user sentiment, and customer feedback analysis. |
Emotion Classification | Determining the emotional tone or sentiment expressed in text. | Analyzing customer reviews, gauging public sentiment, and brand perception analysis. |
Sentiment Classification | Assigning labels indicating positive, negative, or neutral sentiment to text. | Analyzing customer reviews, gauging public sentiment, brand perception analysis. |
NLP Tool Stack
As with any tool in general, I will plead the marketing classic “It depends.”
I’ve been saying this for the longest; the tools are just a boat that transports us to a destination, but we are still responsible for understanding the journey, the obstacles, and the nuances of it.
Back to my example with the reviews, let’s go over what the tool stack looks like.
First, you have data collection; in my case, we are collecting the reviews from AppStore and Google PlayStore through a third-party review collection tool.
Using that tool’s API, we are sending the reviews in Google Cloud Platform – GCP (but not before we strip them entirely of personal information like names, locations, etc. Even if they are publicly available in the AppStore/Google PlayStore, on this note, you might want to check Cloud DLP out).
Once the reviews are in GCP, we transform the data using Cloud Functions and BigQuery. Once data is transformed, we use VertexAI and NLP API to perform Sentiment Analysis. Then we can use HuggingFace’s capabilities to perform complaint classification and unmet needs prediction, for example.
Then you can visualize the analysis result using Looker Studio or simple Google Sheets.
Once you have the analysis results, you can activate this data through advertising campaigns, ab testing, brand marketing, and product marketing – but also to improve your products, services, messaging, positioning, and operations.
The benefits are endless.
Main business applications of NLP
Now that we’ve covered the intricacies of Natural Language Processing (NLP) and its various concepts let’s turn our attention to the practical applications that make this technology a game-changer for businesses.
Just as sentiment analysis has revolutionized our understanding of customer emotions, semantic analysis and other NLP techniques have opened doors to many applications across industries.
Enhancing Customer Insights and Engagement in B2B
In B2B, NLP redefines how companies understand and engage with their clients. Companies can extract valuable insights from the vast amounts of unstructured data by applying NLP to communication streams, such as email conversations and support tickets.
These insights empower businesses to identify pain points, track sentiment trends, and tailor their services to meet client’s evolving needs.
Imagine receiving real-time alerts when a client expresses dissatisfaction or detecting potential cross-selling opportunities through nuanced email conversations. NLP equips B2B marketers and account managers with a strategic advantage by ensuring that each interaction is informed, personalized, and, ultimately, more successful.
Elevating Ecommerce and Personalization
In ecommerce understanding customer behavior and preferences is paramount.
NLP-driven solutions enable ecommerce platforms to analyze product reviews, customer feedback, and browsing patterns to discern buying patterns and sentiments.
By harnessing these insights, businesses can optimize product recommendations, refine marketing strategies, and improve the customer experience.
Think of product recommendation engines based on past purchases and the sentiment expressed in customer reviews. Integrating NLP into your ecommerce strategies allows you to create a more intuitive and personalized shopping journey ripe for customer loyalty and profitability.
Empowering Content Marketing and SEO
NLP’s power extends to content marketing and search engine optimization (SEO) strategies. With semantic analysis, businesses can go deeper into the contextual relationships between keywords and phrases, enabling them to create content that resonates deeply with their target audience. (your data source can even be the Search Console).
NLP tools can assist in identifying trending topics, analyzing competitors’ content, and gauging the sentiment surrounding industry discussions. By leveraging these insights, marketers can craft content that addresses customers’ concerns and aligns with their emotional triggers.
Plus, businesses can improve their search engine rankings and visibility by optimizing website content with relevant keywords identified through NLP, driving organic traffic and engagement.
Better Decision-Making
In the grander scheme, NLP acts as a unifying force, bridging the gap between unstructured data and actionable insights.
Businesses can gain a holistic view of their operations by applying NLP techniques to a spectrum of data sources, from customer feedback and social media conversations to financial reports and market trends.
This unified perspective equips decision-makers with the tools to effectively refine strategies, anticipate market shifts, and respond to customer needs. NLP-enhanced analytics and dashboards consolidate data streams into applicable findings, enabling faster and more informed decisions across the organization.
Conclusions
And there you have it: We’ve started from Alan Turing’s innovative insights to the intricate techniques that decipher the language we use daily.
We’ve learned that NLP isn’t just about algorithms and technicalities. It’s about understanding people, their feelings, and their intentions. Like how we understand emotions with sentiment analysis, NLP helps us dive even deeper into the meaning behind words.
Think of NLP as your guide in the realm of human language. It’s like having a trusty companion that can analyze emails, reviews, and conversations to reveal insights you might have missed otherwise. Imagine using it to fine-tune your marketing strategies, create personalized shopping experiences, and make decisions that resonate with your audience.
NLP is your friend in ecommerce, content creation, and customer relationships. It lets you uncover the stories hidden in words, helping you connect with people on a whole new level. With NLP, you’re not just looking at text; you’re exploring the very essence of communication.
So, as you embark on your journey armed with NLP knowledge, remember that it’s more than just a tool. It’s a bridge that brings you closer to your customers, data, and goals.
Massively recommended learning: Generative AI Learning Path from Google Cloud Skills Boost.
If you liked this article, don’t forget to share it with your network.