You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2017/12/29 11:03:00 UTC

[kibble-scanners] branch master updated: additional emotional weighting available

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble-scanners.git


The following commit(s) were added to refs/heads/master by this push:
     new aeae757  additional emotional weighting available
aeae757 is described below

commit aeae757e939c2ac4ac94d3b7cb7dd2fcc467acbf
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Fri Dec 29 12:02:44 2017 +0100

    additional emotional weighting available
---
 src/plugins/utils/tone.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/plugins/utils/tone.py b/src/plugins/utils/tone.py
index a347205..03461f2 100644
--- a/src/plugins/utils/tone.py
+++ b/src/plugins/utils/tone.py
@@ -181,6 +181,12 @@ def picoTone(KibbleBit, bodies):
                 mood['negative'] = doc['negativity'] # Use the direct Bayesian score from picoAPI
                 mood['positive'] = doc['positivity'] # Use the direct Bayesian score from picoAPI
                 mood['neutral'] = doc['neutrality'] # Calc neutrality to favor a middle sentiment score, ignore high/low
+                
+                # Additional (optional) emotion weighting
+                if 'emotions' in doc:
+                    for k, v in doc['emotions'].items():
+                        mood[k] = v / 100 # Value is betwen 0 and 100.
+                        
                 moods[int(doc['id'])] = mood # Replace moods[X] with the actual mood
                 
         else:

-- 
To stop receiving notification emails like this one, please contact
['"commits@kibble.apache.org" <co...@kibble.apache.org>'].