sentiments, entities = analyze_document(service, document)
sentiments = [sent for sent in sentiments if sent[0] is not None]
negative_sentiments = [
polarity for polarity, magnitude in sentiments if polarity < 0.0]
positive_sentiments = [
polarity for polarity, magnitude in sentiments if polarity > 0.0]
negative = sum(negative_sentiments)
positive = sum(positive_sentiments)
total = positive + negative
return (total, entities)