Last active
November 8, 2017 17:02
-
-
Save anacampesan/5363a22df6d0c59be7077c9d502312c9 to your computer and use it in GitHub Desktop.
Wit Free Text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
obj = json.loads('{"msg_id":"07kg0Z1uAQMmLN6lM","_text":"i want links to racing and horses","entities":{"links_category":[{"suggested":true,"confidence":0.97013993755778,"value":"racing","type":"value"},{"suggested":true,"confidence":0.94886424860786,"value":"horses","type":"value"}]}}') | |
entities = obj['entities'] | |
intents = [] | |
for key in entities: | |
aux = [] | |
for entity in entities[key]: | |
if entity['confidence'] > 0.6: | |
aux.append(entity['value']) | |
intents.append({ | |
'name': key, | |
'values': aux | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment