def to_sentiment_json(doc_id, sent, label):
 json_doc = {}
 json_doc['doc_id'] = doc_id
 json_doc['sentiment'] = float(('%.3f' % sent))
 json_doc['label'] = label
 return json.dumps(json_doc)

def to_sentiment_json ( doc_id , sent , label ) : json_doc = { } json_doc [ 'doc_id' ] = doc_id json_doc [ 'sentiment' ] = float ( ( '%.3f' % sent ) ) json_doc [ 'label' ] = label return json . dumps ( json_doc )
convert the sentiment info to json .