Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/draperunner/fjlc
A Python port of the Fredriksen–Jahren Lexicon Classifier
https://github.com/draperunner/fjlc
idi ntnu sentiment sentiment-analysis sentiment-classification twitter twitter-sentiment-analysis
Last synced: 19 days ago
JSON representation
A Python port of the Fredriksen–Jahren Lexicon Classifier
- Host: GitHub
- URL: https://github.com/draperunner/fjlc
- Owner: draperunner
- License: mit
- Created: 2017-04-06T16:43:39.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-17T14:31:15.000Z (almost 8 years ago)
- Last Synced: 2024-12-05T23:34:04.228Z (about 2 months ago)
- Topics: idi, ntnu, sentiment, sentiment-analysis, sentiment-classification, twitter, twitter-sentiment-analysis
- Language: Python
- Size: 38.9 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Lexicon Classifier
Source code: https://github.com/draperunner/fjlc
This package is a Python port of the Lexicon Creator and Classifier of Valerij Fredriksen and Brage Ekroll Jahren (2016).
It is compatible with Python version >= 3.The original Java code is available here: https://github.com/freva/Masteroppgave
If using this package in your publications, please cite
> Valerij Fredriksen and Brage Ekroll Jahren. Twitter Sentiment Analysis: Exploring Automatic Creation of Sentiment Lexica. Master's thesis, 2016.## Installation
```bash
pip install fjlc
```## Lexicon Classifier
The `LexiconClassifier` uses the best performing lexicon of Fredriksen and Jahren. You can specify your own lexicon, see Options below.### Usage
```python
from fjlc import LexiconClassifier
lc = LexiconClassifier()
```You can classify a single tweet or a list of tweets:
```
lc.classify("I am happy!") # 'POSITIVE'
lc.classify(["I am happy!", "I hate rain"]) # ['POSITIVE', 'NEGATIVE']
```You can get the sentiment value of a single tweet or multiple tweets
```
lc.calculate_sentiment("I am happy!") # 5.599244615570646
lc.calculate_sentiment(["I am happy!", "I hate rain"]) # [5.599244615570646, -2.767224666516315]
```### Options
The `LexiconClassifier` takes three options:
* `lexicon`: Path to sentiment lexicon file
* `options`: Path to options file
* `dictionary`: Path to canonical dictionary## Lexicon Creator
### Usage
```python
from fjlc import LexiconCreator
lc = LexiconCreator()
```
Incomplete, untested.