API for Sinhala Sentiment Lexicon
Project description
HelaSentiLex (Hela Sentiment Lexicon)
Python API for Sinhala Sentiment Lexicon
Setup environment
- Make sure you have Python >= 3.6 by
python --version
- Additionally, you’ll need to make sure you have pip available by running
pip --version
- To install pip see install pip
- Install helasentilex package using the command
pip install helasentilex
Getting started
Let's begin with showing how easy it is to find sentiments of Sinhala words using helasentilex
>>> import helasentilex
>>> helasentilex.sentiment('යහපත්')
1
>>> helasentilex.sentiment('අමිහිරි')
-1
>>> helasentilex.sentiment('පරිගණකය')
0
If the input word does not exist in our sentiment lexicon or the input is invalid then it will return None
>>> helasentilex.sentiment(23)
None
You can enter a sentence as a string and get sentiment scores for available words in the sentiment lexicon
>>> helasentilex.sentiments('හොඳින් හෝ නරකින් කරන්න')
{'හොඳින්': 1, 'හෝ': 0, 'නරකින්': -1, 'කරන්න': None}
If the input is invalid then it will return an empty dictionary
>>> helasentilex.sentiments(23)
{}
Defining labels
1: POSITIVE (ධනාත්මක)
-1: NEGATIVE (ඍණාත්මක)
0: OBJECTIVE (මධ්යස්ථ හෝ උදාසීන)
Contributing
Want to report a bug, contribute some code, or improve documentation? Excellent! fork our repository and start contributing.
Adding new words to the sentiment lexicon
To add new words along with their sentiment scores
- Open
lexicon.csv
file - Append
new_word,sentiment_score
- Sort words in ascending order
- Save changes to your forked repo and make a pull request
Love helasentilex? Give our repo a star!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for helasentilex-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90d2597e3180e6e21849816ab1b29c3c35a142d834f81d2f52583cdcb79db0ff |
|
MD5 | 8debcae92ab8730d37586231b04d1ba2 |
|
BLAKE2b-256 | d980fb051582d2ba8209f3c688f0044571244e2ce1d006de82a3f8506e88dd65 |