Text analysis is a popular tool in Digital PR. Here are a few different ways you can analysis text.
Counting words
Counting instances of words in text can be useful for answering questions such as 'which artist swears the most', or 'which politician is most obsessed with money'.
If you don't have too much text to analyse, you can use Excel or Google Sheets with simple formulas.
For example here's a Google Sheet formula that will count how many times the word 'Friday' appears in a cell:
= (LEN(A1) - LEN(SUBSTITUTE(A1, "Friday", ""))) / LEN("Friday")
Where A1 is your text.
To count multiple words, you can create a list of keywords in separate cells and then use an array formula like this:
=SUM(ARRAYFORMULA((LEN(A1) - LEN(SUBSTITUTE(LOWER(A1), LOWER(B1:B7), ""))) / LEN(B1:B7)))
Where A1 is your text and B1:B7 contains your keywords.
If you want to be more efficient, you could also use a Google Sheet script:
If you have too much text to process in just Google Sheets or Excel, or want you to detect more nuanced references to your topic that don't use direct keywords, you will have to look at using python and a tool like Google's Cloud Natural Language API.
Unique Vocabulary
Another type of campaign you will see is, 'which children's TV show has the biggest vocabulary'. To answer this question you simply need to count the number of unique words in your test sample.
Jere's a Google Sheets formula that will count the number of unique words in a cell:
=COUNTA(UNIQUE(SPLIT(LOWER(A1), " ")))
Where A1 contains your text.
Again, f you have too much text to process in just Google Sheets or Excel, you will have to look at using python.
Sentiment Analysis
There are lots of ways of doing sentiment analysis, with using Sentistrength being a common option (more on this later). But if you don't want to download it / go through the process of learning how to use it and you don't have too much text, you can also use Google Sheets.
Using Google Sheets with AI Integration
You can use a chat GPT integrated sheet to determine sentiment.
This is best for short, simple texts and simple analysis like 'happy' and 'sad', 'positive' and 'negative', or 'stressed' and 'not stressed'.
Here's an example video:
Here is a link to the Google Sheet I'm using: https://docs.google.com/spreadsheets/d/19uTGeVs_li8RpuVMm5eGlB-gt0buE3QBFJ3N6e0hvXY/edit?usp=sharing
Note if you don't have a Chat GPT account, you can use a ready made AI Google Sheet integration such as this one: https://text2data.com/Google-Sheets
(I have not tested this, and I'm sure there are lots of similar products out there for you to explore).
Using the NRC Word-Emotion Association Lexicon (aka EmoLex) in Google Sheets
You will see this lexicon mentioned a lot - it's a list of words which have been categorised according to their emotions. You can use it to assign each word in a text an emotion, and then see which emotion is more prevalent in the text.
It's a popular option because it categorises words into positive and negative, as well as eight basic emotions (anger, anticipation, disgust, fear, joy, sadness, surprise, and trust), allowing you to do a more in depth sentiment analysis.
You can download the lexicon from here.
Once you have, you can integrate it into whatever text analysis method you're using (e.g. python or Google sheets, etc).
Here and example of using it in Google Sheets:
Other sentiment analysis tools
Here are some more options for doing sentiment analysis:
SentiStrength: Sentistrength is a downloadable software you can use for sentiment analysis (note it's made for use on Windows machines, but will work with a crossover software). It's self contained, or you can integrate it with things like python. It focuses on rating text on how positive or negative a text is.
VADER (Valence Aware Dictionary and sEntiment Reasoner): Another lexicon similar to the NRC but designed specifically for social media texts, so includes lots of emojis. It also focuses just on how positive or negative a text is. You can download it here, or use it directly within python.
Google Cloud Natural Language API: Google Cloud Natural Language API offers a comprehensive set of NLP services, including sentiment analysis. It’s a cloud-based service with extensive documentation, which allows you to analyze the sentiment of text, detect entities, analyze syntax, and more. The API requires integration, meaning you need to set up a project in the Google Cloud Console, enable the API, and use authentication keys to access it.