2016-12-30 2 views
0

다국어 봇을 만들고 자연 언어를 처리하기 위해 LUIS를 사용하고 싶지만 동일한 봇에서 두 모델을 어떻게 만들 수 있는지 알고 싶습니다. 각 언어 당 하나.LuisRecognizer를 각 언어에 대한 별도의 모델로 사용하는 방법

나는 그 때문에 OD 가능하다는 것을 알고 documentation : 당신은 당신이 각 언어에 대해 별도의 모델 로 LuisRecognizer을 구성 할 수 있습니다 처리 자연 언어 을 수행하는 루이스와 같은 시스템을 사용하는 경우

당신의 봇이 지원하고 SDK가 자동으로 사용자가 선호하는 로케일과 일치하는 모델을 선택합니다.

어떻게하면됩니까? 그것은 작동

var model_en = 'https://api.projectoxford.ai/luis/v2.0/apps/{YOUR ENGLISH MODEL}'; 
var model_es = 'https://api.projectoxford.ai/luis/v2.0/apps/{YOUR SPANISH MODEL}'; 
var recognizer = new builder.LuisRecognizer({'en': model_en, 'es' : model_es}); 

//========================================================= 
// Bots Dialogs 
//========================================================= 
var intents = new builder.IntentDialog({ recognizers: [recognizer] }); 

intents.matches('hello', function (session) { 
    session.send('Hello!'); 
}); 

intents.matches('goodbye', function (session) { 
    session.send('Goodbye!'); 
}); 

intents.matches('spanish', function (session) { 
    session.send('Switching to Spanish Model'); 
    session.preferredLocale('es'); 
}); 

intents.matches('english', function (session) { 
    session.send('Switching to English Model'); 
    session.preferredLocale('en'); 
}); 

intents.matches('None', function (session) { 
    if (session.preferredLocale() == 'en') 
    { 
     session.send('I do not understand'); 
    } 
    else 
    { 
     session.send('No entiendo'); 
    } 
}); 


bot.dialog('/', intents); 

답변

2

감사 두 가지 언어를 사용하고 모델의 사용자 전환을 할 수있는 로봇의 예입니다 :이 시도! 고맙습니다
+0

:

// Configure bots default locale and locale folder path. bot.set('localizerSettings', { botLocalePath: "./locale", defaultLocale: "es" }); // Create LUIS recognizer. //LUIS English var model = 'https://api.projectoxford.ai/luis/v2.0/apps/....'; var recognizer = new builder.LuisRecognizer(model); //LUIS Spanish var model_es = 'https://api.projectoxford.ai/luis/v2.0/apps/...'; var recognizer_es = new builder.LuisRecognizer(model_es); var dialog = new builder.IntentDialog({ recognizers: [recognizer, recognizer_es] }); //========================================================= // Bots Dialogs //========================================================= bot.dialog('/', dialog); 

당신에게 여기 –