This projects aims to build a library for all the NLP processes for Nepali Language.
Getting the module
!pip install git+https://github.com/sushil79g/Nepali_nlp.git
Loading Embedding
from Nepali_nlp import Embeddings
word_vec = Embeddings().load_large_vector()
#word_vec = Embeddings().load_vector() #For small Embedding
#from fasttext_embedding import Fasttext
#word_vec = Fasttext().load()
For Nepali Synonym
from Nepali_nlp import Synonym
Synonym().raw_synonym(word = 'рдорд╛рдпрд╛',word_vec=word_vec) #method: 1
#output -> рд╕реНрдиреЗрд╣','рдкреНрд░реЗрдо','рдЖрджрд░','рдорд╛рдпрд╛рдБ','рджрдпрд╛','рдорд╛рдпрд╛рд▓реБ','рд╢реНрд░рджреНрдзрд╛','рдЖрддреНрдорд┐рдпрддрд╛','рд╕реНрдкрд░реНрд╢','рддрд┐рдореА
Synonym().filter_synonym(word = 'рд╕рд╛рдереА',word_vec=word_vec) #method: 2
#output -> 'рднрд╛рдЗрд╣рд░реВ','рд╕рд╣рдкрд╛рдареА','рдкреНрд░реЗрдореА','рджрд╛рдЗ','рдкреНрд░реЗрдорд┐','рдмрд╣рд┐рдиреА'
Word-spell corrector
from Nepali_nlp import Corrector
Corrector().corrector(word='рд╕реБрд╢рд▓') #In a very raw stage for now.
#output-> ['рд╕реБрд╢реАрд▓', 'рд╕реБрд╢реАрд▓']
Corrector().spell_correct("рдХрд╕реНрдд рднрдХреЛ рд╣реЗрд░реМ рд╣реИ")
#output-> "рдХрд╕реНрддреЛ рднрдпреЛ рд╣реЗрд░ рд╣реИ"
Nepali text summerizer
from Nepali_nlp import Summerize
Summerize().show_summary(word_vec,text, length_sentence_predict=5)
Nepali unicode to Devnagiri Font
from Nepali_nlp import Unicode
text = 'ma ghara jaanchhu'
Unicode().unicode_word(text) #output-> 'рдо рдШрд░ рдЬрд╛рдиреНрдЫреБ'
Preeti-font character to Devnagiri Font
from Nepali_nlp import preeti
unicode_word = 'g]kfnL'
print(preeti(unicode_word)) #output-> рдиреЗрдкрд╛рд▓реА
OCR(optical character reader)
from Nepali_nlp import OCR
text = OCR(image_location)
Nepali Tokenizer
from Nepali_nlp import Tokenizer
Tokenizer().sentence_tokenize(text) #To tokenize sentence
Tokenizer().word_tokenize(text) #To tokenize word
Tokenizer().character_tokenize(text) #To tokenize character
Nepali sentence similarity
from Nepali_nlp import Avg_vector_similar
sentences = ["рдХреБрдкреЛрд╖рдгрдХреИ рдХрд╛рд░рдг рд╢рд╛рд░реАрд░рд┐рдХ рд░ рдорд╛рдирд╕рд┐рдХ рд░реБрдкрдорд╛ рдХрдордЬреЛрд░ рдорд╛рддреНрд░ рд╣реЛрдЗрди, рдЕрдХрд╛рд▓рдореИ рдЬреНрдпрд╛рди рдкрдирд┐ рдЧреБрдорд╛рдЙрдиреБрдХреЛ рдкрд░реЗрдХреЛ рд╕рдорд╛рдЪрд╛рд░ рдмрдЧреНрд░реЗрд▓реНрддреА рд╕реБрдиреНрди рд╕рдХрд┐рдиреНрдЫ","рдХрд░реНрдгрд╛рд▓реА рдкреНрд░рджреЗрд╢ рд╕рд╛рдорд╛рдЬрд┐рдХ рд╡рд┐рдХрд╛рд╕ рдордиреНрддреНрд░рд╛рд▓рдпрд▓реЗ рдЙрдкрд▓рдмреНрдз рдЧрд░рд╛рдПрдХреЛ рддрдереНрдпрд╛рдВрдХрд▓реЗ рдХрд░реНрдгрд╛рд▓реАрдорд╛ рдкреНрд░рддреНрдпреЗрдХ рд╡рд░реНрд╖ рдЬрдиреНрдорд┐рдПрдХрд╛ рел рд╡рд░реНрд╖рдореБрдиреАрдХрд╛ рдмрд╛рд▓рдмрд╛рд▓рд┐рдХрд╛ рез рд╣рдЬрд╛рд░ рдЬрдирд╛рдордзреНрдпреЗ релрео рдЬрдирд╛рд▓реЗ рдЬреНрдпрд╛рди рдЧреБрдорд╛рдЙрдБрджреИ рдЖрдПрдХреЛ рджреЗрдЦрд╛рдПрдХреЛ рдЫ"]
Avg_vector_similar().pair_similarity(word_vec, sentences) #output-> 0.6817289590835571
Nepali new-portal Scrapper (onlinekhabar and ekantipur for now)
from Nepali_nlp import extract_news
news_link = 'https://www.onlinekhabar.com/2019/12/821094'
title, news = extract_news(news_link) #onlinekhabar and ekantipur is supported at the moment.
Show latest news summary
from Nepali_nlp import UpdateNews
title, links, summerized_news = UpdateNews().show_latest(word_vec=word_vec,portal='onlinekhabar',number_of_news=5) #ekantipur portal is also supported
TODOs:
- Nepali Embeddings
- Tokenizers (sentence, word, character)
- Stop Words
- Nepali Words Collection
- Nepali Word synonym
- Roman Nepali to Nepali
- Nepali OCR
- Summerization
- Pos_tag
- Sentence similarity score
- Spell correction
- Named Entity Recognition (Currently)
- Translation(Nepali<->English)