def _to_df(self, result):
response = result._data["response"]
duration = result.stim.durationdata = []
for r in response.get("annotationResults", []):
for key, res in r.items():
if "Label" in key:
for annot in res:
feats = [annot["entity"]["description"]]
for category in annot.get("categoryEntities", []):
feats.append("category_" + category["description"])
if key == "frameLabelAnnotations":
data.extend(self._parse_frame(feats,
annot,
"confidence",
duration))
else:
// Good for shot or segment labels
data.extend(self._parse_label(feats, annot))
elif key == "shotAnnotations":
After Change
df = pd.DataFrame(list(data.values()))
// If multiple confidences were parsed, uses the last one
if len(data) > 0:
onsets, durations = zip(*list(data.keys()))
result._onsets = onsets
result._durations = durations
result.features = list(df.columns)
return df