Shahabks / myprosody

A Python library for measuring the acoustic features of speech (simultaneous speech, high entropy) compared to ones of native speech.
https://shahabks.github.io/myprosody/
MIT License
232 stars 63 forks source link

Can't save the results of each function into a variable in python: returns None #19

Open Roiinbarr opened 3 years ago

Roiinbarr commented 3 years ago

I wish to save the result of each function into a new variable in python but the functions returns only a print and None object. I cannot save it into a new variable in my code script.

For example I used the mysp.mysppaus() and the return is: [] number_of_pauses= 73

I would like to save it into a variable or get it into a dictionary with key = number_of_pauses and value = 73.

I am using python 3.7.4 on windows.

Thanks.

kelseymour commented 3 years ago

To do this I had to modify the function from the myprosody.py file and delete the print statements in the function. Also added a return statement for the number I needed, and added pass after except. Might work for you too!

Roiinbarr commented 3 years ago

Thanks for your response @kelseymour I will definitely will do so. The thing is when you want to run a process on the cloud using this library functions you would have to install it to the environment using pip and then we return to the original functions of the library. Would love to know if you have any idea how to solve it.

agmicha commented 3 years ago

Up! I have the same case like @Roiinbarr

aegoff commented 3 years ago

It would be great if this module addressed this concern, but for anyone else who has this question, this stackoverflow post helped me work around it: https://stackoverflow.com/questions/22822267/how-to-capture-print-output-of-another-module?noredirect=1&lq=1