sentimentizer


Namesentimentizer JSON
Version 0.6.5 PyPI version JSON
download
home_page
Summarystraight forward rnn model
upload_time2023-03-21 23:02:17
maintainer
docs_urlNone
author
requires_python>=3.10
licenseCopyright (c) 2018-Present Edward Yang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords rnn pytorch nlp sentiment
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Introduction

[![PyPI Latest Release](https://img.shields.io/pypi/v/sentimentizer.svg)](https://pypi.org/project/sentimentizer/)
![GitHub CI](https://github.com/eddiepyang/sentimentizer/actions/workflows/ci.yaml/badge.svg)
  
Beta release, api subject to change. Install with:  

```
pip install sentimentizer
```  
  
This repo contains Neural Nets written with the pytorch framework for sentiment analysis.  
A LSTM based torch model can be found in the rnn folder. In spite of large language models (GPT3.5 as of 2023) 
dominating the conversation, small models can be pretty effective and are nice to learn from. This model focuses on sentiment analysis and was trained on 
a single gpu in minutes and requires less than 1GB of memory.

  
## Usage
```
# where 0 is very negative and 1 is very positive
from sentimentizer.tokenizer import get_trained_tokenizer
from sentimentizer.rnn.model import get_trained_model

model = get_trained_model(64, 'cpu')
tokenizer = get_trained_tokenizer()
review_text = "greatest pie ever, best in town!"
positive_ids = tokenizer.tokenize_text(review_text)
model.predict(positive_ids)
  
>> tensor(0.9701)
```

## Install for development with miniconda:  
```
conda create -n {env}  
conda install pip  
pip install -e .  
```

## Retrain model
To rerun the model:
* get the yelp [dataset](https://www.yelp.com/dataset), 
* get the glove 6B 100D [dataset](https://nlp.stanford.edu/projects/glove/)
* place both files in the package data directory 
* run the training script in workflows


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "sentimentizer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "rnn,pytorch,nlp,sentiment",
    "author": "",
    "author_email": "Edward Yang <edwardpyang@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/45/a4/d658bc14271b9124593c2d0e58301572156a893d0b447c076b80585d6350/sentimentizer-0.6.5.tar.gz",
    "platform": null,
    "description": "# Introduction\n\n[![PyPI Latest Release](https://img.shields.io/pypi/v/sentimentizer.svg)](https://pypi.org/project/sentimentizer/)\n![GitHub CI](https://github.com/eddiepyang/sentimentizer/actions/workflows/ci.yaml/badge.svg)\n  \nBeta release, api subject to change. Install with:  \n\n```\npip install sentimentizer\n```  \n  \nThis repo contains Neural Nets written with the pytorch framework for sentiment analysis.  \nA LSTM based torch model can be found in the rnn folder. In spite of large language models (GPT3.5 as of 2023) \ndominating the conversation, small models can be pretty effective and are nice to learn from. This model focuses on sentiment analysis and was trained on \na single gpu in minutes and requires less than 1GB of memory.\n\n  \n## Usage\n```\n# where 0 is very negative and 1 is very positive\nfrom sentimentizer.tokenizer import get_trained_tokenizer\nfrom sentimentizer.rnn.model import get_trained_model\n\nmodel = get_trained_model(64, 'cpu')\ntokenizer = get_trained_tokenizer()\nreview_text = \"greatest pie ever, best in town!\"\npositive_ids = tokenizer.tokenize_text(review_text)\nmodel.predict(positive_ids)\n  \n>> tensor(0.9701)\n```\n\n## Install for development with miniconda:  \n```\nconda create -n {env}  \nconda install pip  \npip install -e .  \n```\n\n## Retrain model\nTo rerun the model:\n* get the yelp [dataset](https://www.yelp.com/dataset), \n* get the glove 6B 100D [dataset](https://nlp.stanford.edu/projects/glove/)\n* place both files in the package data directory \n* run the training script in workflows\n\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2018-Present Edward Yang  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "straight forward rnn model",
    "version": "0.6.5",
    "split_keywords": [
        "rnn",
        "pytorch",
        "nlp",
        "sentiment"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "45a4d658bc14271b9124593c2d0e58301572156a893d0b447c076b80585d6350",
                "md5": "17522db4ccfad523bd3cd070b72c478c",
                "sha256": "75becfddac60f9b70e10860e8b35ccd8510582834234a42a98263612fdb7c573"
            },
            "downloads": -1,
            "filename": "sentimentizer-0.6.5.tar.gz",
            "has_sig": false,
            "md5_digest": "17522db4ccfad523bd3cd070b72c478c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 9295554,
            "upload_time": "2023-03-21T23:02:17",
            "upload_time_iso_8601": "2023-03-21T23:02:17.888165Z",
            "url": "https://files.pythonhosted.org/packages/45/a4/d658bc14271b9124593c2d0e58301572156a893d0b447c076b80585d6350/sentimentizer-0.6.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-21 23:02:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "sentimentizer"
}
        
Elapsed time: 0.05437s