问题
The requirement is to capture the keywords from the user input given in chat window and make a web api call to get a file link.
I have four different categories into which the user input query can be classified:
--Operating Group --Technology --Geography --Themes
I have configured a LUIS intent and listed these four categories as entitites. However, the issue now is that the entity list cannot be predefined since there can be any number of search keywords which can be passed to web api. I am now confused if there is any other way round for this requirement such as removing the stop words and passing the list of keywords Web API.
Code :
[LuisIntent("Credentials")]
public async Task Credentials(IDialogContext context, LuisResult result)
{
try
{
if (result.Entities.Count() == 0)
{
if ((result.Query.ToString().ToLower() == "geo" || result.Query.ToString().ToLower() == "operating group" || result.Query.ToString().ToLower() == "technology" || result.Query.ToString().ToLower() == "Themes"))
{
}
else
{
await context.Forward(new QnABotFeedbackDialog(updateQna, result.Query, rotationTemStorage, qnaInvalidMessageCount), AfterCredentialDialog, context.Activity, CancellationToken.None);
}
}
else if (result.Entities.Count() > 0)
{
string efilterType = string.Empty;
if (result.Entities.Count() > 0)
{
foreach (var i in result.Entities)
{
if (efilterType == string.Empty)
{
efilterType = i.Entity;
}
else
{
efilterType = efilterType + "," + i.Entity;
}
}
}
await CredentialsPersonalisation(context, efilterType);
}
}
catch (Exception ex)
{
await context.PostAsync(ex.Message);
}
}
回答1:
However, we do not have a fixed set of keywords which we could pre-configure in Entity lists.
I think you misunderstood what an entity is.
Simple
entities are not pre-configured lists, it learns from your utterances and for the calls after. So it's basically what you want. So you have to create your three entities as simple, then add utterances and tag the entities in those utterances. Do not use always the same value for an entity.
For example, add the following utterances:
give me the file for fs in North America region on RPA
And tag fs
as OperationGroup
entity, North America
as Geography
entity, and RPA
as Technology
entity
Can I have the file for PRD in Europe about LUIS?
And tag PRD
as OperationGroup
entity, Europe
as Geography
entity, and LUIS
as Technology
entity
Sidenote: if you have fixed lists, which is not the case here, you must create an entity of type List
:
来源:https://stackoverflow.com/questions/54918690/alternative-for-having-luis-intent