Update error handling
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# Python-SentiStrength
|
# Python-SentiStrength
|
||||||
Python 3 Wrapper for SentiStrength, reads a single or multiple input with options for binary class or scale output.
|
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
|
## Installation
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,10 @@ class PySentiStr:
|
|||||||
stdout_text = stdout_text.replace('\r\n','')
|
stdout_text = stdout_text.replace('\r\n','')
|
||||||
senti_score = stdout_text.split(' ')
|
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]
|
senti_score = [int(i) for i in senti_score]
|
||||||
if score == 'scale': # Returns from -4 to 4
|
if score == 'scale': # Returns from -4 to 4
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="sentistrength",
|
name="sentistrength",
|
||||||
version="0.0.8",
|
version="0.0.9",
|
||||||
author="Zhun Hung",
|
author="Zhun Hung",
|
||||||
author_email="yongzhunhung@gmail.com",
|
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.",
|
description="Python 3 Wrapper for SentiStrength, reads a single or multiple input with options for binary class or scale output.",
|
||||||
|
|||||||
Reference in New Issue
Block a user