A Personal Library
- Encapsulate boilerplate code
- Data processing code
- ML Frameworks (NLP tasks - SeqClassification, Entity Extractions etc.)
pip3 install -U boondh
For nightly
git clone https://github.com/rohit-mehra/boondh.git
cd boondh
pip install .
Parallelize any function
from boondh import mp_func
# Any function to be applied on each element of data
def base_func(value, sq=True):
if sq: return value ** 2
return value
# Any data
data = [0, 1, 2, 3, 4]
# Collected results - Ordered by default
results = mp_func(base_func, # apply this in parallel
'value', # the data argument name in above function
data, # contains elements to be processed
sq=True # any arg of the `to be applied` function
)
# configure chunksize and set ordered as False for perfromance gain
results = mp_func(base_func, 'value', data, chunksize=200, ordered=False, sq=True)
Arrange files in your directory (usually the
Download
directory.. 😄)
- This will scan the directory and create
type folders
likecsv_
,txt_
etc. - Move respective filetypes into these folders.
python -m boondh.utils.arrange_files -D "$(pwd)"
OR
python -m boondh.utils.arrange_files -D /Users/<myusername>/Downloads/