Utterance : I want to book a flight from Hyderabad to Bangalore next Monday preferably around afternoon with a return on next Friday preferably around evening .
Entities: FromDestination : Hyderabad,
ToDestination: Bangalore
Prebuilt Enties: Buiiltin.DateTimeV2 : Next Monday, Friday.
Builtin.DateTimeV2.TimeRange : Afternoon , Evening
.NET Code to recognize enties:
foreach(EntityRecommendation obj in result.Entities)
{
if(obj.Type == FlightBotConstants.fromDestination)
{
context.PrivateConversationData.SetValue<string>("fromDestination", Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(obj.Entity.ToLower()));
}
else if(obj.Type == FlightBotConstants.toDestination)
{
context.PrivateConversationData.SetValue<string>("toDestination", Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(obj.Entity.ToLower()));
}
else if(obj.Type == FlightBotConstants.prebuiltdate)
{
Chronic.Parser depparser = new Chronic.Parser();
var depDateResult = depparser.Parse(obj.Entity);
string departureDate = depDateResult.Start.Value.ToString("yyyy-MM-dd");
context.PrivateConversationData.SetValue<string>("departtDate", Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(departureDate));
}
else if(obj.Type == FlightBotConstants.prebuilttimeRange)
{
Chronic.Parser depTimeParser = new Chronic.Parser();
var deptimeResult = depTimeParser.Parse(obj.Entity);
var depStartTime = deptimeResult.Start.Value.TimeOfDay;
var depEndTime = deptimeResult.End.Value.TimeOfDay;
context.PrivateConversationData.SetValue<string>("departureStartTime", Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(depStartTime.ToString()));
context.PrivateConversationData.SetValue<string>("departureEndTime", Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(depEndTime.ToString()));
}
}
I need a output like below. How i can get exactly
Departing Location: Hyderabad
Arrival Location: Bangalore
Date of Departure: 2018-01-15
Departure Start Time: 13:00
Departure End Time: 18:00
Date of Return: 2018-01-19
Return Start Time: 19:00
Departure End Time: 22:00
I can get all entities data, but my issue is if user utterance is " I want to book a flight from Hyderabad to Bangalore next Monday with a return on next Friday preferably around evening".
How exactly i can write my code to get below output.
Departing Location: Hyderabad
Arrival Location: Bangalore
Date of Departure: 2018-01-15
Departure Start Time:
Departure End Time:
Date of Return: 2018-01-19
Return Start Time: 19:00
Departure End Time: 22:00