📖GetResponse

CResponse GetResponse(string userInput)

userInput - Входные данные

Пример:

var data = new List<Data>
{
    new Data() { Text = "Вводимый текст", Reponse = "Возвращаемый текст", ReturnCode = -1 },
    new Data() { Text = "Вводимый текст x2", Reponse = "Возвращаемый текст x2", ReturnCode = 0 }
};

MultiAPI.ChatBot.Initialize(data);
var resp = MultiAPI.ChatBot.GetResponse("Входные данные");
Console.WriteLine("Response: " + resp.Response());

Описание:

Получаем возвратные данные которые можно будет использовать в дальнейшем.

Код:

ChatBot.cs
public static CResponse GetResponse(string userInput)
{
    var input = new Data() { Text = userInput };

    var prediction = predictionEngine.Predict(input);

    var matchingData = trainingData.Find(data => data.Response == prediction.Response);

    return new CResponse
    {
        Response = prediction.Response,
        ReturnCode = matchingData.ReturnCode
    };
}

Last updated

Was this helpful?