<p>There are going to be two main approaches:</p>
<ul>
<li>the one you have started, which is a list of emotional words, and counting how often they appear</li>
<li>showing examples of what you consider emotional sentences and what are unemotional sentences to a machine learning model, and let it work it out.</li>
</ul>
<p>The first way will get better as you give it more words, but you will eventually hit a limit. (Simply due to the ambiguity and flexibility of human language, e.g. while &quot;you&quot; is more emotive than &quot;it&quot;, there are going to be a lot of unemotional sentences that use &quot;you&quot;.)</p>
<blockquote>
<p>any suggestions on how I can extract emotional words from wordnet?</p>
</blockquote>
<p>Take a look at sentiwordnet, which adds a measure of positivity, negativity or neutrality to each wordnet entry. For &quot;emotional&quot; you could extract just those that have either pos or neg score over e.g. 0.5. (Watch out for the non-commercial-only licence.)</p>
<p>The second approach will probably work better <em>if</em> you can feed it enough training data, but &quot;enough&quot; can sometimes be too much. Other downsides are the models often need much more compute power and memory (a serious issue if you need to be offline, or working on a mobile device), and that they are a blackbox.</p>
<p>I think the 2020 approach would be to start with a pre-trained BERT model (the bigger the better, see <a href="https://arxiv.org/abs/2005.14165" rel="nofollow noreferrer">the recent GPT-3 paper</a>), and then fine-tune it with a sample of your 100K sentences that you've manually annotated. Evaluate it on another sample, and annotate more training data for the ones it got wrong. Keep doing this until you get the desired level of accuracy.</p>
<p>(Spacy has support for both approaches, by the way. What I called fine-tuning above is also called transfer learning. See <a href="https://spacy.io/usage/training#transfer-learning" rel="nofollow noreferrer">https://spacy.io/usage/training#transfer-learning</a> Also googling for &quot;spacy sentiment analysis&quot; will find quite a few tutorials.)</p>
Emotional score of sentences using Spacy
<p>I have a series of 100.000+ sentences and I want to rank how emotional they are.</p>
<p>I am quite new to the NLP world, but this is how I managed to get started (adaptation from <a href="https://spacy.io/usage/spacy-101" rel="nofollow noreferrer">spacy 101</a>)</p>
<pre><code>import spacy
from spacy.matcher import Matcher

matcher = Matcher(nlp.vocab)

def set_sentiment(matcher, doc, i, matches):
    doc.sentiment += 0.1

myemotionalwordlist = ['you','superb','great','free']

sentence0 = 'You are a superb great free person'
sentence1 = 'You are a great person'
sentence2 = 'Rocks are made o minerals'

sentences = [sentence0,sentence1,sentence2]

pattern2 = [[{&quot;ORTH&quot;: emotionalword, &quot;OP&quot;: &quot;+&quot;}] for emotionalword in myemotionalwordlist]
matcher.add(&quot;Emotional&quot;, set_sentiment, *pattern2)  # Match one or more emotional word

for sentence in sentences:
    doc = nlp(sentence)
    matches = matcher(doc)

    for match_id, start, end in matches:
        string_id = nlp.vocab.strings[match_id]
        span = doc[start:end]
    print(&quot;Sentiment&quot;, doc.sentiment)
</code></pre>
<p>myemotionalwordlist is a list of about 200 words that Ive built manually.</p>
<p>My questions are:</p>
<p>(1-a) Counting the number of emotional words does not seem like the best approach. Anyone has any suggetions of a better way of doing so?</p>
<p>(1-b) In case this approach is good enough, any suggestions on how I can extract emotional words from wordnet?</p>
<p>(2) Whats the best way of escalating this? I am thinking about adding all sentences to a pandas data frame and then applying the match function to each one of them</p>
<p>Thanks in advance!</p>