Package: btext
BTEXTBear Au Jus Text (btext) is a tool used for processing a text/string, optimized for data science and data analytics.btext can also implemented with pandas dataframe.Latest Version Github Directory1.0PyPIhttps://pypi.org/project/btext/Webpageshttps://haryobagas.github.io/btext/Latest ChangelogRelease Date : 12/23/2020Version 1.0Initial CommitInstallationGet latest version of bearaujuspip install btext --upgradeDocumentationA. Core ModuleCore module contains base functions of base text processing from bearaujus.import btext as btCore Module : Table of ContensA.1. Converting Text to Consecutive LetterA.2. Converting Text to Tokenized Consecutive LetterA.3. Converting Text to Consecutive NumberA.4. Converting Text to Tokenized Consecutive NumberA.5. Converting Text to Consecutive PunctuationA.6. Converting Text to Tokenized Consecutive PunctuationA.7. Converting Text to Lower CaseA.8. Removing SpacesA.9. Removing Double SpacesA.10. Removing Char by User OptionA.11. Removing Char by User Desired LengthA.12. Get All Valid AlphabetA.13. Get Tokenized All Valid AlphabetA.14. Get All Valid NumberA.15. Get Tokenized All Valid NumberA.16. Get All Valid PunctuationA.17. Get Tokenized All Valid PunctuationA.18. Normalizing a Text or a CollectionsA.19. Converting Object to StringA.1. Converting Text to Consecutive Letterdef conslet(val, sep=' ')Example 1text = '=,= im getting hungry~'
text = bt.conslet(text)
print(text)->im getting hungryReturn Type :StringExample 2text = '=,= im getting hungry~'
text = bt.conslet(text, sep = '~')
print(text)->im~getting~hungryReturn Type :StringA.2. Converting Text to Tokenized Consecutive Letterdef conslet_tokenized(val, sep=' ')Example 1text = 'John Mayer, Honne, Minami, Lisa'
text = bt.conslet_tokenized(text)
print(text)->['John', 'Mayer', 'Honne', 'Minami', 'Lisa']Return Type :ListExample 2text = 'John Mayer, Honne, Minami, Lisa'
text = bt.conslet_tokenized(text, sep = ',')
print(text)->['John Mayer', 'Honne', 'Minami', 'Lisa']Return Type :ListA.3. Converting Text to Consecutive Numberdef consnum(val, sep='')Example 1text = '+62.81231.1231.123. This is random phone numbers ! -999-'
text = bt.consnum(text)
print(text)->62812311231123999Return Type :StringExample 2text = '+62.81231.1231.123. This is random phone numbers ! -999-'
text = bt.consnum(text, sep = '-')
print(text)->62-81231-1231-123-999Return Type :StringA.4. Converting Text to Tokenized Consecutive Numberdef consnum_tokenized(val)Example 1text = '+62.81231.1231.123. This is random phone numbers ! -999-'
text = bt.consnum_tokenized(text)
print(text)->['62', '81231', '1231', '123', '999']Return Type :ListExample 2text = '+62-81231-1231-123. This is random phone numbers ! ~~'
text = bt.consnum(text, sep = '-')
print(text)->62-81231-1231-123Return Type :StringA.5. Converting Text to Consecutive Punctuationdef conspunc(val, sep = '') :Example 1text = 'Nyummy.... !!!! this is the best pancake ever :))))'
output = bt.conspunc(text)
print(output)->....!!!!:))))Return Type :StringExample 2text = 'Nyummy.... !!!! this is the best pancake ever :))))'
output = bt.conspunc(text, sep = ' ')
print(output)->. . . . ! ! ! ! : ) ) ) )Return Type :StringA.6. Converting Text to Tokenized Consecutive Punctuationdef conspunc_tokenized(val) :Exampletext = 'Nyummy.... !!!! this is the best pancake ever :))))'
output = bt.conspunc_tokenized(text)
print(output)->['.', '.', '.', '.', '!', '!', '!', '!', ':', ')', ')', ')', ')']Return Type :ListA.7. Converting Text to Lower Casedef lower(val) :Exampletext = 'HeloOo WORLd !'
output = bt.lower(text)
print(output)->helooo world !Return Type :StringA.8. Removing Spacesdef remove_spaces(val) :Exampletext = 'Hel     lo Wor     ld'
output = bt.remove_spaces(text)
print(output)->HelloWorldReturn Type :StringA.9. Removing Double Spacesdef remove_double_spaces(val) :Exampletext = 'Hello    World from        Universe !'
output = bt.remove_double_spaces(text)
print(output)->Hello World from Universe !Return Type :StringA.10. Removing Char by User Optiondef removeby_char(val, exclude, sep = '') :Example 1text = 'i dont like math, i dont like wasabi'
output = bt.removeby_char(text, exclude = 'dont')
print(output)->i like math, i like wasabiReturn Type :StringExample 2text = 'i dont like math, i dont like wasabi'
output = bt.removeby_char(text, exclude = 'dont', sep = 'didnt')
print(output)->i didnt like math, i didnt like wasabiReturn Type :StringExample 3text = 'i dont like math, i dont like wasabi'
output = bt.removeby_char(text, exclude = ['i dont', 'like'])
print(output)->math, wasabiReturn Type :StringExample 4text = 'i dont like math, i dont like wasabi'
output = bt.removeby_char(text, exclude = ['i dont', 'like'], sep = '~')
print(output)->~ ~ math, ~ ~ wasabiReturn Type :StringA.11. Removing Char by User Desired Lengthdef removeby_length(val, exclude, sep = ' ') :Example 1text = 'Hi hi hi welcome to the jungle'
output = bt.removeby_length(text, exclude = 2)
print(output)->welcome the jungleReturn Type :StringExample 2text = 'Hi hi hi welcome to the jungle'
output = bt.removeby_length(text, exclude = 2, sep = '~')
print(output)->welcome~the~jungleReturn Type :StringExample 3text = 'Hi hi hi welcome to the jungle'
output = bt.removeby_length(text, exclude = [2, 3])
print(output)->welcome jungleReturn Type :StringExample 4text = 'Hi hi hi welcome to the jungle'
output = bt.removeby_length(text, exclude = [2, 3], sep = ' HEI ')
print(output)->welcome HEI jungleReturn Type :StringA.12. Get All Valid Alphabetdef getall_alphabet(sep = '', include_upper = False) :Example 1output = bt.getall_alphabet()
print(output)->abcdefghijklmnopqrstuvwxyzReturn Type :StringExample 2output = bt.getall_alphabet(sep = ' ')
print(output)->a b c d e f g h i j k l m n o p q r s t u v w x y zReturn Type :StringExample 3output = bt.getall_alphabet(include_upper = True)
print(output)->abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZReturn Type :StringExample 4output = bt.getall_alphabet(sep = '-', include_upper = True)
print(output)->a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z-A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-ZReturn Type :StringA.13. Get Tokenized All Valid Alphabetdef getall_alphabet_tokenized(include_upper = False) :Example 1output = bt.getall_alphabet_tokenized()
print(output)->['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']Return Type :ListExample 2output = bt.getall_alphabet_tokenized(include_upper = True)
print(output)->['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']Return Type :ListA.14. Get All Valid Numberdef getall_number(sep = '') :Example 1output = bt.getall_number()
print(output)->0123456789Return Type :StringExample 2output = bt.getall_number(sep = ' ')
print(output)->0 1 2 3 4 5 6 7 8 9Return Type :StringA.15. Get Tokenized All Valid Numberdef getall_number_tokenized() :Exampleoutput = bt.getall_number_tokenized()
print(output)->['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']Return Type :ListA.16. Get All Valid Punctuationdef getall_punc(sep = '') :Example 1output = bt.getall_punc()
print(output)->!"#$%&'()*+,-./:;<=>?@[\]^_{|}~Return Type :StringExample 2output = bt.getall_punc(sep = ' ')
print(output)->! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ { | } ~Return Type :StringA.17. Get Tokenized All Valid Punctuationdef getall_punc_tokenized() :Exampleoutput = bt.getall_punc_tokenized()
print(output)->['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '{', '|', '}', '~']Return Type :ListA.18. Normalizing a Text or a CollectionsConverting Text to Consecutive LetterConverting Text to Lower CaseRemoving Double Spacesdef normalize(obj, show_process = False) :Example 1text = 'Nyummy8888888888888888 3235.... !!!! this is the best pancake ever :))))'
output = bt.normalize(text)
print(output)->nyummy this is the best pancake everReturn Type :StringExample 2my_list = ['UwU this is so good :3', 'LETS GOO MAN !', 'okay you fine ! :3']
output = bt.normalize(my_list)
print(output)->['uwu this is so good', 'lets goo man', 'okay you fine']Return Type :ListExample 3my_list = ['UwU this is so good :3', 'LETS GOO MAN !', 'okay you fine ! :3']
output = bt.normalize(my_list, show_process = True)
print(output)Normalizing Data: [####################] 100.0% | P: 3 / 3 [ Done ]->['uwu this is so good', 'lets goo man', 'okay you fine']Return Type :ListA.19. Converting Object to Stringdef to_string(obj) :Example 1number = 125.12525215
output = bt.to_string(number)
print(output)->125.12525215Return Type :StringExample 2my_list = ['UwU this is so good :3', 'LETS GOO MAN !', 'okay you fine ! :3']
output = bt.to_string(my_list)
print(output)->UwU this is so good :3 LETS GOO MAN ! okay you fine ! :3Return Type :StringCreditMain Github Page :https://github.com/haryobagas/Linkedin :https://www.linkedin.com/in/haryobagas08/Other documentation work in progress.Bear Au Jus - ジュースとくま@2020