Search in sources :

Example 6 with NLUCoerce

use of ai.saiy.android.nlu.NLUCoerce in project Saiy-PS by brandall76.

the class ResolveSaiy method unpack.

public void unpack(@NonNull final JSONObject payload) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "unpacking");
    }
    final GsonBuilder builder = new GsonBuilder();
    builder.disableHtmlEscaping();
    builder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
    final Gson gson = builder.create();
    nluSaiy = gson.fromJson(payload.toString(), new TypeToken<NLUSaiy>() {
    }.getType());
    new NLUCoerce(getNLUSaiy(), getContext(), getSupportedLanguage(), getVRLocale(), getTTSLocale(), getConfidenceArray(), getResultsArray()).coerce();
}
Also used : GsonBuilder(com.google.gson.GsonBuilder) NLUCoerce(ai.saiy.android.nlu.NLUCoerce) Gson(com.google.gson.Gson)

Aggregations

NLUCoerce (ai.saiy.android.nlu.NLUCoerce)6 Gson (com.google.gson.Gson)4 GsonBuilder (com.google.gson.GsonBuilder)4 AIResponse (ai.api.model.AIResponse)1 TypeToken (com.google.gson.reflect.TypeToken)1