GithubHelp home page GithubHelp logo

praatibhsurana / hinglish_hindi_wsd Goto Github PK

View Code? Open in Web Editor NEW
33.0 3.0 7.0 916 KB

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

License: MIT License

Python 100.00%
wsd word-sense-disambiguation nlp spello hindi-spell-correction python-3 lesk lesk-algorithm pos-tagging hindi-pos-tag

hinglish_hindi_wsd's Introduction

Note: This library is no longer being maintained. Please use Python >=3.6 and <=3.8.5 to ensure there are no version related issues.

GitHub stars Pypi package GitHub issues GitHub license

📌 A python package 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 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'))   

Citing

If you publish work that uses hindiwsd, please cite the hindiwsd paper, as follows:

@InProceedings{yusuf-surana-sharma:2022:WILDRE6,
  author    = {Yusuf, Mirza  and  Surana, Praatibh  and  sharma, Chethan},
  title     = {HindiWSD: A package for word sense disambiguation in Hinglish \& Hindi},
  booktitle      = {Proceedings of The WILDRE-6 Workshop within the 13th Language Resources and Evaluation Conference},
  month          = {June},
  year           = {2022},
  address        = {Marseille, France},
  publisher      = {European Language Resources Association},
  pages     = {18--23},
  abstract  = {A lot of commendable work has been done, especially in high resource languages such as English, Spanish, French, etc. However, work done for Indic languages such as Hindi, Tamil, Telugu, etc is relatively less due to difficulty in finding relevant datasets, and the complexity of these languages. With the advent of IndoWordnet, we can explore important tasks such as word sense disambiguation, word similarity, and cross-lingual information retrieval, and carry out effective research regarding the same. In this paper, we worked on improving word sense disambiguation for 20 of the most common ambiguous Hindi words by making use of knowledge-based methods. We also came up with “hindiwsd�, an easy-to-use framework developed in Python that acts as a pipeline for transliteration of Hinglish code-mixed text followed by spell correction, POS tagging, and word sense disambiguation of Hindi text. We also curated a dataset of these 20 most used ambiguous Hindi words. This dataset was then used to enhance a modified Lesk's algorithm and more accurately carry out word sense disambiguation. We achieved an accuracy of about 71\% using our customized Lesk’s algorithm which was an improvement to the accuracy of about 34\% using the original Lesk’s algorithm on the test set.},
  url       = {https://aclanthology.org/2022.wildre6-1.4}
}

Feel free to reach out to us for more information!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.