'Returns the most likely intent and its probability for the input text.'

def process(self, message, **kwargs):

    if (not self.clf):
        intent = None
        intent_ranking = []
    else:
        X = message.get(u'text_features').reshape(1, (-1))
        (intent_ids, probabilities) = self.predict(X)
        intents = self.transform_labels_num2str(intent_ids)
        (intents, probabilities) = (intents.flatten(), probabilities.flatten())
        if ((intents.size > 0) and (probabilities.size > 0)):
            ranking = list(zip(list(intents), list(probabilities)))[:INTENT_RANKING_LENGTH]
            intent = {u'name': intents[0], u'confidence': probabilities[0]}
            intent_ranking = [{u'name': intent_name, u'confidence': score} for (intent_name, score) in ranking]
        else:
            intent = {u'name': None, u'confidence': 0.0}
            intent_ranking = []
    message.set(u'intent', intent, add_to_output=True)
    message.set(u'intent_ranking', intent_ranking, add_to_output=True)
