9d478d351665502019ac40a7302e769b9d3f6660,pliers/extractors/api/google.py,GoogleVideoIntelligenceAPIExtractor,_to_df,#GoogleVideoIntelligenceAPIExtractor#Any#,269

Before Change



    def _to_df(self, result):
        response = result._data["response"]
        duration = result.stim.duration
        data = []
        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
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: tyarkoni/pliers
Commit Name: 9d478d351665502019ac40a7302e769b9d3f6660
Time: 2018-04-17
Author: quinten.mcnamara@gmail.com
File Name: pliers/extractors/api/google.py
Class Name: GoogleVideoIntelligenceAPIExtractor
Method Name: _to_df


Project Name: vatlab/SoS
Commit Name: 48c26c0eb5d972e965ff678a9014ca0004e6fa20
Time: 2016-12-03
Author: ben.bog@gmail.com
File Name: sos/jupyter/completer.py
Class Name: SoS_Completer
Method Name: complete_text


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: cf1b498536c3f28cbd6c7d58d665655cdfaf571d
Time: 2016-11-15
Author: jonwayne@google.com
File Name: logging/cloud-client/export.py
Class Name:
Method Name: list_sinks


Project Name: pyannote/pyannote-audio
Commit Name: 8593cc5270492dba1bd12c2dc19420f06f8d557f
Time: 2020-03-31
Author: hbredin@users.noreply.github.com
File Name: pyannote/audio/augmentation/noise.py
Class Name: AddNoise
Method Name: __init__