简体   繁体   中英

Microsoft Luis Chatbot: Extracting custom entity in the middle of conversation

I have an intent in LUIS. I can extract the desired entity when user input contain it initially. When the user forgets to input the entity, it will ask the user to input it.

The problem is the the user can use his own sentence that contain the entity to answer the question and I can't figure out how to extract this entity using Luis EntityRecognizer (NodeJS SDK) in the middle of the conversation.

How should I handle this? Thanks.

LuisRecognizer.recognize() is a static method, so you can call it by using the following code in the waterfall step after your Prompt.

builder.LuisRecognizer.recognize(session.message.text, '<model url>', 
  function (err, intents, entities) {
    if (entities) {
      var entity = builder.EntityRecognizer.findEntity(entities, 'TYPE');
      // do something with entity...
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM