This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
class ExpungeCharacters(object): | |
""" | |
This class is used to scrub specific items from text strings. These items include single ASCII characters, | |
non-ASCII characters and single digits. | |
Usage: input_text = '“Projected Set-tled Balan&ce†456$' | |
clean = cleanse_text_utilities.ExpungeCharacters(input_text) | |
print(clean.remove_non_ascii()) | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListManipulations(object): | |
""" | |
This class is used to manipulate various list types. The manipulate types include the deduplication of | |
single and multidimensional lists. Multidimensional lists can also be flattened into a single list. | |
Usage: inputList = list_utilities.ListManipulations(sample_list) | |
print(inputList.deduplicate_multidimensional_list()) | |
""" | |
def __init__(self, input_list): | |
""" | |
:param input_list: list to process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def divide_list_into_chunks(input_list, len_of_chunk): | |
""" | |
This function will divide a list into chunks. | |
:param input_list: list to divided | |
:param len_of_chunk: maximum length of each chunk | |
:return: | |
""" | |
for i in range(0, len(input_list), len_of_chunk): | |
yield input_list[i:i + len_of_chunk] |
NewerOlder