Update error handling

This commit is contained in:
zhunhung
2021-04-09 00:37:11 +08:00
parent 611e5d250e
commit 6ba96e5eef
3 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
# Python-SentiStrength
Python 3 Wrapper for SentiStrength, reads a single or multiple input with options for binary class or scale output.
Ensure that you have SentiStrength.jar file and SentiStrengthData Language folders, otherwise you can download them from http://sentistrength.wlv.ac.uk/.
Ensure that you have SentiStrength.jar file and SentiStrengthData Language folders, otherwise you can download them from http://sentistrength.wlv.ac.uk/. For jar file, you will have to email Dr. Mike Thelwall.
## Installation
+5 -2
View File
@@ -37,8 +37,11 @@ class PySentiStr:
stdout_text = stdout_text.rstrip().replace("\t"," ")
stdout_text = stdout_text.replace('\r\n','')
senti_score = stdout_text.split(' ')
senti_score = list(map(float, senti_score))
try:
senti_score = list(map(float, senti_score))
except:
raise Exception(stdout_text)
senti_score = [int(i) for i in senti_score]
if score == 'scale': # Returns from -4 to 4
+1 -1
View File
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools.setup(
name="sentistrength",
version="0.0.8",
version="0.0.9",
author="Zhun Hung",
author_email="yongzhunhung@gmail.com",
description="Python 3 Wrapper for SentiStrength, reads a single or multiple input with options for binary class or scale output.",