return ExtractorResult(None, stim, self, raw=raw)
def _parse_response_json(self, json):
keys = []
values = []
for k, v in json.items():
if k == "faceAttributes":
k = "face"
if isinstance(v, dict):
subkeys, subvalues = self._parse_response_json(v)
keys.extend(["%s_%s" % (k, s) for s in subkeys])
values.extend(subvalues)
elif isinstance(v, list):
// Hard coded to this extractor
for attr in v:
if k == "hairColor":
keys.append("%s" % attr["color"])
elif k == "accessories":
keys.append("%s_%s" % (k, attr["type"]))
else:
continue
values.append(attr["confidence"])
else:
keys.append(k)
values.append(v)
return keys, values
def _to_df(self, result):