Skip to main content

API for Sinhala Sentiment Lexicon

Project description

HelaSentiLex (Hela Sentiment Lexicon)

Python API for Sinhala Sentiment Lexicon

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 install 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('හොඳින් හෝ නරකින් කරන්න')
{'හොඳින්': 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

  1. Open 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!

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

helasentilex-0.1.0.tar.gz (65.6 kB view details)

Uploaded Source

Built Distribution

helasentilex-0.1.0-py3-none-any.whl (65.9 kB view details)

Uploaded Python 3

File details

Details for the file helasentilex-0.1.0.tar.gz.

File metadata

  • Download URL: helasentilex-0.1.0.tar.gz
  • Upload date:
  • Size: 65.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.12

File hashes

Hashes for helasentilex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 29511caa0a212c69b5318fa9d138dd6828f5b718f4ed9953537bc66e1c997337
MD5 da64869245a211d87db1451d86ac0463
BLAKE2b-256 ae52ccc4e0351a4c20855e47a5f05caf89d50190b8f81128aaac7d0026378f5b

See more details on using hashes here.

File details

Details for the file helasentilex-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: helasentilex-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 65.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.12

File hashes

Hashes for helasentilex-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 342c9105859ce91f34e0abe1f5ca1cc24fc3faefb3dada40a51df2f62ce227e7
MD5 6d3686d5a0a4fd8d356bb6232b6e4702
BLAKE2b-256 986eb9c947d34bf362c2b0ee4b393849887e508de178ac45e87c8b616d17f5c7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page