Package: processtext
==========          processtext          ==========processtextis a an open-source python package to clean raw text data.Installationprocesstext requiresPython 3,NLTK, andAutocorrectto execute.To install using pip, usepip install processtextFeaturesprocesstext package contains different functions such as:degroup_num: Removes comma(,) in between numbers inside a stringremove_hyphen: Removes hyphen(-) in between textsint_to_en: Returns whole numbers in english text. e.g. 25 -> twenty-fivenum_to_en: Returns english of numbers one by one from left to rightfloat_to_en: Returns floating point numbers into english textint_to_text: Replaces all the whole numbers inside string into English textfloat_to_text: Replacing all the positive rational numbers inside string into English textdecontract_strings: Decontracts strings e.g. I'm -> I amremove_emoji: Removes emojiclean_text: For deep cleaning of textslowercase: Converts the texts into lowercaseautocorrect: Corrects spelling mistakeslemmatize: Lemmatizes the input textsremove_sw: Removes stop wordsclean: to clean raw text and return the cleaned textclean_l: to clean raw text and return a list of clean wordsThe processtext.clean() and processtext.clean_l() function can apply all, or a selected combination of the following cleaning operations:Remove special symbols/charactersRemove digits from the textRemove punctuations from the textRemove extra white spacesRemove or replace the part of text with custom regexConvert the entire text into a uniform lowercaseLemmatize the wordsRemove stop words, and choose a language for stop wordsUsageImport the library:importprocesstextasptChoose a method:To return the text in a string format,pt.clean("your_raw_text_here")To return a list of words from the text,pt.clean_l("your_raw_text_here")To choose a specific set of cleaning operations,pt.clean_l("your_raw_text_here",clean_all=False# Execute all cleaning operationsextra_spaces=True,# Remove extra white spacesstemming=True,# Stem the wordsstopwords=True,# Remove stop wordslowercase=True,# Convert to lowercasenumbers=True,# Remove all digitspunct=True,# Remove all punctuationsreg:str='<regex>',# Remove parts of text based on regexreg_replace:str='<replace_value>',# String to replace the regex used in regstp_lang='english'# Language for stop words)Examplesimportprocesstextasptpt.degroup_num('111,222,333')returns,'111222333'importprocesstextasptpt.remove_hyphen('2022-2023')returns,'2022 2023'importprocesstextasptprint(pt.int_to_en(1998))print(pt.int_to_en('9123456789'))returns,onethousandninehundredandninety-eightninebilliononehundredandtwenty-threemillionfourhundredandfifty-sixthousandsevenhundredandeighty-nineimportprocesstextasptprint(pt.num_to_en(12345))print(pt.num_to_en('09876'))returns,onetwothreefourfivezeronineeightsevensiximportprocesstextasptprint(pt.float_to_en(12.345))print(pt.float_to_en('456.09876'))returns,twelvepointthreefourfivefourhundredandfifty-sixpointzeronineeightsevensiximportprocesstextasptprint(pt.float_to_en(12.345))print(pt.float_to_en('456.09876'))returns,twelvepointthreefourfivefourhundredandfifty-sixpointzeronineeightsevensiximportprocesstextasptpt.int_to_text('First 100 twin primes have values between 3 & 5 and 3821 & 3823')returns,Firstonehundredtwinprimeshavevaluesbetweenthree&fiveandthreethousandeighthundredandtwenty-one&threethousandeighthundredandtwenty-threeimportprocesstextasptpt.float_to_text('The first 10 digits of pi are 3.141592653')returns,Thefirsttenpointzerodigitsofpiarethreepointonefouronefiveninetwosixfivethreeimportprocesstextasptpt.decontract_strings("I can't believe he'll be graduating from college in just a few months.")returns,Icannotbelievehewillbegraduatingfromcollegeinjustafewmonths.importprocesstextasptpt.remove_emoji("🌞🌊☀️ Just spent an amazing day at the beach with my friends! 🏖️👭👬 We built sandcastles 🏰, played beach volleyball 🏐, and even went for a swim 🏊‍♀️🏊‍♂️. The sun was shining ☀️ and the water was so refreshing 💦. Can't wait to do it again! 🤩👍")returns,Justspentanamazingdayatthebeachwithmyfriends!Webuiltsandcastles,playedbeachvolleyball,andevenwentforaswim.Thesunwasshiningandthewaterwassorefreshing.Can't wait to do it again!importprocesstextasptpt.clean_text('The password must contain at least one symbol such as !,^,*,+,=,%,$,~,?,/,<>,|@, #, or %.')returns,Thepasswordmustcontainatleastonesymbolsuchasorimportprocesstextasptpt.lowercase('THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG.')returns,thequickbrownfoxjumpedoverthelazydog.importprocesstextasptpt.lowercase('THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG.')returns,thequickbrownfoxjumpedoverthelazydog.importprocesstextasptpt.autocorrect("I haven't receeved the package yet, but I think it should arrive somtime tomoro.")returns,Ihaven't received the package yet, but I think it should arrive sometime tomorrow.importprocesstextasptpt.autocorrect("I haven't receeved the package yet, but I think it should arrive somtime tomoro.")returns,Ihaven't received the package yet, but I think it should arrive sometime tomorrow.importprocesstextasptpt.lemmatize('they were playing in the garden.')returns,theybeplayinthegarden.importprocesstextasptpt.remove_sw('I went to the store and bought some milk, bread, and eggs.')returns,wentstoreboughtmilk,bread,eggs.importprocesstextasptpt.clean("TH@@#e Q!@#UicK bR0owN f*#!@)(O000000X JUmp100ED 000oV###3eR Th77777#$$e..........                 L@a/\|z+Y d==OG.",extra_spaces=True,lowercase=True,numbers=True,punct=True)returns,'the quick brown fox jumped over the lazy dog'importprocesstextasptpt.clean_l('TH@@#e Q!@#UicK bR0owN f*#!@)(O000000X JUmp100ED 000oV###3eR Th77777#$$e..........                 L@a/\|z+Y d==OG.',extra_spaces=True,lowercase=True,numbers=True,punct=True)returns,['the','quick','brown','fox','jumped','over','the','lazy','dog']fromprocesstextimportcleantext="my email id: ujjwal@rkmvu.ac.in and your's: mili@rnlk.ed"clean(text,reg=r"[a-z0-9\.\-+_]+@[a-z0-9\.\-+_]+\.[a-z]+",reg_replace='********',clean_all=False)returns,'my email id: ******** and your's:********'LicenseMIT