def extract_sentiment(emotions):
 joy = [0, 0, 0]
 sorrow = [0, 0, 0]
 anger = [0, 0, 0]
 surprise = [0, 0, 0]
 odds = ['VERY_LIKELY', 'LIKELY', 'POSSIBLE']
 for i in range(len(odds)):
  joy[i] = sum(((f['joyLikelihood'] == odds[i]) for f in emotions))
  anger[i] = sum(((f['angerLikelihood'] == odds[i]) for f in emotions))
  sorrow[i] = sum(((f['sorrowLikelihood'] == odds[i]) for f in emotions))
  surprise[i] = sum(((f['surpriseLikelihood'] == odds[i]) for f in emotions))
 return (joy, anger, sorrow, surprise)

def extract_sentiment ( emotions ) : joy = [ 0 , 0 , 0 ] sorrow = [ 0 , 0 , 0 ] anger = [ 0 , 0 , 0 ] surprise = [ 0 , 0 , 0 ] odds = [ 'VERY_LIKELY' , 'LIKELY' , 'POSSIBLE' ] for i in range ( len ( odds ) ) : joy [ i ] = sum ( ( ( f [ 'joyLikelihood' ] == odds [ i ] ) for f in emotions ) ) anger [ i ] = sum ( ( ( f [ 'angerLikelihood' ] == odds [ i ] ) for f in emotions ) ) sorrow [ i ] = sum ( ( ( f [ 'sorrowLikelihood' ] == odds [ i ] ) for f in emotions ) ) surprise [ i ] = sum ( ( ( f [ 'surpriseLikelihood' ] == odds [ i ] ) for f in emotions ) ) return ( joy , anger , sorrow , surprise )
extract the sentiment from the facial annotations .