Skip to main content

HelaSentiLex (Hela Sentiment Lexicon)

Python API for Sinhala Sentiment Lexicon with 14000+ sentiment tagged Sinhala words

Setup environment

  1. Make sure you have Python >= 3.6 by python --version
  2. Additionally, you’ll need to make sure you have pip available by running pip --version
  3. To install pip see installing pip
  4. 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('ඔබේ සැප දුක කෙසේද')
{'ඔබේ': 0, 'සැප': 1, 'දුක': -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

  1. Open helasentilex/lexicon.csv file
  2. Append new_word,sentiment_score
  3. Sort words in ascending order
  4. Save changes to your forked repo and make a pull request

Love helasentilex? Give our repo a star!

Metadata

Release files for helasentilex 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for helasentilex 0.1.1
File Size Uploaded
helasentilex-0.1.1.tar.gz 66.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for helasentilex 0.1.1
File Interpreter ABI Platform
helasentilex-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 132.0 kB

Release files / helasentilex-0.1.1.tar.gz

Download URL helasentilex-0.1.1.tar.gz
Size 66.1 kB
Tags Source
SHA-256 checksum
How to use checksums
18ce1625aab5457b6294f014e4e02f20c8f3c1d6431fd39920904f6865950229
BLAKE2b-256 checksum
How to use checksums
686c344d716277ad6a1400b6ccab0f1d1778aa96f02f4460279bd55a642c7ddb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.12

Release files / helasentilex-0.1.1-py3-none-any.whl

Download URL helasentilex-0.1.1-py3-none-any.whl
Size 65.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
900b5fa7a4656a51065d85f4e6e1001194374b37485ab149a71c98d38ec431a0
BLAKE2b-256 checksum
How to use checksums
4aad26388150a32584d3b7b468eabd0faaa1b3fa493353bc0948c2f3c9f6b658
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page