-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into vishwac/lu-phraselist-fix
- Loading branch information
Showing
8 changed files
with
537 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// <auto-generated> | ||
// Code generated by luis:generate:cs | ||
// Tool github: https://github.com/microsoft/botframwork-cli | ||
// Changes may cause incorrect behavior and will be lost if the code is | ||
// regenerated. | ||
// </auto-generated> | ||
using Newtonsoft.Json; | ||
using System.Collections.Generic; | ||
using Microsoft.Bot.Builder; | ||
using Microsoft.Bot.Builder.AI.Luis; | ||
namespace Luis | ||
{ | ||
public partial class FlightBooking: IRecognizerConvert | ||
{ | ||
[JsonProperty("text")] | ||
public string Text; | ||
|
||
[JsonProperty("alteredText")] | ||
public string AlteredText; | ||
|
||
public enum Intent { | ||
BookFlight, | ||
Cancel, | ||
GetWeather, | ||
None | ||
}; | ||
[JsonProperty("intents")] | ||
public Dictionary<Intent, IntentScore> Intents; | ||
|
||
public class _Entities | ||
{ | ||
// Built-in entities | ||
public DateTimeSpec[] datetime; | ||
|
||
// Lists | ||
public string[][] Airport; | ||
|
||
|
||
// Composites | ||
public class _InstanceFrom | ||
{ | ||
public InstanceData[] Airport; | ||
} | ||
public class FromClass | ||
{ | ||
public string[][] Airport; | ||
[JsonProperty("$instance")] | ||
public _InstanceFrom _instance; | ||
} | ||
public FromClass[] From; | ||
|
||
public class _InstanceTo | ||
{ | ||
public InstanceData[] Airport; | ||
} | ||
public class ToClass | ||
{ | ||
public string[][] Airport; | ||
[JsonProperty("$instance")] | ||
public _InstanceTo _instance; | ||
} | ||
public ToClass[] To; | ||
|
||
// Instance | ||
public class _Instance | ||
{ | ||
public InstanceData[] Airport; | ||
public InstanceData[] From; | ||
public InstanceData[] To; | ||
public InstanceData[] datetime; | ||
} | ||
[JsonProperty("$instance")] | ||
public _Instance _instance; | ||
} | ||
[JsonProperty("entities")] | ||
public _Entities Entities; | ||
|
||
[JsonExtensionData(ReadData = true, WriteData = true)] | ||
public IDictionary<string, object> Properties {get; set; } | ||
|
||
public void Convert(dynamic result) | ||
{ | ||
var app = JsonConvert.DeserializeObject<FlightBooking>(JsonConvert.SerializeObject(result, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); | ||
Text = app.Text; | ||
AlteredText = app.AlteredText; | ||
Intents = app.Intents; | ||
Entities = app.Entities; | ||
Properties = app.Properties; | ||
} | ||
|
||
public (Intent intent, double score) TopIntent() | ||
{ | ||
Intent maxIntent = Intent.None; | ||
var max = 0.0; | ||
foreach (var entry in Intents) | ||
{ | ||
if (entry.Value.Score > max) | ||
{ | ||
maxIntent = entry.Key; | ||
max = entry.Value.Score.Value; | ||
} | ||
} | ||
return (maxIntent, max); | ||
} | ||
} | ||
} |
Oops, something went wrong.