Parsing the NLU results

rasa-nlu

(Nahid Alam) #1

I am using Rasa NLU 0.12.3 I need to parse the NLU result to look into identified intent and entities by the NLU model. But following @Juste tutorial on weatherbot, the output returned by the nlu_model.py is not a proper JSON [tested on online JSON parser] so I am not sure how to parse it to read the intent .

Any suggestion?

An example output below

{'intent': {'name': 'offer_services', 'confidence': 0.49275112949282734}, 'entities': [{'start': 6, 'end': 14, 'value': 'services', 'entity': 'services_list', 'confidence': 0.8207791793698344, 'extractor': 'ner_crf'}], 'intent_ranking': [{'name': 'offer_services', 'confidence': 0.49275112949282734}, {'name': 'show_upcoming_renewals', 'confidence': 0.0889372140231687}, {'name': 'submit_for_approval', 'confidence': 0.08696105152807411}, {'name': 'goodbye', 'confidence': 0.06337379542936697}, {'name': 'negotiate', 'confidence': 0.06281124613725}, {'name': 'start_process', 'confidence': 0.0534521719377908}, {'name': 'generate_proposal', 'confidence': 0.05167263065681973}, {'name': 'show_renewal_method', 'confidence': 0.04479267432179068}, {'name': 'show_deal_info', 'confidence': 0.03705407654441367}, {'name': 'greet', 'confidence': 0.018194009928498376}], 'text': 'offer services'}


(Nahid Alam) #2

nevermind, I used this result inside json.dumps and it resolved it.


(Juste) #3

Glad you found the solution @nahidalam :slight_smile: