Text Analysis
Text Analysis
Table of Contents
1 Sentimental Analysis 2
2 Analysis of Readability 3
5 Word Count 3
7 Personal Pronouns 4
1 | Page
1 Sentimental Analysis
Sentimental analysis is the process of determining whether a piece of writing is positive,
negative, or neutral. The below Algorithm is designed for use in Financial Texts. It consists
of steps:
The Stop Words Lists (found in the folder StopWords) are used to clean the text so that
Sentiment Analysis can be performed by excluding the words found in Stop Words List.
The Master Dictionary (found in the folder MasterDictionary) is used for creating a
dictionary of Positive and Negative words. We add only those words in the dictionary if they
are not found in the Stop Words Lists.
We convert the text into a list of tokens using the nltk tokenize module and use these tokens
to calculate the 4 variables described below:
Positive Score: This score is calculated by assigning the value of +1 for each word if found
in the Positive Dictionary and then adding up all the values.
Negative Score: This score is calculated by assigning the value of -1 for each word if found
in the Negative Dictionary and then adding up all the values. We multiply the score with -1
so that the score is a positive number.
Polarity Score: This is the score that determines if a given text is positive or negative in
nature. It is calculated by using the formula:
Polarity Score = (Positive Score – Negative Score)/ ((Positive Score + Negative Score) +
0.000001)
Range is from -1 to +1
Subjectivity Score: This is the score that determines if a given text is objective or subjective.
It is calculated by using the formula:
2 | Page
Subjectivity Score = (Positive Score + Negative Score)/ ((Total Words after cleaning) +
0.000001)
Range is from 0 to +1
2 Analysis of Readability
Analysis of Readability is calculated using the Gunning Fox index formula described below.
Percentage of Complex words = the number of complex words / the number of words
Average Number of Words Per Sentence = the total number of words / the total number of
sentences
5 Word Count
We count the total cleaned words present in the text by
3 | Page
6 Syllable Count Per Word
We count the number of Syllables in each word of the text by counting the vowels present in
each word. We also handle some exceptions like words ending with "es","ed" by not counting
them as a syllable.
7 Personal Pronouns
To calculate Personal Pronouns mentioned in the text, we use regex to find the counts of the
words - “I,” “we,” “my,” “ours,” and “us”. Special care is taken so that the country name US
is not included in the list.
4 | Page