As with constructing the payload, calculating the score can be defined in more than one way. The simplest approach is to average the score between all of the sentences in the text.
Another approach would be to create a weighted average of the text score, by disregarding the neutral sentences (scored between 0.35 and 0.65 or a narrower range) or giving them a lower weight than the strongly positive or negative sentences. When the standard average is used, the overall positivity or negativity of the text might be muffled by the neutral sentences in the text. Giving more weight to strongly positive or negative statements might closer approximate the human perception than an unweighted average does. You can read ...