perspective.py v0.3.2
A random idea came to my mind whilst I was in school and I decided to add it to the library. While I was adding the feature, I noticed some bugs and fixed them too at the mean time. You can see what the idea was and the bugs that I've fixed below. Other than that, I literally have no idea to add to the library so I would appreciate if you give me some ideas in the Issues tab of the repository.
New features
- Added
save_data
function which can be used to save the response that theanalyze
function returned to a SQLite3 database file. I know it's already pretty easy to do this by yourself but here is an easier way. - Added
EmptyResponse
exception type toperspective.errors
class which gets raised when there is no attribute in the dictionary that was passed to theresponse
argument in any of the functions ofperspective.utils
class. - Added
EmptyFileName
exception type toperspective.errors
class which gets raised when an empty string was provided as thefilename
argument ofsave_graph
and/orsave_data
functions ofperspective.utils
class.
Changes
- Changed the way the
analyze
function ofperspective.Client
object and all other functions inperspective.utils
class (only if raw response was provided) fetch score values of attributes from the raw response that was directly returned from the API. They now get the score values fromsummaryScore
nested-dictionary which contains the average score value instead ofspanScores
which shall contain score values of each sentence of the text requested to the API in the future.
Bug fixes
- Fixed
TypeError
exception when attempting to useformat_response
orsave_data
inperspective.utils
class by providing raw response to theresponse
argument and settingsort_by
argument to something other thanNone
. - Fixed TOXICITY attribute appearing as
toxicity
instead ofToxicity
(first letter is not capital) whenTrue
is passed to thealign_right
argument offormat_response
function inperspective.utils
class. - Fixed
ModuleNotFoundError
exception when importing the package (perspective.py) on a machine with nomatplotlib
library installed, as the library was missing ininstall_requires
list ofsetup.py
file.
Code changes
- Fixed some typos in function comments.
- Added function annotations to every single function in the library.