Skip to main content

GitHub stars Pypi package GitHub issues GitHub license

📌 A pipeline for transliteration of Hinglish code mixed data to Hindi Devanagari script, spell correction, POS tagging and word sense disambiguation of the Hindi Devanagari script.

📖 With this package, we aim to tackle the problem of word sense disambiguation by making atleast the preliminary steps a lot easier. The problem statement we decided to tackle was the translation of Hinglish code mixed data to Hindi Devanagari and then to carry out word sense disambiguation on the Hindi text. We make use of libraries such as spello, indic-transliteration, pyiwn and indic_tagger.


💡 Functionalities

hindiwsd will mainly carry out the following tasks for now:

  • Hinglish to Hindi transliteration
  • Spell correction of Hindi text
  • POS tagging of Hindi text
  • Word Sense Disambiguation of Hindi text with the help of IndoWordNet
  • Enhanced Lesk's Algorithm using custom dataset

💾 Installation

Install hindiwsd via 'pip'

pip install hindiwsd

🗒️ NOTE

  1. A small change will need to be made to iwn.py from the pyiwn library before using our package
  • There is a missing try-catch block in iwn.py that might cause our package to crash
  • Here's a quick fix, use our patched iwn.py instead. Copy it's contents and replace it with the original iwn.py.
  • The path to the original iwn.py would be path-to-your-env-or-python-folder/lib/site-packages/pyiwn/iwn.py

📄 CUSTOM DATASET FOR ENHANCED LESK'S ALGORITHM

The custom dataset is available here.

  • Here is a preview of what it looks like

    image

⚡Getting Started

🔤 Word Sense Disambiguation

  • The wordsense() function from the hindi_wsd.py script. It prints out the Hindi Devanagari spell corrected sentence, POS tags and disambiguated word meanings for each word in the sentence available on the IndoWordNet.
>>> from hindiwsd import hindi_wsd
>>> print(hindi_wsd.wordsense("aaj achha din hai"))
  • You can also directly feed in Hindi sentences to the wordsense() function.
>>> from hindiwsd import hindi_wsd
>>> print(hindi_wsd.wordsense("आज अच्छा दिन है"))

🏷️ POS tagging for Hindi Devanagari

  • Getting POS tags for a Hindi sentence using the POS_tagger() function from the wsd.py script. Returns a list of tuples containing word and respective tag(NOUN, ADJECTIVE, ADVERB, VERB).
>>> from hindiwsd import wsd
>>> print(wsd.POS_tagger('आज अच्छा दिन है'))

📚 Hinglish to Hindi transliteration with spell correction

  • Transliterating the Hinglish code mixed sentence to Hindi Devanagari using the preprocess_transliterate() function from the wsd.py script. Returns two strings. The first is the spell corrected Hinglish sentence followed by the spell corrected Hindi sentence.
>>> from hindiwsd import wsd
>>> print(wsd.preprocess_transliterate('aaj achha din hai'))

Feel free to reach out to us for more information!

Metadata

Release files for hindiwsd 1.1.2

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

Source distribution (sdist)

Source distribution for hindiwsd 1.1.2
File Size Uploaded
hindiwsd-1.1.2.tar.gz 34.6 kB Details

Built distribution (wheel)

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

Total release size: 79.7 MB

Release files / hindiwsd-1.1.2.tar.gz

Download URL hindiwsd-1.1.2.tar.gz
Size 34.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d4a11baa947facc271b64538e7ecf235054e9a2b19c6d4e4f0ddb2f32b994d24
BLAKE2b-256 checksum
How to use checksums
e85d94ce0913072c9d6af6d951f861e641d51a2d347a059077b12cc3b3368fa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5

Release files / hindiwsd-1.1.2-py3-none-any.whl

Download URL hindiwsd-1.1.2-py3-none-any.whl
Size 79.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
dedf015729cd79e7267d09aaf00fc9b6d15e59cfc30b22c7772dfa2ea154e892
BLAKE2b-256 checksum
How to use checksums
d4b349552ea804d5d51ac46785cf0da27a7ee03c94a4e3c3d4f884e4bc76ead8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

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