首页 > 解决方案 > 使用 python 转换 JSON 输出

问题描述

使用 watson 语音转文本我得到了以下输出。

{'results': [{'alternatives': [{'timestamps': [['I', 0.09, 0.16], ["can't", 0.16, 0.48], ['even', 0.48, 0.67], ['believe', 0.67, 0.96], ['Michigan', 0.96, 1.45], ['went', 1.45, 1.74], ['for', 1.74, 1.87], ['two', 1.87, 2.1], ['against', 2.1, 2.44], ['always', 2.44, 2.72], ['you', 2.72, 3.05], ['should', 3.29, 3.55], ['just', 3.55, 3.72], ['play', 3.72, 3.89], ['it', 3.89, 4.02], ['safe', 4.02, 4.24], ['with', 4.24, 4.36], ['a', 4.36, 4.4], ['field', 4.4, 4.77], ['goal', 4.77, 5.04], ['whatever', 5.09, 5.47], ['you', 5.47, 5.62], ['said', 5.62, 5.9], ['that', 5.9, 6.12], ['own', 6.62, 6.89], ['aging', 6.89, 7.23], ['Pearson', 7.23, 7.95], ['is', 7.98, 8.14], ['ten', 8.14, 8.36], ['thousand', 8.36, 8.72], ['yard', 8.72, 8.99], ['record', 8.99, 9.5]], 'confidence': 0.752, 'transcript': "I can't even believe Michigan went for two against always you should just play it safe with a field goal whatever you said that own aging Pearson is ten thousand yard record "}], 'final': True}, {'alternatives': [{'timestamps': [['while', 10.34, 11.06]], 'confidence': 0.417, 'transcript': 'while '}], 'final': True}, {'alternatives': [{'timestamps': [['yeah', 12.3, 12.81], ['sure', 13.34, 13.78]], 'confidence': 0.556, 'transcript': 'yeah sure '}], 'final': True}, {'alternatives': [{'timestamps': [['and', 14.42, 14.73], ["here's", 14.73, 15.12], ['our', 15.12, 15.21], ['calamari', 15.21, 15.86], ['Sir', 15.86, 16.24]], 'confidence': 0.959, 'transcript': "and here's our calamari Sir "}], 'final': True}, {'alternatives': [{'timestamps': [['faster', 17.56, 17.97], ['wow', 18.01, 18.36], ['this', 18.36, 18.55], ['food', 18.55, 18.78], ['looks', 18.78, 18.92], ['amazing', 18.92, 19.53], ['thank', 19.56, 19.82], ['you', 19.82, 20.03], ['south', 20.48, 21.02], ['let', 21.17, 21.33], ['me', 21.33, 21.46], ['just', 21.46, 21.71], ['tell', 21.71, 21.92], ['you', 21.92, 22.16], ['yesterday', 22.37, 23.12], ['when', 23.15, 23.37], ['means', 23.37, 23.73], ['easy', 23.73, 24.01], ['at', 24.01, 24.15], ['blackfriday', 24.15, 24.59], ['shopping', 24.59, 25.13], ['like', 25.19, 25.51], ['L.', 25.59, 25.82], ['M.', 25.82, 26.15], ['fricking', 26.18, 26.58], ['Gee', 26.58, 26.97], ['it', 27.0, 27.15], ['was', 27.15, 27.37], ['cruel', 27.53, 27.81], ['Razi', 27.97, 28.73], ['we', 28.85, 29.08], ['started', 29.08, 29.54], ['me', 29.54, 29.73], ['sis', 29.73, 30.04], ['and', 30.04, 30.17], ['like', 30.17, 30.47]], 'confidence': 0.648, 'transcript': 'faster wow this food looks amazing thank you south let me just tell you yesterday when means easy at blackfriday shopping like L. M. fricking Gee it was cruel Razi we started me sis and like '}], 'final': True}, {'alternatives': [{'timestamps': [['the', 31.31, 31.39], ['sales', 31.39, 31.77], ['were', 31.77, 32.03], ['horrendous', 32.09, 32.93], ['so', 33.19, 33.37], ['then', 33.37, 33.81], ['we', 33.88, 34.17], ['went', 34.17, 34.52], ['to', 34.52, 34.98], ['Charlotte', 35.01, 35.46], ['russe', 35.46, 35.81], ['and', 35.81, 35.97], ['let', 35.97, 36.08], ['me', 36.08, 36.17], ['tell', 36.17, 36.38], ['you', 36.38, 36.51], ['I', 36.51, 36.63], ['got', 36.63, 36.87], ['some', 36.87, 37.11], ['killer', 37.25, 37.86], ['deals', 37.89, 38.35], ['there', 38.35, 38.73], ['are', 39.13, 39.27], ['you', 39.27, 39.49], ['listening', 39.8, 40.33], ['to', 40.33, 40.47], ['everything', 40.47, 40.91], ["I'm", 40.91, 41.05], ['saying', 41.05, 41.61], ['yeah', 42.03, 42.39], ['yeah', 42.39, 42.8], ['no', 42.83, 43.2], ['of', 43.26, 43.37], ['course', 43.37, 43.85], ['not', 43.88, 44.12], ["it's", 44.12, 44.24], ['just', 44.24, 44.4], ['that', 44.4, 44.63], ['this', 44.63, 44.84], ['food', 44.84, 45.26], ['is', 45.26, 45.51], ['absolutely', 45.54, 46.17], ['fantastic', 46.17, 47.03], ['and', 47.35, 47.62], ['I', 47.62, 47.72], ['think', 47.72, 47.92], ['I', 47.92, 47.97], ['need', 47.97, 48.09], ['to', 48.09, 48.16], ['go', 48.16, 48.26], ['complement', 48.26, 48.71], ['the', 48.71, 48.77], ['chef', 48.77, 49.21]], 'confidence': 0.857, 'transcript': "the sales were horrendous so then we went to Charlotte russe and let me tell you I got some killer deals there are you listening to everything I'm saying yeah yeah no of course not it's just that this food is absolutely fantastic and I think I need to go complement the chef "}], 'final': True}, {'alternatives': [{'timestamps': [['our', 49.9, 50.04], ['son', 50.04, 50.5], ['son', 50.77, 51.21]], 'confidence': 0.491, 'transcript': 'our son son '}], 'final': True}, {'alternatives': [{'timestamps': [['yes', 51.8, 52.04], ['Sir', 52.04, 52.25], ['what', 52.25, 52.39], ['can', 52.39, 52.51], ['I', 52.51, 52.55], ['do', 52.55, 52.7], ['for', 52.7, 52.85], ['you', 52.85, 53.08], ["I'm", 53.44, 53.95], ['in', 53.98, 54.16], ['love', 54.16, 54.56], ['with', 54.56, 54.68], ['this', 54.68, 54.82], ['calamari', 54.82, 55.4], ['please', 55.4, 55.7], ['just', 55.7, 55.96], ['give', 56.21, 56.39], ['my', 56.39, 56.5], ['regards', 56.5, 56.92], ['the', 56.92, 57.03], ['shaft', 57.03, 57.38], ['of', 57.67, 57.87], ['course', 57.87, 58.39], ['Sir', 58.39, 58.63], ['we', 58.63, 58.77], ['love', 58.77, 59.2], ['to', 59.2, 59.3], ['hear', 59.3, 59.53], ['that', 59.53, 59.88], ['thank', 60.05, 60.35], ['you', 60.35, 60.47], ['again', 60.47, 60.85], ['for', 60.85, 61.01], ['your', 61.01, 61.15], ['business', 61.15, 61.87]], 'confidence': 0.92, 'transcript': "yes Sir what can I do for you I'm in love with this calamari please just give my regards the shaft of course Sir we love to hear that thank you again for your business "}], 'final': True}], 'result_index': 0, 'speaker_labels': [{'from': 0.09, 'to': 0.16, 'speaker': 0, 'confidence': 0.413, 'final': False}, {'from': 0.16, 'to': 0.48, 'speaker': 0, 'confidence': 0.413, 'final': False}, {'from': 0.48, 'to': 0.67, 'speaker': 0, 'confidence': 0.413, 'final': False}, {'from': 0.67, 'to': 0.96, 'speaker': 0, 'confidence': 0.413, 'final': False}, {'from': 0.96, 'to': 1.45, 'speaker': 0, 'confidence': 0.413, 'final': False}, {'from': 1.45, 'to': 1.74, 'speaker': 0, 'confidence': 0.413, 'final': False}, {'from': 1.74, 'to': 1.87, 'speaker': 0, 'confidence': 0.413, 'final': False}, {'from': 1.87, 'to': 2.1, 'speaker': 0, 'confidence': 0.413, 'final': False}, {'from': 2.1, 'to': 2.44, 'speaker': 0, 'confidence': 0.413, 'final': False}, {'from': 2.44, 'to': 2.72, 'speaker': 0, 'confidence': 0.413, 'final': False}, {'from': 2.72, 'to': 3.05, 'speaker': 0, 'confidence': 0.413, 'final': False}, {'from': 3.29, 'to': 3.55, 'speaker': 0, 'confidence': 0.448, 'final': False}, {'from': 3.55, 'to': 3.72, 'speaker': 0, 'confidence': 0.448, 'final': False}, {'from': 3.72, 'to': 3.89, 'speaker': 0, 'confidence': 0.448, 'final': False}, {'from': 3.89, 'to': 4.02, 'speaker': 0, 'confidence': 0.448, 'final': False}, {'from': 4.02, 'to': 4.24, 'speaker': 0, 'confidence': 0.448, 'final': False}, {'from': 4.24, 'to': 4.36, 'speaker': 0, 'confidence': 0.448, 'final': False}, {'from': 4.36, 'to': 4.4, 'speaker': 0, 'confidence': 0.448, 'final': False}, {'from': 4.4, 'to': 4.77, 'speaker': 0, 'confidence': 0.448, 'final': False}, {'from': 4.77, 'to': 5.04, 'speaker': 0, 'confidence': 0.448, 'final': False}, {'from': 5.09, 'to': 5.47, 'speaker': 1, 'confidence': 0.527, 'final': False}, {'from': 5.47, 'to': 5.62, 'speaker': 1, 'confidence': 0.527, 'final': False}, {'from': 5.62, 'to': 5.9, 'speaker': 1, 'confidence': 0.527, 'final': False}, {'from': 5.9, 'to': 6.12, 'speaker': 1, 'confidence': 0.527, 'final': False}, {'from': 6.62, 'to': 6.89, 'speaker': 0, 'confidence': 0.561, 'final': False}, {'from': 6.89, 'to': 7.23, 'speaker': 0, 'confidence': 0.561, 'final': False}, {'from': 7.23, 'to': 7.95, 'speaker': 0, 'confidence': 0.561, 'final': False}, {'from': 7.98, 'to': 8.14, 'speaker': 0, 'confidence': 0.501, 'final': False}, {'from': 8.14, 'to': 8.36, 'speaker': 0, 'confidence': 0.501, 'final': False}, {'from': 8.36, 'to': 8.72, 'speaker': 0, 'confidence': 0.501, 'final': False}, {'from': 8.72, 'to': 8.99, 'speaker': 0, 'confidence': 0.501, 'final': False}, {'from': 8.99, 'to': 9.5, 'speaker': 0, 'confidence': 0.501, 'final': False}, {'from': 10.34, 'to': 11.06, 'speaker': 1, 'confidence': 0.381, 'final': False}, {'from': 12.3, 'to': 12.81, 'speaker': 1, 'confidence': 0.462, 'final': False}, {'from': 13.34, 'to': 13.78, 'speaker': 1, 'confidence': 0.448, 'final': False}, {'from': 14.42, 'to': 14.73, 'speaker': 0, 'confidence': 0.369, 'final': False}, {'from': 14.73, 'to': 15.12, 'speaker': 0, 'confidence': 0.369, 'final': False}, {'from': 15.12, 'to': 15.21, 'speaker': 0, 'confidence': 0.369, 'final': False}, {'from': 15.21, 'to': 15.86, 'speaker': 0, 'confidence': 0.369, 'final': False}, {'from': 15.86, 'to': 16.24, 'speaker': 0, 'confidence': 0.369, 'final': False}, {'from': 17.56, 'to': 17.97, 'speaker': 1, 'confidence': 0.424, 'final': False}, {'from': 18.01, 'to': 18.36, 'speaker': 0, 'confidence': 0.623, 'final': False}, {'from': 18.36, 'to': 18.55, 'speaker': 0, 'confidence': 0.623, 'final': False}, {'from': 18.55, 'to': 18.78, 'speaker': 0, 'confidence': 0.623, 'final': False}, {'from': 18.78, 'to': 18.92, 'speaker': 0, 'confidence': 0.623, 'final': False}, {'from': 18.92, 'to': 19.53, 'speaker': 0, 'confidence': 0.623, 'final': False}, {'from': 19.56, 'to': 19.82, 'speaker': 0, 'confidence': 0.614, 'final': False}, {'from': 19.82, 'to': 20.03, 'speaker': 0, 'confidence': 0.614, 'final': False}, {'from': 20.48, 'to': 21.02, 'speaker': 1, 'confidence': 0.446, 'final': False}, {'from': 21.17, 'to': 21.33, 'speaker': 1, 'confidence': 0.458, 'final': False}, {'from': 21.33, 'to': 21.46, 'speaker': 1, 'confidence': 0.458, 'final': False}, {'from': 21.46, 'to': 21.71, 'speaker': 1, 'confidence': 0.458, 'final': False}, {'from': 21.71, 'to': 21.92, 'speaker': 1, 'confidence': 0.458, 'final': False}, {'from': 21.92, 'to': 22.16, 'speaker': 1, 'confidence': 0.458, 'final': False}, {'from': 22.37, 'to': 23.12, 'speaker': 1, 'confidence': 0.563, 'final': False}, {'from': 23.15, 'to': 23.37, 'speaker': 1, 'confidence': 0.612, 'final': False}, {'from': 23.37, 'to': 23.73, 'speaker': 1, 'confidence': 0.612, 'final': False}, {'from': 23.73, 'to': 24.01, 'speaker': 1, 'confidence': 0.612, 'final': False}, {'from': 24.01, 'to': 24.15, 'speaker': 1, 'confidence': 0.612, 'final': False}, {'from': 24.15, 'to': 24.59, 'speaker': 1, 'confidence': 0.612, 'final': False}, {'from': 24.59, 'to': 25.13, 'speaker': 1, 'confidence': 0.612, 'final': False}, {'from': 25.19, 'to': 25.51, 'speaker': 1, 'confidence': 0.568, 'final': False}, {'from': 25.59, 'to': 25.82, 'speaker': 1, 'confidence': 0.526, 'final': False}, {'from': 25.82, 'to': 26.15, 'speaker': 1, 'confidence': 0.526, 'final': False}, {'from': 26.18, 'to': 26.58, 'speaker': 1, 'confidence': 0.482, 'final': False}, {'from': 26.58, 'to': 26.97, 'speaker': 1, 'confidence': 0.482, 'final': False}, {'from': 27.0, 'to': 27.15, 'speaker': 1, 'confidence': 0.508, 'final': False}, {'from': 27.15, 'to': 27.37, 'speaker': 1, 'confidence': 0.508, 'final': False}, {'from': 27.53, 'to': 27.81, 'speaker': 1, 'confidence': 0.457, 'final': False}, {'from': 27.97, 'to': 28.73, 'speaker': 1, 'confidence': 0.466, 'final': False}, {'from': 28.85, 'to': 29.08, 'speaker': 1, 'confidence': 0.525, 'final': False}, {'from': 29.08, 'to': 29.54, 'speaker': 1, 'confidence': 0.525, 'final': False}, {'from': 29.54, 'to': 29.73, 'speaker': 1, 'confidence': 0.525, 'final': False}, {'from': 29.73, 'to': 30.04, 'speaker': 1, 'confidence': 0.525, 'final': False}, {'from': 30.04, 'to': 30.17, 'speaker': 1, 'confidence': 0.525, 'final': False}, {'from': 30.17, 'to': 30.47, 'speaker': 1, 'confidence': 0.525, 'final': False}, {'from': 31.31, 'to': 31.39, 'speaker': 1, 'confidence': 0.461, 'final': False}, {'from': 31.39, 'to': 31.77, 'speaker': 1, 'confidence': 0.461, 'final': False}, {'from': 31.77, 'to': 32.03, 'speaker': 1, 'confidence': 0.461, 'final': False}, {'from': 32.09, 'to': 32.93, 'speaker': 1, 'confidence': 0.616, 'final': False}, {'from': 33.19, 'to': 33.37, 'speaker': 1, 'confidence': 0.526, 'final': False}, {'from': 33.37, 'to': 33.81, 'speaker': 1, 'confidence': 0.526, 'final': False}, {'from': 33.88, 'to': 34.17, 'speaker': 1, 'confidence': 0.502, 'final': False}, {'from': 34.17, 'to': 34.52, 'speaker': 1, 'confidence': 0.502, 'final': False}, {'from': 34.52, 'to': 34.98, 'speaker': 1, 'confidence': 0.502, 'final': False}, {'from': 35.01, 'to': 35.46, 'speaker': 1, 'confidence': 0.609, 'final': False}, {'from': 35.46, 'to': 35.81, 'speaker': 1, 'confidence': 0.609, 'final': False}, {'from': 35.81, 'to': 35.97, 'speaker': 1, 'confidence': 0.609, 'final': False}, {'from': 35.97, 'to': 36.08, 'speaker': 1, 'confidence': 0.609, 'final': False}, {'from': 36.08, 'to': 36.17, 'speaker': 1, 'confidence': 0.609, 'final': False}, {'from': 36.17, 'to': 36.38, 'speaker': 1, 'confidence': 0.609, 'final': False}, {'from': 36.38, 'to': 36.51, 'speaker': 1, 'confidence': 0.609, 'final': False}, {'from': 36.51, 'to': 36.63, 'speaker': 1, 'confidence': 0.609, 'final': False}, {'from': 36.63, 'to': 36.87, 'speaker': 1, 'confidence': 0.609, 'final': False}, {'from': 36.87, 'to': 37.11, 'speaker': 1, 'confidence': 0.609, 'final': False}, {'from': 37.25, 'to': 37.86, 'speaker': 1, 'confidence': 0.466, 'final': False}, {'from': 37.89, 'to': 38.35, 'speaker': 1, 'confidence': 0.577, 'final': False}, {'from': 38.35, 'to': 38.73, 'speaker': 1, 'confidence': 0.577, 'final': False}, {'from': 39.13, 'to': 39.27, 'speaker': 1, 'confidence': 0.517, 'final': False}, {'from': 39.27, 'to': 39.49, 'speaker': 1, 'confidence': 0.517, 'final': False}, {'from': 39.8, 'to': 40.33, 'speaker': 1, 'confidence': 0.56, 'final': False}, {'from': 40.33, 'to': 40.47, 'speaker': 1, 'confidence': 0.56, 'final': False}, {'from': 40.47, 'to': 40.91, 'speaker': 1, 'confidence': 0.56, 'final': False}, {'from': 40.91, 'to': 41.05, 'speaker': 1, 'confidence': 0.56, 'final': False}, {'from': 41.05, 'to': 41.61, 'speaker': 1, 'confidence': 0.56, 'final': False}, {'from': 42.03, 'to': 42.39, 'speaker': 0, 'confidence': 0.542, 'final': False}, {'from': 42.39, 'to': 42.8, 'speaker': 0, 'confidence': 0.542, 'final': False}, {'from': 42.83, 'to': 43.2, 'speaker': 0, 'confidence': 0.441, 'final': False}, {'from': 43.26, 'to': 43.37, 'speaker': 0, 'confidence': 0.629, 'final': False}, {'from': 43.37, 'to': 43.85, 'speaker': 0, 'confidence': 0.629, 'final': False}, {'from': 43.88, 'to': 44.12, 'speaker': 0, 'confidence': 0.627, 'final': False}, {'from': 44.12, 'to': 44.24, 'speaker': 0, 'confidence': 0.627, 'final': False}, {'from': 44.24, 'to': 44.4, 'speaker': 0, 'confidence': 0.627, 'final': False}, {'from': 44.4, 'to': 44.63, 'speaker': 0, 'confidence': 0.627, 'final': False}, {'from': 44.63, 'to': 44.84, 'speaker': 0, 'confidence': 0.627, 'final': False}, {'from': 44.84, 'to': 45.26, 'speaker': 0, 'confidence': 0.627, 'final': False}, {'from': 45.26, 'to': 45.51, 'speaker': 0, 'confidence': 0.627, 'final': False}, {'from': 45.54, 'to': 46.17, 'speaker': 0, 'confidence': 0.585, 'final': False}, {'from': 46.17, 'to': 47.03, 'speaker': 0, 'confidence': 0.585, 'final': False}, {'from': 47.35, 'to': 47.62, 'speaker': 0, 'confidence': 0.622, 'final': False}, {'from': 47.62, 'to': 47.72, 'speaker': 0, 'confidence': 0.622, 'final': False}, {'from': 47.72, 'to': 47.92, 'speaker': 0, 'confidence': 0.622, 'final': False}, {'from': 47.92, 'to': 47.97, 'speaker': 0, 'confidence': 0.622, 'final': False}, {'from': 47.97, 'to': 48.09, 'speaker': 0, 'confidence': 0.622, 'final': False}, {'from': 48.09, 'to': 48.16, 'speaker': 0, 'confidence': 0.622, 'final': False}, {'from': 48.16, 'to': 48.26, 'speaker': 0, 'confidence': 0.622, 'final': False}, {'from': 48.26, 'to': 48.71, 'speaker': 0, 'confidence': 0.622, 'final': False}, {'from': 48.71, 'to': 48.77, 'speaker': 0, 'confidence': 0.622, 'final': False}, {'from': 48.77, 'to': 49.21, 'speaker': 0, 'confidence': 0.622, 'final': False}, {'from': 49.9, 'to': 50.04, 'speaker': 0, 'confidence': 0.5, 'final': False}, {'from': 50.04, 'to': 50.5, 'speaker': 0, 'confidence': 0.5, 'final': False}, {'from': 50.77, 'to': 51.21, 'speaker': 0, 'confidence': 0.532, 'final': False}, {'from': 51.8, 'to': 52.04, 'speaker': 0, 'confidence': 0.502, 'final': False}, {'from': 52.04, 'to': 52.25, 'speaker': 0, 'confidence': 0.502, 'final': False}, {'from': 52.25, 'to': 52.39, 'speaker': 0, 'confidence': 0.502, 'final': False}, {'from': 52.39, 'to': 52.51, 'speaker': 0, 'confidence': 0.502, 'final': False}, {'from': 52.51, 'to': 52.55, 'speaker': 0, 'confidence': 0.502, 'final': False}, {'from': 52.55, 'to': 52.7, 'speaker': 0, 'confidence': 0.502, 'final': False}, {'from': 52.7, 'to': 52.85, 'speaker': 0, 'confidence': 0.502, 'final': False}, {'from': 52.85, 'to': 53.08, 'speaker': 0, 'confidence': 0.502, 'final': False}, {'from': 53.44, 'to': 53.95, 'speaker': 0, 'confidence': 0.576, 'final': False}, {'from': 53.98, 'to': 54.16, 'speaker': 0, 'confidence': 0.636, 'final': False}, {'from': 54.16, 'to': 54.56, 'speaker': 0, 'confidence': 0.636, 'final': False}, {'from': 54.56, 'to': 54.68, 'speaker': 0, 'confidence': 0.636, 'final': False}, {'from': 54.68, 'to': 54.82, 'speaker': 0, 'confidence': 0.636, 'final': False}, {'from': 54.82, 'to': 55.4, 'speaker': 0, 'confidence': 0.636, 'final': False}, {'from': 55.4, 'to': 55.7, 'speaker': 0, 'confidence': 0.636, 'final': False}, {'from': 55.7, 'to': 55.96, 'speaker': 0, 'confidence': 0.636, 'final': False}, {'from': 56.21, 'to': 56.39, 'speaker': 0, 'confidence': 0.639, 'final': False}, {'from': 56.39, 'to': 56.5, 'speaker': 0, 'confidence': 0.639, 'final': False}, {'from': 56.5, 'to': 56.92, 'speaker': 0, 'confidence': 0.639, 'final': False}, {'from': 56.92, 'to': 57.03, 'speaker': 0, 'confidence': 0.639, 'final': False}, {'from': 57.03, 'to': 57.38, 'speaker': 0, 'confidence': 0.639, 'final': False}, {'from': 57.67, 'to': 57.87, 'speaker': 0, 'confidence': 0.631, 'final': False}, {'from': 57.87, 'to': 58.39, 'speaker': 0, 'confidence': 0.631, 'final': False}, {'from': 58.39, 'to': 58.63, 'speaker': 0, 'confidence': 0.631, 'final': False}, {'from': 58.63, 'to': 58.77, 'speaker': 0, 'confidence': 0.631, 'final': False}, {'from': 58.77, 'to': 59.2, 'speaker': 0, 'confidence': 0.631, 'final': False}, {'from': 59.2, 'to': 59.3, 'speaker': 0, 'confidence': 0.631, 'final': False}, {'from': 59.3, 'to': 59.53, 'speaker': 0, 'confidence': 0.631, 'final': False}, {'from': 59.53, 'to': 59.88, 'speaker': 0, 'confidence': 0.631, 'final': False}, {'from': 60.05, 'to': 60.35, 'speaker': 0, 'confidence': 0.581, 'final': False}, {'from': 60.35, 'to': 60.47, 'speaker': 0, 'confidence': 0.581, 'final': False}, {'from': 60.47, 'to': 60.85, 'speaker': 0, 'confidence': 0.581, 'final': False}, {'from': 60.85, 'to': 61.01, 'speaker': 0, 'confidence': 0.581, 'final': False}, {'from': 61.01, 'to': 61.15, 'speaker': 0, 'confidence': 0.581, 'final': False}, {'from': 61.15, 'to': 61.87, 'speaker': 0, 'confidence': 0.581, 'final': True}]}

我希望将其转换为可用的格式并苦苦挣扎。

理想的格式是按说话者对带时间戳的单词进行分组和组合,并列出说话者标签、最小从和最大到。创建说话者句子列表。类似于下面:

表格示例

任何帮助,将不胜感激。

标签: jsonpython-3.xwatson

解决方案


您可以使用这个 json 并创建一个Pandas数据框。它具有根据您的需要对数据进行分组、聚合和排序的方法。


推荐阅读