Skip to content

Some handful python functions which can be applied for different type of string/text operations accordingly.

License

Notifications You must be signed in to change notification settings

SyedShahzaib790/stringo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Stringo

An Open Source Python Library that includes some pre-coded functions which can be applied for different type of string/text operations accordingly.

The main idea behind coding this library was to facilitate the programmer to perform simple strings operations without have to worry about the datatype such as simple single string, list of strings, Series or DataFrame.

Available Functions

Usage

For Demo Purpose I am going to use the following examples:

simple_string = "I am a Programmer  !"
list_of_strings = ["I am a Programmer  !", "@I love to Code"]
dataframe = pd.DataFrame(["I am a Programmer  ", "I love to Code."], columns=['strings'])
series = pd.Series(["I am a Programmer!!!", "I love to Code...  ..."])
print ('Simple String : \n', stem_object(simple_string))
print ('---------- \nList of Strings : \n', stem_object(list_of_strings))
print ('---------- \nDataFrame : \n', stem_object(dataframe))
print ('---------- \nSeries: \n', stem_object(series))

======== OUTPUT =============>

Simple String: 
 i am a programmer  !
---------- 
List of Strings: 
 ['i am a programmer  !', '@i love to cod']
---------- 
DataFrame: 
                strings
0  i am a programmer  
1      i love to code.
---------- 
Series: 
0      i am a programmer!!!
1    i love to code...  ...

print ('Simple String: \n', remove_extra_spaces(simple_string))
print ('---------- \nList of Strings: \n', remove_extra_spaces(list_of_strings))
print ('---------- \nDataFrame: \n', remove_extra_spaces(dataframe))
print ('---------- \nSeries: \n', remove_extra_spaces(series))

Simple String: 
 I am a Programmer !
list
---------- 
List of Strings: 
 ['I am a Programmer !', '@I love to Code']
df
---------- 
DataFrame: 
              strings
0  I am a Programmer
1    I love to Code.
---------- 
Series: 
0     I am a Programmer!!!
1    I love to Code... ...

print ('Simple String: \n', remove_punctuations(simple_string))
print ('---------- \nList of Strings: \n', remove_punctuations(list_of_strings))
print ('---------- \nDataFrame: \n', remove_punctuations(dataframe))
print ('---------- \nSeries: \n', remove_punctuations(series))

Simple String: 
 I am a Programmer
---------- 
List of Strings: 
 ['I am a Programmer', 'I love to Code']
---------- 
DataFrame: 
              strings
0  I am a Programmer
1     I love to Code
---------- 
Series: 
0    I am a Programmer
1       I love to Code
print ('Simple String: \n', sort_list_of_strings(simple_string))
print ('---------- \nList of Strings: \n', sort_list_of_strings(list_of_strings, reverse=False))
print ('---------- \nDataFrame: \n', sort_list_of_strings(dataframe))
print ('---------- \nSeries: \n', sort_list_of_strings(series))

Simple String: 
 I am a Programmer  !
---------- 
List of Strings: 
 ['', '@I love to Code', 'I am a Programmer  !'] ## HERE !!!!
---------- 
DataFrame: 
                strings
0  I am a Programmer  
1      I love to Code.
---------- 
Series: 
0      I am a Programmer!!!
1    I love to Code...  ...
print ('Simple String: \n', tokenize_string_spacy(simple_string))
print ('---------- \nList of Strings: \n', tokenize_string_spacy(list_of_strings))
print ('---------- \nDataFrame: \n', tokenize_string_spacy(dataframe))
print ('---------- \nSeries: \n', tokenize_string_spacy(series))

Simple String: 
 ['I', 'am', 'a', 'Programmer', ' ', '!']
---------- 
List of Strings: 
 [['I', 'am', 'a', 'Programmer', ' ', '!'], ['@I', 'love', 'to', 'Code'], []]
---------- 
DataFrame: 
                      strings
0  [I, am, a, Programmer,  ]
1     [I, love, to, Code, .]
---------- 
Series: 
0     [I, am, a, Programmer, !, !, !]
1    [I, love, to, Code, ...,  , ...]

About

Some handful python functions which can be applied for different type of string/text operations accordingly.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages