sentimentpy

A Python port of the #rstats sentimentr package

https://github.com/trinker/sentimentpy

Science Score: 18.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.5%) to scientific vocabulary

Keywords

emotion nlp polarity sentiment text-mining
Last synced: 6 months ago · JSON representation ·

Repository

A Python port of the #rstats sentimentr package

Basic Info
  • Host: GitHub
  • Owner: trinker
  • Language: Python
  • Default Branch: master
  • Size: 139 KB
Statistics
  • Stars: 10
  • Watchers: 4
  • Forks: 3
  • Open Issues: 0
  • Releases: 0
Topics
emotion nlp polarity sentiment text-mining
Created over 7 years ago · Last pushed over 7 years ago
Metadata Files
Readme License Citation

README.rst

sentimentpy
===========

.. image:: https://www.repostatus.org/badges/latest/wip.svg
   :alt: Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.
   :target: https://www.repostatus.org/#wip
    
.. image:: https://img.shields.io/travis/trinker/sentimentpy/master.svg?style=flat-square&logo=travis
    :target: https://travis-ci.org/trinker/sentimentpy
    :alt: Build Status
    
.. image:: bin/sentimentpy_logo/py_sentimentpyb.png
    :alt: Module Logo
    


    
**sentimentpy** is designed to quickly calculate text polarity sentiment at the sentence level.  The user can aggregate these scores by grouping variable(s) using built-in aggregate functions.  


**sentimentpy** (a Python port of the R `sentimentr package `_) is a response to my own needs with sentiment detection that were not addressed by the current **R** tools.  My own `polarity` function in the R **qdap** package is slower on larger data sets.  It is a dictionary lookup approach that tries to incorporate weighting for valence shifters (negation and amplifiers/deamplifiers).  Matthew Jockers created the `syuzhet `_ R package that utilizes dictionary lookups for the Bing, NRC, and Afinn methods as well as a custom dictionary.  He also utilizes a wrapper for the `Stanford coreNLP `_ which uses much more sophisticated analysis.  Jocker's dictionary methods are fast but are more prone to error in the case of valence shifters.  Jocker's `addressed these critiques `_ explaining that the method is good with regard to analyzing general sentiment in a piece of literature.  He points to the accuracy of the Stanford detection as well.  In my own work I need better accuracy than a simple dictionary lookup; something that considers valence shifters yet optimizes speed which the Stanford's parser does not.  This leads to a trade off of speed vs. accuracy.  Simply, **sentimentpy** attempts to balance accuracy and speed.


Installation
============


Currently, this is a GitHub package.  To install use:

``pip install git+https://github.com/trinker/sentimentpy``


Sentence Splitting
==================

::
       
    import sentimentpy.split_sentences as ss
    
    s = [
        ' I like you.  P.S. I like carrots too mrs. dunbar. Well let\'s go to 100th st. around the corner.   ', 
        'Hello Dr. Livingstone.  How are you?', 
        'This is sill an incomplete thou.'
        
    ]
    
    ss.split_sentences(s)

::
    
   ['I like you.',
     'P.S. I like carrots too mrs. dunbar.',
     "Well let's go to 100th st. around the corner.",
     'Hello Dr. Livingstone.',
     'How are you?',
     'This is sill an incomplete thou.']
   
::
    
    x = [
        " ".join(
            ["Mr. Brown comes! He says hello. i give him coffee.  i will ",
            "go at 5 p. m. eastern time.  Or somewhere in between!go there"
        ]),
        " ".join(
            ["Marvin K. Mooney Will You Please Go Now!", "The time has come.",
            "The time has come. The time is now. Just go. Go. GO!",
            "I don't care how."
        ])
    ]
    
    ss.split_sentences(x)

::
    
    ['Mr. Brown comes!',
     'He says hello.',
     'i give him coffee.',
     'i will  go at 5 p.m. eastern time.',
     'Or somewhere in between!',
     'go there',
     'Marvin K. Mooney Will You Please Go Now!',
     'The time has come.',
     'The time has come.',
     'The time is now.',
     'Just go.',
     'Go.',
     'GO!',
     "I don't care how."]    

Owner

  • Name: Tyler Rinker
  • Login: trinker
  • Kind: user
  • Location: Buffalo, NY
  • Company: Anthology

Director, Data Scientist, open-source developer , #rstats enthusiast, #dataviz geek, and #nlp buff

Citation (CITATION.R)

@Manual{,
    title = {{sentimentpy}: Calculate Text Polarity Sentiment},
    author = {Tyler W. Rinker},
    address = {Buffalo, New York},
    note = {version 2.7.0},
    year = {2018},
    url = {http://github.com/trinker/sentimentpy},
  }

GitHub Events

Total
Last Year

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 26
  • Total Committers: 1
  • Avg Commits per committer: 26.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Tyler Rinker t****r@c****m 26
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: over 1 year ago