Home > Enterprise >  Dictionary list how to compare probability and class type
Dictionary list how to compare probability and class type

Time:11-10

Simple python question but I still cant seem to get it right.

ints = [{'intent': 'goodbyes', 'probablility': '0.43079117'}, {'intent': 'compliments', 'probablility': '0.3078408'}]

#how do i check that intent = goodbyes AND probability is > than 0.5 

CodePudding user response:


def check_intent(ints):
    for i in ints:
        if i['intent'] == 'goodbyes' and i['probablility'] > 0.5:
            return True
    return False
  • Related