Git Product home page Git Product logo

acm-research-coding-challenge-f21's Introduction

Approach

After splitting the input text into sentences using regular expressions, I used the pre-trained sentiment analyzer VADER from the Natural Language Toolkit (NLTK) in order to analyze each sentence. I took the "compound" value from each analysis, which is a score from -1 to 1 that summarizes the values for negative, neutral, and positive sentiment. Finally, I took the weighted average of the sentiment scores based on the number of characters in each sentence, which gave me a score for the input text as a whole.

Conclusion

The average sentiment score of the input text is about 0.366, where a value closer to -1 represents negative sentiment and a value closer to 1 represents positive sentiment. This means that the text has an overall positive sentiment. You can view the sentiment scores for each sentence in sentiment_scores.txt.

When I first read the input text, I predicted that its sentiment would be a bit closer to negative, just based off the general negative tone the text gave off to me, especially in the first paragraph. For example, two excerpts that stand out from this paragraph include You towered with rage, yelled quotes at me. and Carcasses bleed at the sight of the murderer. However, the second paragraph does spend a lot of time on the topic of the many good qualities of some man, which could contribute in the positive direction to the text's sentiment.

I decided to visualize this shift in sentiment using a scatterplot graph, where the x-axis represents how far along in the text each sentence is and the y-axis represents the score of each sentence.

scatterplot of sentence position versus sentiment score

As the figure shows, the sentiment scores towards the end of the text are much more positive than those earlier in the text, and so we can conclude it's primarily the second paragraph which brings the overall sentiment score up.

Evaluation

One issue with my approach is that VADER was not trained for sentences from fictional literature, but rather short texts from social media. This could lower the accuracy of the sentiment evaluations because that the model isn't used to the kind of language used in literature. One way to improve this aspect of my approach could be to develop and train my own sentiment analyzer using a corpus of older fiction.

Resources Used

acm-research-coding-challenge-f21's People

Contributors

bryanth24 avatar romanhauksson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.