Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A Python port of the Fredriksen-Jahren Lexicon Classifier

Project Description

Source code:

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:

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.


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.


from fjlc import LexiconClassifier
lc = LexiconClassifier()

You can classify a single tweet or a list of tweets:

>>> lc.classify("I am happy!")
>>> lc.classify(["I am happy!", "I hate rain"])

You can get the sentiment value of a single tweet or multiple tweets

>>> lc.classify("I am happy!")
>>> lc.classify(["I am happy!", "I hate rain"])
[5.599244615570646, -2.767224666516315]


The LexiconClassifier takes three options: * lexicon: Path to sentiment lexicon file * options: Path to options file * dictionary: Path to canonical dictionary

Lexicon Creator


from fjlc import LexiconCreator
lc = LexiconCreator()

Incomplete, untested.

Release History

This version
History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(60.0 kB) Copy SHA256 Hash SHA256
Source Apr 17, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting