Update LUIS to support GeographyV2, OrdinalV2 and PersonName.

This commit is contained in:
Chris McConnell 2019-06-25 15:08:09 -07:00
Родитель 2ab05d068e
Коммит 97fe3ed26c
19 изменённых файлов: 1856 добавлений и 973 удалений

Просмотреть файл

@ -25,7 +25,7 @@ namespace Microsoft.Bot.Builder.FunctionalTests
GetEnvironmentVars();
echoGuid = Guid.NewGuid().ToString();
input = input + echoGuid;
input += echoGuid;
var botAnswer = await StartBotConversationAsync();
@ -39,13 +39,13 @@ namespace Microsoft.Bot.Builder.FunctionalTests
private static async Task<string> StartBotConversationAsync()
{
// Create a new Direct Line client.
DirectLineClient client = new DirectLineClient(directLineSecret);
var client = new DirectLineClient(directLineSecret);
// Start the conversation.
var conversation = await client.Conversations.StartConversationAsync();
// Create a message activity with the input text.
Activity userMessage = new Activity
var userMessage = new Activity
{
From = new ChannelAccount(fromUser),
Text = input,
@ -70,7 +70,7 @@ namespace Microsoft.Bot.Builder.FunctionalTests
private static async Task<string> ReadBotMessagesAsync(DirectLineClient client, string conversationId)
{
string watermark = null;
string answer = string.Empty;
var answer = string.Empty;
// Poll the bot for replies once per second.
while (answer.Equals(string.Empty))
@ -85,7 +85,7 @@ namespace Microsoft.Bot.Builder.FunctionalTests
select x;
// Analyze each activity in the activity set.
foreach (Activity activity in activities)
foreach (var activity in activities)
{
if (activity.Type == ActivityTypes.Message && activity.Text != "Welcome to Echo Bot.")
{

Просмотреть файл

@ -304,11 +304,8 @@ Global
{76391566-9F22-4994-8B0F-02EFC0E9E228}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76391566-9F22-4994-8B0F-02EFC0E9E228}.Release|Any CPU.Build.0 = Release|Any CPU
{66A04273-E854-4793-A19D-49DEFAADB5E9}.Debug - NuGet Packages|Any CPU.ActiveCfg = Debug - NuGet Packages|Any CPU
{66A04273-E854-4793-A19D-49DEFAADB5E9}.Debug - NuGet Packages|Any CPU.Build.0 = Debug - NuGet Packages|Any CPU
{66A04273-E854-4793-A19D-49DEFAADB5E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66A04273-E854-4793-A19D-49DEFAADB5E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66A04273-E854-4793-A19D-49DEFAADB5E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66A04273-E854-4793-A19D-49DEFAADB5E9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Newtonsoft.Json;
namespace Microsoft.Bot.Builder.AI.Luis
{
/// <summary>

Просмотреть файл

@ -0,0 +1,57 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Newtonsoft.Json;
namespace Microsoft.Bot.Builder.AI.Luis
{
/// <summary>
/// Strongly typed LUIS builtin GeographyV2.
/// </summary>
public class GeographyV2
{
/// <summary>
/// Initializes a new instance of the <see cref="GeographyV2"/> class.
/// </summary>
/// <param name="type">Type of geographic location from <see cref="Types"/>.</param>
/// <param name="location">Geographic location.</param>
public GeographyV2(string type, string location)
{
Type = type;
Location = location;
}
/// <summary>
/// Gets or sets type of geographic location.
/// </summary>
/// <value>
/// Type of geographic location from <see cref="Types"/>.
/// </value>
[JsonProperty("type")]
public string Type { get; set; }
/// <summary>
/// Gets or sets geographic location.
/// </summary>
/// <value>
/// Geographic location.
/// </value>
[JsonProperty("location")]
public string Location { get; set; }
/// <inheritdoc/>
public override string ToString() => $"GeographyV2({Type}, {Location})";
/// <summary>
/// Different types of geographic locations.
/// </summary>
public abstract class Types
{
public const string POI = "poi";
public const string City = "city";
public const string CountryRegion = "countryRegion";
public const string Continent = "continent";
public const string State = "state";
}
}
}

Просмотреть файл

@ -0,0 +1,55 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Newtonsoft.Json;
namespace Microsoft.Bot.Builder.AI.Luis
{
/// <summary>
/// Strongly typed LUIS builtin OrdinalV2.
/// </summary>
public class OrdinalV2
{
/// <summary>
/// Initializes a new instance of the <see cref="OrdinalV2"/> class.
/// </summary>
/// <param name="offset">Offset from <see cref="RelativeTo"/>.</param>
/// <param name="relativeTo">Position that anchors offset.</param>
public OrdinalV2(string relativeTo, long offset)
{
RelativeTo = relativeTo;
Offset = offset;
}
/// <summary>
/// Gets or sets the anchor for the offset.
/// </summary>
/// <value>
/// The base position in a sequence one of <see cref="Anchor"/>.
/// </value>
[JsonProperty("relativeTo")]
public string RelativeTo { get; set; }
/// <summary>
/// Gets or sets the offset in the sequence with respect to <see cref="RelativeTo"/>.
/// </summary>
/// <value>
/// Offset in sequence relative to <see cref="RelativeTo"/>.
/// </value>
[JsonProperty("offset")]
public long Offset { get; set; }
/// <inheritdoc/>
public override string ToString() => $"OrdinalV2({RelativeTo}, {Offset})";
/// <summary>
/// Possible anchors for offsets.
/// </summary>
public abstract class Anchor
{
public const string Current = "current";
public const string End = "end";
public const string Start = "start";
}
}
}

Просмотреть файл

@ -123,7 +123,7 @@ namespace Microsoft.Bot.Builder.AI.Luis
}
string topIntent = null;
double topScore = -1.0;
var topScore = -1.0;
if (results.Intents.Count > 0)
{
foreach (var intent in results.Intents)
@ -189,10 +189,8 @@ namespace Microsoft.Bot.Builder.AI.Luis
/// <param name="telemetryMetrics">Additional metrics to be logged to telemetry with the LuisResult event.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The LUIS results of the analysis of the current message text in the current turn's context activity.</returns>
public virtual async Task<RecognizerResult> RecognizeAsync(ITurnContext turnContext, Dictionary<string, string> telemetryProperties, Dictionary<string, double> telemetryMetrics = null, CancellationToken cancellationToken = default(CancellationToken))
{
return await RecognizeInternalAsync(turnContext, null, telemetryProperties, telemetryMetrics, cancellationToken).ConfigureAwait(false);
}
public virtual async Task<RecognizerResult> RecognizeAsync(ITurnContext turnContext, Dictionary<string, string> telemetryProperties, Dictionary<string, double> telemetryMetrics = null, CancellationToken cancellationToken = default)
=> await RecognizeInternalAsync(turnContext, null, telemetryProperties, telemetryMetrics, cancellationToken).ConfigureAwait(false);
/// <summary>
/// Return results of the analysis (Suggested actions and intents).
@ -204,10 +202,8 @@ namespace Microsoft.Bot.Builder.AI.Luis
/// <param name="telemetryMetrics">Additional metrics to be logged to telemetry with the LuisResult event.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The LUIS results of the analysis of the current message text in the current turn's context activity.</returns>
public virtual async Task<RecognizerResult> RecognizeAsync(ITurnContext turnContext, LuisPredictionOptions predictionOptions, Dictionary<string, string> telemetryProperties, Dictionary<string, double> telemetryMetrics = null, CancellationToken cancellationToken = default(CancellationToken))
{
return await RecognizeInternalAsync(turnContext, predictionOptions, telemetryProperties, telemetryMetrics, cancellationToken).ConfigureAwait(false);
}
public virtual async Task<RecognizerResult> RecognizeAsync(ITurnContext turnContext, LuisPredictionOptions predictionOptions, Dictionary<string, string> telemetryProperties, Dictionary<string, double> telemetryMetrics = null, CancellationToken cancellationToken = default)
=> await RecognizeInternalAsync(turnContext, predictionOptions, telemetryProperties, telemetryMetrics, cancellationToken).ConfigureAwait(false);
/// <summary>
/// Return results of the analysis (Suggested actions and intents).
@ -218,7 +214,7 @@ namespace Microsoft.Bot.Builder.AI.Luis
/// <param name="telemetryMetrics">Additional metrics to be logged to telemetry with the LuisResult event.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The LUIS results of the analysis of the current message text in the current turn's context activity.</returns>
public virtual async Task<T> RecognizeAsync<T>(ITurnContext turnContext, Dictionary<string, string> telemetryProperties, Dictionary<string, double> telemetryMetrics = null, CancellationToken cancellationToken = default(CancellationToken))
public virtual async Task<T> RecognizeAsync<T>(ITurnContext turnContext, Dictionary<string, string> telemetryProperties, Dictionary<string, double> telemetryMetrics = null, CancellationToken cancellationToken = default)
where T : IRecognizerConvert, new()
{
var result = new T();
@ -237,7 +233,7 @@ namespace Microsoft.Bot.Builder.AI.Luis
/// <param name="telemetryMetrics">Additional metrics to be logged to telemetry with the LuisResult event.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The LUIS results of the analysis of the current message text in the current turn's context activity.</returns>
public virtual async Task<T> RecognizeAsync<T>(ITurnContext turnContext, LuisPredictionOptions predictionOptions, Dictionary<string, string> telemetryProperties, Dictionary<string, double> telemetryMetrics = null, CancellationToken cancellationToken = default(CancellationToken))
public virtual async Task<T> RecognizeAsync<T>(ITurnContext turnContext, LuisPredictionOptions predictionOptions, Dictionary<string, string> telemetryProperties, Dictionary<string, double> telemetryMetrics = null, CancellationToken cancellationToken = default)
where T : IRecognizerConvert, new()
{
var result = new T();
@ -254,7 +250,7 @@ namespace Microsoft.Bot.Builder.AI.Luis
/// <param name="telemetryMetrics">Additional metrics to be logged to telemetry with the LuisResult event.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns><see cref="Task"/>.</returns>
protected virtual async Task OnRecognizerResultAsync(RecognizerResult recognizerResult, ITurnContext turnContext, Dictionary<string, string> telemetryProperties = null, Dictionary<string, double> telemetryMetrics = null, CancellationToken cancellationToken = default(CancellationToken))
protected virtual async Task OnRecognizerResultAsync(RecognizerResult recognizerResult, ITurnContext turnContext, Dictionary<string, string> telemetryProperties = null, Dictionary<string, double> telemetryMetrics = null, CancellationToken cancellationToken = default)
{
var properties = await FillLuisEventPropertiesAsync(recognizerResult, turnContext, telemetryProperties, cancellationToken).ConfigureAwait(false);
@ -272,7 +268,7 @@ namespace Microsoft.Bot.Builder.AI.Luis
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// additionalProperties
/// <returns>A dictionary that is sent as "Properties" to IBotTelemetryClient.TrackEvent method for the BotMessageSend event.</returns>
protected Task<Dictionary<string, string>> FillLuisEventPropertiesAsync(RecognizerResult recognizerResult, ITurnContext turnContext, Dictionary<string, string> telemetryProperties = null, CancellationToken cancellationToken = default(CancellationToken))
protected Task<Dictionary<string, string>> FillLuisEventPropertiesAsync(RecognizerResult recognizerResult, ITurnContext turnContext, Dictionary<string, string> telemetryProperties = null, CancellationToken cancellationToken = default)
{
var topTwoIntents = (recognizerResult.Intents.Count > 0) ? recognizerResult.Intents.OrderByDescending(x => x.Value.Score).Take(2).ToArray() : null;
@ -391,8 +387,7 @@ namespace Microsoft.Bot.Builder.AI.Luis
}
private LuisPredictionOptions MergeDefaultOptionsWithProvidedOptions(LuisPredictionOptions defaultOptions, LuisPredictionOptions overridenOptions)
{
return new LuisPredictionOptions()
=> new LuisPredictionOptions()
{
BingSpellCheckSubscriptionKey = overridenOptions.BingSpellCheckSubscriptionKey ?? defaultOptions.BingSpellCheckSubscriptionKey,
IncludeAllIntents = overridenOptions.IncludeAllIntents ?? defaultOptions.IncludeAllIntents,
@ -402,7 +397,6 @@ namespace Microsoft.Bot.Builder.AI.Luis
Staging = overridenOptions.Staging ?? defaultOptions.Staging,
TimezoneOffset = overridenOptions.TimezoneOffset ?? defaultOptions.TimezoneOffset,
};
}
private DelegatingHandler CreateHttpHandlerPipeline(HttpClientHandler httpClientHandler, params DelegatingHandler[] handlers)
{

Просмотреть файл

@ -85,14 +85,21 @@ namespace Microsoft.Bot.Builder.AI.Luis
internal static JToken ExtractEntityValue(EntityModel entity)
{
if (entity.Type.StartsWith("builtin.geographyV2."))
{
var subtype = entity.Type.Substring(20);
return new JObject(
new JProperty("type", subtype),
new JProperty("location", entity.Entity));
}
#pragma warning disable IDE0007 // Use implicit type
if (entity.AdditionalProperties == null || !entity.AdditionalProperties.TryGetValue("resolution", out dynamic resolution))
else if (entity.AdditionalProperties == null || !entity.AdditionalProperties.TryGetValue("resolution", out dynamic resolution))
#pragma warning restore IDE0007 // Use implicit type
{
return entity.Entity;
}
if (entity.Type.StartsWith("builtin.datetime."))
else if (entity.Type.StartsWith("builtin.datetime."))
{
return JObject.FromObject(resolution);
}
@ -109,6 +116,12 @@ namespace Microsoft.Bot.Builder.AI.Luis
var distinctTimexes = timexes.Distinct();
return new JObject(new JProperty("type", type), new JProperty("timex", JArray.FromObject(distinctTimexes)));
}
else if (entity.Type.StartsWith("builtin.ordinalV2"))
{
return new JObject(
new JProperty("relativeTo", resolution.relativeTo),
new JProperty("offset", Number(resolution.offset)));
}
else
{
switch (entity.Type)
@ -184,13 +197,19 @@ namespace Microsoft.Bot.Builder.AI.Luis
{
type = "datetime";
}
if (type.StartsWith("builtin.currency"))
else if (type.StartsWith("builtin.currency"))
{
type = "money";
}
if (type.StartsWith("builtin."))
else if (type.StartsWith("builtin.geographyV2"))
{
type = "geographyV2";
}
else if (type.StartsWith("builtin.ordinalV2"))
{
type = "ordinalV2";
}
else if (type.StartsWith("builtin."))
{
type = type.Substring(8);
}
@ -270,9 +289,7 @@ namespace Microsoft.Bot.Builder.AI.Luis
=> entity.StartIndex >= compositeEntityMetadata.StartIndex &&
entity.EndIndex <= compositeEntityMetadata.EndIndex;
/// <summary>
/// If a property doesn't exist add it to a new array, otherwise append it to the existing array.
/// </summary>
// If a property doesn't exist add it to a new array, otherwise append it to the existing array.
internal static void AddProperty(JObject obj, string key, JToken value)
{
if (value != null)

Просмотреть файл

@ -1,5 +1,5 @@
// <auto-generated>
// Code generated by LUISGen ..\..\..\..\tests\LUISGenTest\Contoso app.json -cs Microsoft.Bot.Builder.AI.Luis.Tests.Contoso_App -o ..\..\..\..\tests\LUISGenTest\
// <auto-generated>
// Code generated by LUISGen Contoso App.json -cs Microsoft.Bot.Builder.AI.Luis.Tests.Contoso_App -o
// Tool github: https://github.com/microsoft/botbuilder-tools
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -12,242 +12,282 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
{
public partial class Contoso_App: IRecognizerConvert
{
public string Text;
public string AlteredText;
public enum Intent {
Cancel,
Delivery,
EntityTests,
Greeting,
Help,
None,
Roles,
search,
SpecifyName,
Travel,
Weather_GetForecast
};
public Dictionary<Intent, IntentScore> Intents;
public class _Entities
[JsonProperty("text")]
public string Text;
[JsonProperty("alteredText")]
public string AlteredText;
public enum Intent {
Cancel,
Delivery,
EntityTests,
Greeting,
Help,
None,
Roles,
search,
SpecifyName,
Travel,
Weather_GetForecast
};
[JsonProperty("intents")]
public Dictionary<Intent, IntentScore> Intents;
public class _Entities
{
// Simple entities
public string[] City;
public string[] To;
public string[] From;
public string[] Name;
public string[] likee;
public string[] liker;
public string[] State;
public string[] Weather_Location;
public string[] destination;
public string[] source;
// Built-in entities
public Age[] age;
public Age[] begin;
public Age[] end;
public DateTimeSpec[] datetime;
public DateTimeSpec[] arrive;
public DateTimeSpec[] leave;
public Dimension[] dimension;
public Dimension[] length;
public Dimension[] width;
public string[] email;
public string[] receiver;
public string[] sender;
public GeographyV2[] geographyV2;
public GeographyV2[] endloc;
public GeographyV2[] startloc;
public Money[] money;
public Money[] max;
public Money[] min;
public double[] number;
public double[] ordinal;
public double[] start;
public OrdinalV2[] ordinalV2;
public OrdinalV2[] endpos;
public OrdinalV2[] startpos;
public double[] percentage;
public double[] maximum;
public double[] minimum;
public string[] personName;
public string[] child;
public string[] parent;
public string[] phonenumber;
public string[] newPhone;
public string[] old;
public Temperature[] temperature;
public Temperature[] a;
public Temperature[] b;
public string[] url;
public string[] oldURL;
// Lists
public string[][] Airline;
public string[][] Buyer;
public string[][] Seller;
// Regex entities
public string[] Part;
public string[] buy;
public string[] sell;
// Pattern.any
public string[] person;
public string[] from;
public string[] to;
public string[] subject;
public string[] extra;
// Composites
public class _InstanceAddress
{
// Simple entities
public string[] Name;
public string[] liker;
public string[] likee;
public InstanceData[] number;
public InstanceData[] State;
}
public class AddressClass
{
public double[] number;
public string[] State;
public string[] Weather_Location;
public string[] source;
public string[] destination;
public string[] City;
public string[] To;
public string[] From;
[JsonProperty("$instance")]
public _InstanceAddress _instance;
}
public AddressClass[] Address;
// Built-in entities
public class _InstanceComposite1
{
public InstanceData[] age;
public InstanceData[] datetime;
public InstanceData[] dimension;
public InstanceData[] email;
public InstanceData[] money;
public InstanceData[] number;
public InstanceData[] ordinal;
public InstanceData[] percentage;
public InstanceData[] phonenumber;
public InstanceData[] temperature;
}
public class Composite1Class
{
public Age[] age;
public Age[] end;
public Age[] begin;
public DateTimeSpec[] datetime;
public DateTimeSpec[] leave;
public DateTimeSpec[] arrive;
public Dimension[] dimension;
public Dimension[] length;
public Dimension[] width;
public string[] email;
public string[] sender;
public string[] receiver;
public Money[] money;
public Money[] max;
public Money[] min;
public double[] number;
public double[] ordinal;
public double[] start;
public double[] percentage;
public double[] minimum;
public double[] maximum;
public string[] phonenumber;
public string[] newPhone;
public string[] old;
public Temperature[] temperature;
public Temperature[] b;
public Temperature[] a;
public string[] url;
public string[] oldURL;
// Lists
public string[][] Airline;
public string[][] Buyer;
public string[][] Seller;
// Regex entities
public string[] Part;
public string[] buy;
public string[] sell;
// Pattern.any
public string[] person;
public string[] to;
public string[] from;
public string[] subject;
public string[] extra;
// Composites
public class _InstanceAddress
{
public InstanceData[] number;
public InstanceData[] State;
}
public class AddressClass
{
public double[] number;
public string[] State;
[JsonProperty("$instance")]
public _InstanceAddress _instance;
}
public AddressClass[] Address;
public class _InstanceComposite1
{
public InstanceData[] age;
public InstanceData[] datetime;
public InstanceData[] dimension;
public InstanceData[] email;
public InstanceData[] money;
public InstanceData[] number;
public InstanceData[] ordinal;
public InstanceData[] percentage;
public InstanceData[] phonenumber;
public InstanceData[] temperature;
}
public class Composite1Class
{
public Age[] age;
public DateTimeSpec[] datetime;
public Dimension[] dimension;
public string[] email;
public Money[] money;
public double[] number;
public double[] ordinal;
public double[] percentage;
public string[] phonenumber;
public Temperature[] temperature;
[JsonProperty("$instance")]
public _InstanceComposite1 _instance;
}
public Composite1Class[] Composite1;
public class _InstanceComposite2
{
public InstanceData[] Airline;
public InstanceData[] City;
public InstanceData[] url;
public InstanceData[] From;
public InstanceData[] To;
public InstanceData[] Weather_Location;
}
public class Composite2Class
{
public string[][] Airline;
public string[] City;
public string[] url;
public string[] From;
public string[] To;
public string[] Weather_Location;
[JsonProperty("$instance")]
public _InstanceComposite2 _instance;
}
public Composite2Class[] Composite2;
// Instance
public class _Instance
{
public InstanceData[] Name;
public InstanceData[] liker;
public InstanceData[] likee;
public InstanceData[] State;
public InstanceData[] Weather_Location;
public InstanceData[] source;
public InstanceData[] destination;
public InstanceData[] City;
public InstanceData[] To;
public InstanceData[] From;
public InstanceData[] age;
public InstanceData[] end;
public InstanceData[] begin;
public InstanceData[] datetime;
public InstanceData[] leave;
public InstanceData[] arrive;
public InstanceData[] dimension;
public InstanceData[] length;
public InstanceData[] width;
public InstanceData[] email;
public InstanceData[] sender;
public InstanceData[] receiver;
public InstanceData[] money;
public InstanceData[] max;
public InstanceData[] min;
public InstanceData[] number;
public InstanceData[] ordinal;
public InstanceData[] start;
public InstanceData[] percentage;
public InstanceData[] minimum;
public InstanceData[] maximum;
public InstanceData[] phonenumber;
public InstanceData[] newPhone;
public InstanceData[] old;
public InstanceData[] temperature;
public InstanceData[] b;
public InstanceData[] a;
public InstanceData[] url;
public InstanceData[] oldURL;
public InstanceData[] Airline;
public InstanceData[] Buyer;
public InstanceData[] Seller;
public InstanceData[] Part;
public InstanceData[] buy;
public InstanceData[] sell;
public InstanceData[] person;
public InstanceData[] to;
public InstanceData[] from;
public InstanceData[] subject;
public InstanceData[] extra;
public InstanceData[] Address;
public InstanceData[] Destination;
public InstanceData[] Source;
public InstanceData[] Composite1;
public InstanceData[] Composite2;
}
[JsonProperty("$instance")]
public _Instance _instance;
public _InstanceComposite1 _instance;
}
public _Entities Entities;
public Composite1Class[] Composite1;
[JsonExtensionData(ReadData = true, WriteData = true)]
public IDictionary<string, object> Properties {get; set; }
public void Convert(dynamic result)
public class _InstanceComposite2
{
var app = JsonConvert.DeserializeObject<Contoso_App>(JsonConvert.SerializeObject(result, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }));
Text = app.Text;
AlteredText = app.AlteredText;
Intents = app.Intents;
Entities = app.Entities;
Properties = app.Properties;
public InstanceData[] Airline;
public InstanceData[] City;
public InstanceData[] url;
public InstanceData[] From;
public InstanceData[] To;
public InstanceData[] Weather_Location;
}
public (Intent intent, double score) TopIntent()
public class Composite2Class
{
Intent maxIntent = Intent.None;
var max = 0.0;
foreach (var entry in Intents)
public string[][] Airline;
public string[] City;
public string[] url;
public string[] From;
public string[] To;
public string[] Weather_Location;
[JsonProperty("$instance")]
public _InstanceComposite2 _instance;
}
public Composite2Class[] Composite2;
// Instance
public class _Instance
{
public InstanceData[] Address;
public InstanceData[] Destination;
public InstanceData[] Source;
public InstanceData[] Airline;
public InstanceData[] Buyer;
public InstanceData[] Seller;
public InstanceData[] City;
public InstanceData[] Composite1;
public InstanceData[] Composite2;
public InstanceData[] Name;
public InstanceData[] likee;
public InstanceData[] liker;
public InstanceData[] Part;
public InstanceData[] buy;
public InstanceData[] sell;
public InstanceData[] State;
public InstanceData[] Weather_Location;
public InstanceData[] destination;
public InstanceData[] source;
public InstanceData[] age;
public InstanceData[] begin;
public InstanceData[] end;
public InstanceData[] datetime;
public InstanceData[] arrive;
public InstanceData[] leave;
public InstanceData[] dimension;
public InstanceData[] length;
public InstanceData[] width;
public InstanceData[] email;
public InstanceData[] receiver;
public InstanceData[] sender;
public InstanceData[] geographyV2;
public InstanceData[] endloc;
public InstanceData[] startloc;
public InstanceData[] money;
public InstanceData[] max;
public InstanceData[] min;
public InstanceData[] number;
public InstanceData[] ordinal;
public InstanceData[] start;
public InstanceData[] ordinalV2;
public InstanceData[] endpos;
public InstanceData[] startpos;
public InstanceData[] percentage;
public InstanceData[] maximum;
public InstanceData[] minimum;
public InstanceData[] person;
public InstanceData[] from;
public InstanceData[] to;
public InstanceData[] personName;
public InstanceData[] child;
public InstanceData[] parent;
public InstanceData[] phonenumber;
public InstanceData[] newPhone;
public InstanceData[] old;
public InstanceData[] subject;
public InstanceData[] extra;
public InstanceData[] temperature;
public InstanceData[] a;
public InstanceData[] b;
public InstanceData[] url;
public InstanceData[] oldURL;
}
[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<Contoso_App>(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)
{
if (entry.Value.Score > max)
{
maxIntent = entry.Key;
max = entry.Value.Score.Value;
}
maxIntent = entry.Key;
max = entry.Value.Score.Value;
}
return (maxIntent, max);
}
return (maxIntent, max);
}
}
}

Просмотреть файл

@ -25,6 +25,7 @@ using RichardSzalay.MockHttp;
namespace Microsoft.Bot.Builder.AI.Luis.Tests
{
[TestClass]
// The LUIS application used in these unit tests is in TestData/Contoso App.json
public class LuisOracleTests
{
@ -84,7 +85,6 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
public void LuisRecognizer_Timeout()
{
var endpoint = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/b31aeaf3-3511-495b-a07f-571fc873214b?verbose=true&timezoneOffset=-360&subscription-key=048ec46dc58e495482b0c447cfdbd291&q=";
var fieldInfo = typeof(LuisRecognizer).GetField("_application", BindingFlags.NonPublic | BindingFlags.Instance);
var optionsWithTimeout = new LuisPredictionOptions()
{
Timeout = 300,
@ -436,7 +436,7 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
public async Task TestEndpoint<T>(string expectedPath, JToken oracle, string version)
where T : IRecognizerConvert, new()
{
var newPath = expectedPath + "-" + version + ".new";
var newPath = expectedPath + ".new";
using (var mockResponse = new MemoryStream(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(oracle[version]))))
{
var text = oracle["text"] ?? oracle["Text"];
@ -447,6 +447,8 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
var luisRecognizer = GetLuisRecognizer(mockHttp, true, new LuisPredictionOptions { IncludeAllIntents = true });
var typedResult = await luisRecognizer.RecognizeAsync<T>(context, CancellationToken.None);
var typedJson = Json(typedResult);
typedJson[version] = typedJson["luisResult"];
typedJson.Remove("luisResult");
if (!WithinDelta(oracle, typedJson, 0.1))
{
@ -539,6 +541,9 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
[TestMethod]
public async Task Composite3() => await TestJson<RecognizerResult>("Composite3.json");
[TestMethod]
public async Task GeoPeopleOrdinal() => await TestJson<RecognizerResult>("GeoPeopleOrdinal.json");
[TestMethod]
public async Task PrebuiltDomains() => await TestJson<RecognizerResult>("Prebuilt.json");
@ -685,6 +690,7 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
var result = await recognizer.RecognizeAsync(turnContext, additionalProperties).ConfigureAwait(false);
// Assert
Assert.IsNotNull(result);
Assert.AreEqual(telemetryClient.Invocations.Count, 1);
Assert.AreEqual(telemetryClient.Invocations[0].Arguments[0].ToString(), "LuisResult");
Assert.IsTrue(((Dictionary<string, string>)telemetryClient.Invocations[0].Arguments[1]).ContainsKey("test"));
@ -731,6 +737,7 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
var result = await recognizer.RecognizeAsync(turnContext, null).ConfigureAwait(false);
// Assert
Assert.IsNotNull(result);
Assert.AreEqual(telemetryClient.Invocations.Count, 1);
Assert.AreEqual(telemetryClient.Invocations[0].Arguments[0].ToString(), "LuisResult");
Assert.IsTrue(((Dictionary<string, string>)telemetryClient.Invocations[0].Arguments[1]).Count == 8);
@ -777,6 +784,7 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
var result = await recognizer.RecognizeAsync(turnContext, null).ConfigureAwait(false);
// Assert
Assert.IsNotNull(result);
Assert.AreEqual(telemetryClient.Invocations.Count, 1);
Assert.AreEqual(telemetryClient.Invocations[0].Arguments[0].ToString(), "LuisResult");
Assert.IsTrue(((Dictionary<string, string>)telemetryClient.Invocations[0].Arguments[1]).Count == 7);
@ -828,6 +836,7 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
var result = await recognizer.RecognizeAsync(turnContext, additionalProperties).ConfigureAwait(false);
// Assert
Assert.IsNotNull(result);
Assert.AreEqual(telemetryClient.Invocations.Count, 2);
Assert.AreEqual(telemetryClient.Invocations[0].Arguments[0].ToString(), "LuisResult");
Assert.IsTrue(((Dictionary<string, string>)telemetryClient.Invocations[0].Arguments[1]).ContainsKey("MyImportantProperty"));
@ -885,6 +894,7 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
var result = await recognizer.RecognizeAsync(turnContext, additionalProperties, additionalMetrics).ConfigureAwait(false);
// Assert
Assert.IsNotNull(result);
Assert.AreEqual(telemetryClient.Invocations.Count, 2);
Assert.AreEqual(telemetryClient.Invocations[0].Arguments[0].ToString(), "LuisResult");
Assert.IsTrue(((Dictionary<string, string>)telemetryClient.Invocations[0].Arguments[1]).ContainsKey("MyImportantProperty"));
@ -937,6 +947,7 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
var result = await recognizer.RecognizeAsync(turnContext, CancellationToken.None).ConfigureAwait(false);
// Assert
Assert.IsNotNull(result);
Assert.AreEqual(telemetryClient.Invocations.Count, 1);
Assert.AreEqual(telemetryClient.Invocations[0].Arguments[0].ToString(), "LuisResult");
Assert.IsTrue(((Dictionary<string, string>)telemetryClient.Invocations[0].Arguments[1]).ContainsKey("applicationId"));
@ -980,6 +991,7 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
var result = await recognizer.RecognizeAsync<TelemetryConvertResult>(turnContext, CancellationToken.None).ConfigureAwait(false);
// Assert
Assert.IsNotNull(result);
Assert.AreEqual(telemetryClient.Invocations.Count, 1);
Assert.AreEqual(telemetryClient.Invocations[0].Arguments[0].ToString(), "LuisResult");
Assert.IsTrue(((Dictionary<string, string>)telemetryClient.Invocations[0].Arguments[1]).ContainsKey("applicationId"));
@ -1034,6 +1046,7 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
var result = await recognizer.RecognizeAsync<TelemetryConvertResult>(turnContext, additionalProperties, additionalMetrics, CancellationToken.None).ConfigureAwait(false);
// Assert
Assert.IsNotNull(result);
Assert.AreEqual(telemetryClient.Invocations.Count, 1);
Assert.AreEqual(telemetryClient.Invocations[0].Arguments[0].ToString(), "LuisResult");
Assert.IsTrue(((Dictionary<string, string>)telemetryClient.Invocations[0].Arguments[1]).ContainsKey("test"));
@ -1170,9 +1183,7 @@ namespace Microsoft.Bot.Builder.AI.Luis.Tests
}
private MockedHttpClientHandler GetMockHttpClientHandler(string example, string responsePath)
{
return GetMockHttpClientHandler(example, GetResponse(responsePath));
}
=> GetMockHttpClientHandler(example, GetResponse(responsePath));
private MockedHttpClientHandler GetMockHttpClientHandler(string example, Stream response)
{

Просмотреть файл

@ -2,37 +2,37 @@
"text": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5:30am and 4 acres and 4 pico meters and chrimc@hotmail.com and $4 and $4.25 and also 32 and 210.4 and first and 10% and 10.5% and 425-555-1234 and 3 degrees and -27.5 degrees c and the next one and the previous one",
"intents": {
"EntityTests": {
"score": 0.986663
"score": 0.96595037
},
"Roles": {
"score": 0.1664963
"score": 0.184567839
},
"search": {
"score": 0.12151327
"score": 0.149123311
},
"Weather_GetForecast": {
"score": 0.013088448
},
"None": {
"score": 0.009308712
"score": 0.0122321565
},
"Travel": {
"score": 0.004110674
"score": 0.0114093516
},
"None": {
"score": 0.009063047
},
"Delivery": {
"score": 0.0002886336
"score": 0.000278715248
},
"SpecifyName": {
"score": 0.000134838832
"score": 6.590373E-05
},
"Help": {
"score": 4.59630246E-06
"score": 4.902734E-06
},
"Cancel": {
"score": 1.5275E-06
"score": 1.602786E-06
},
"Greeting": {
"score": 8.0267E-07
"score": 8.547132E-07
}
},
"entities": {
@ -43,7 +43,33 @@
"endIndex": 300,
"text": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5 : 30am and 4 acres and 4 pico meters and chrimc @ hotmail . com and $ 4 and $ 4 . 25 and also 32 and 210 . 4 and first and 10 % and 10 . 5 % and 425 - 555 - 1234 and 3 degrees and - 27 . 5 degrees c and the next one and the previous one",
"type": "Composite1",
"score": 0.884687662
"score": 0.877445638
}
],
"ordinalV2": [
{
"startIndex": 44,
"endIndex": 47,
"text": "3rd",
"type": "builtin.ordinalV2"
},
{
"startIndex": 188,
"endIndex": 193,
"text": "first",
"type": "builtin.ordinalV2"
},
{
"startIndex": 271,
"endIndex": 279,
"text": "next one",
"type": "builtin.ordinalV2.relative"
},
{
"startIndex": 288,
"endIndex": 300,
"text": "previous one",
"type": "builtin.ordinalV2.relative"
}
]
},
@ -418,6 +444,24 @@
}
]
}
],
"ordinalV2": [
{
"relativeTo": "start",
"offset": 3
},
{
"relativeTo": "start",
"offset": 1
},
{
"relativeTo": "current",
"offset": 1
},
{
"relativeTo": "current",
"offset": -1
}
]
},
"sentiment": {
@ -428,52 +472,52 @@
"query": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5:30am and 4 acres and 4 pico meters and chrimc@hotmail.com and $4 and $4.25 and also 32 and 210.4 and first and 10% and 10.5% and 425-555-1234 and 3 degrees and -27.5 degrees c and the next one and the previous one",
"topScoringIntent": {
"intent": "EntityTests",
"score": 0.986663
"score": 0.96595037
},
"intents": [
{
"intent": "EntityTests",
"score": 0.986663
"score": 0.96595037
},
{
"intent": "Roles",
"score": 0.1664963
"score": 0.184567839
},
{
"intent": "search",
"score": 0.12151327
"score": 0.149123311
},
{
"intent": "Weather.GetForecast",
"score": 0.013088448
},
{
"intent": "None",
"score": 0.009308712
"score": 0.0122321565
},
{
"intent": "Travel",
"score": 0.004110674
"score": 0.0114093516
},
{
"intent": "None",
"score": 0.009063047
},
{
"intent": "Delivery",
"score": 0.0002886336
"score": 0.000278715248
},
{
"intent": "SpecifyName",
"score": 0.000134838832
"score": 6.590373E-05
},
{
"intent": "Help",
"score": 4.59630246E-06
"score": 4.902734E-06
},
{
"intent": "Cancel",
"score": 1.5275E-06
"score": 1.602786E-06
},
{
"intent": "Greeting",
"score": 8.0267E-07
"score": 8.547132E-07
}
],
"entities": [
@ -482,7 +526,7 @@
"type": "Composite1",
"startIndex": 0,
"endIndex": 299,
"score": 0.884687662
"score": 0.877445638
},
{
"entity": "12",
@ -832,6 +876,46 @@
"value": "1"
}
},
{
"entity": "3rd",
"type": "builtin.ordinalV2",
"startIndex": 44,
"endIndex": 46,
"resolution": {
"offset": "3",
"relativeTo": "start"
}
},
{
"entity": "first",
"type": "builtin.ordinalV2",
"startIndex": 188,
"endIndex": 192,
"resolution": {
"offset": "1",
"relativeTo": "start"
}
},
{
"entity": "next one",
"type": "builtin.ordinalV2.relative",
"startIndex": 271,
"endIndex": 278,
"resolution": {
"offset": "1",
"relativeTo": "current"
}
},
{
"entity": "previous one",
"type": "builtin.ordinalV2.relative",
"startIndex": 288,
"endIndex": 299,
"resolution": {
"offset": "-1",
"relativeTo": "current"
}
},
{
"entity": "10%",
"type": "builtin.percentage",

Просмотреть файл

@ -2,37 +2,37 @@
"text": "http://foo.com is where you can fly from seattle to dallas via denver",
"intents": {
"EntityTests": {
"score": 0.9513557
},
"Roles": {
"score": 0.05937675
},
"Weather_GetForecast": {
"score": 0.0246020257
"score": 0.944987357
},
"Travel": {
"score": 0.0182663873
"score": 0.0452092439
},
"Roles": {
"score": 0.0297764745
},
"Weather_GetForecast": {
"score": 0.0231683664
},
"search": {
"score": 0.0149017535
"score": 0.008871362
},
"None": {
"score": 0.004570498
"score": 0.004223796
},
"SpecifyName": {
"score": 0.00189947966
"score": 0.00236839615
},
"Delivery": {
"score": 0.00140795356
"score": 0.0013232599
},
"Help": {
"score": 0.0005772592
"score": 0.0005449379
},
"Cancel": {
"score": 0.00024834834
"score": 0.000226470322
},
"Greeting": {
"score": 0.000163752949
"score": 0.000151786517
}
},
"entities": {
@ -43,7 +43,15 @@
"endIndex": 69,
"text": "http : / / foo . com is where you can fly from seattle to dallas via denver",
"type": "Composite2",
"score": 0.950585246
"score": 0.962469339
}
],
"geographyV2": [
{
"startIndex": 41,
"endIndex": 48,
"text": "seattle",
"type": "builtin.geographyV2.city"
}
]
},
@ -56,7 +64,7 @@
"endIndex": 69,
"text": "denver",
"type": "City",
"score": 0.983408
"score": 0.984729
}
],
"url": [
@ -73,7 +81,7 @@
"endIndex": 48,
"text": "seattle",
"type": "City::From",
"score": 0.9981071
"score": 0.9992566
}
],
"To": [
@ -82,7 +90,7 @@
"endIndex": 58,
"text": "dallas",
"type": "City::To",
"score": 0.996769965
"score": 0.998420954
}
]
},
@ -99,6 +107,12 @@
"dallas"
]
}
],
"geographyV2": [
{
"type": "city",
"location": "seattle"
}
]
},
"sentiment": {
@ -109,52 +123,52 @@
"query": "http://foo.com is where you can fly from seattle to dallas via denver",
"topScoringIntent": {
"intent": "EntityTests",
"score": 0.9513557
"score": 0.944987357
},
"intents": [
{
"intent": "EntityTests",
"score": 0.9513557
},
{
"intent": "Roles",
"score": 0.05937675
},
{
"intent": "Weather.GetForecast",
"score": 0.0246020257
"score": 0.944987357
},
{
"intent": "Travel",
"score": 0.0182663873
"score": 0.0452092439
},
{
"intent": "Roles",
"score": 0.0297764745
},
{
"intent": "Weather.GetForecast",
"score": 0.0231683664
},
{
"intent": "search",
"score": 0.0149017535
"score": 0.008871362
},
{
"intent": "None",
"score": 0.004570498
"score": 0.004223796
},
{
"intent": "SpecifyName",
"score": 0.00189947966
"score": 0.00236839615
},
{
"intent": "Delivery",
"score": 0.00140795356
"score": 0.0013232599
},
{
"intent": "Help",
"score": 0.0005772592
"score": 0.0005449379
},
{
"intent": "Cancel",
"score": 0.00024834834
"score": 0.000226470322
},
{
"intent": "Greeting",
"score": 0.000163752949
"score": 0.000151786517
}
],
"entities": [
@ -163,28 +177,34 @@
"type": "City::To",
"startIndex": 52,
"endIndex": 57,
"score": 0.996769965
"score": 0.998420954
},
{
"entity": "seattle",
"type": "City::From",
"startIndex": 41,
"endIndex": 47,
"score": 0.9981071
"score": 0.9992566
},
{
"entity": "denver",
"type": "City",
"startIndex": 63,
"endIndex": 68,
"score": 0.983408
"score": 0.984729
},
{
"entity": "http : / / foo . com is where you can fly from seattle to dallas via denver",
"type": "Composite2",
"startIndex": 0,
"endIndex": 68,
"score": 0.950585246
"score": 0.962469339
},
{
"entity": "seattle",
"type": "builtin.geographyV2.city",
"startIndex": 41,
"endIndex": 47
},
{
"entity": "http://foo.com",

Просмотреть файл

@ -2,37 +2,37 @@
"text": "Deliver from 12345 VA to 12346 WA",
"intents": {
"Roles": {
"score": 0.9999103
"score": 0.999888361
},
"Delivery": {
"score": 0.002187348
"score": 0.00234605442
},
"search": {
"score": 8.737297E-06
},
"SpecifyName": {
"score": 2.84510975E-06
"score": 9.343347E-06
},
"Travel": {
"score": 2.84510975E-06
"score": 3.04712876E-06
},
"None": {
"score": 1.07744E-06
"score": 1.15824787E-06
},
"Weather_GetForecast": {
"score": 9.387989E-07
"score": 1.01009994E-06
},
"SpecifyName": {
"score": 3.01666669E-09
},
"Greeting": {
"score": 9.9375E-10
"score": 1.06875E-09
},
"Cancel": {
"score": 9.2941177E-10
"score": 1E-09
},
"Help": {
"score": 9.2941177E-10
"score": 1E-09
},
"EntityTests": {
"score": 4.6451612E-10
"score": 4.6666665E-10
}
},
"entities": {
@ -43,7 +43,7 @@
"endIndex": 21,
"text": "12345 va",
"type": "Address",
"score": 0.934437752
"score": 0.9377045
}
],
"Destination": [
@ -52,7 +52,7 @@
"endIndex": 33,
"text": "12346 wa",
"type": "Address",
"score": 0.9827704
"score": 0.9818967
}
]
},
@ -74,7 +74,7 @@
"endIndex": 21,
"text": "va",
"type": "State",
"score": 0.9457865
"score": 0.9417667
}
]
},
@ -104,7 +104,7 @@
"endIndex": 33,
"text": "wa",
"type": "State",
"score": 0.9903071
"score": 0.9899993
}
]
},
@ -125,52 +125,52 @@
"query": "Deliver from 12345 VA to 12346 WA",
"topScoringIntent": {
"intent": "Roles",
"score": 0.9999103
"score": 0.999888361
},
"intents": [
{
"intent": "Roles",
"score": 0.9999103
"score": 0.999888361
},
{
"intent": "Delivery",
"score": 0.002187348
"score": 0.00234605442
},
{
"intent": "search",
"score": 8.737297E-06
},
{
"intent": "SpecifyName",
"score": 2.84510975E-06
"score": 9.343347E-06
},
{
"intent": "Travel",
"score": 2.84510975E-06
"score": 3.04712876E-06
},
{
"intent": "None",
"score": 1.07744E-06
"score": 1.15824787E-06
},
{
"intent": "Weather.GetForecast",
"score": 9.387989E-07
"score": 1.01009994E-06
},
{
"intent": "SpecifyName",
"score": 3.01666669E-09
},
{
"intent": "Greeting",
"score": 9.9375E-10
"score": 1.06875E-09
},
{
"intent": "Cancel",
"score": 9.2941177E-10
"score": 1E-09
},
{
"intent": "Help",
"score": 9.2941177E-10
"score": 1E-09
},
{
"intent": "EntityTests",
"score": 4.6451612E-10
"score": 4.6666665E-10
}
],
"entities": [
@ -179,21 +179,21 @@
"type": "State",
"startIndex": 19,
"endIndex": 20,
"score": 0.9457865
"score": 0.9417667
},
{
"entity": "wa",
"type": "State",
"startIndex": 31,
"endIndex": 32,
"score": 0.9903071
"score": 0.9899993
},
{
"entity": "12345 va",
"type": "Address",
"startIndex": 13,
"endIndex": 20,
"score": 0.934437752,
"score": 0.9377045,
"role": "Source"
},
{
@ -201,7 +201,7 @@
"type": "Address",
"startIndex": 25,
"endIndex": 32,
"score": 0.9827704,
"score": 0.9818967,
"role": "Destination"
},
{

Просмотреть файл

@ -0,0 +1,233 @@
{
"text": "go from next to last to last move london to jakarta and homer simpson is the parent of lisa simpson",
"intents": {
"Roles": {
"score": 0.999204934
},
"search": {
"score": 0.0309635121
},
"None": {
"score": 0.0109820236
},
"Travel": {
"score": 0.01095186
},
"Weather_GetForecast": {
"score": 0.0106523167
},
"Delivery": {
"score": 0.00123035291
},
"EntityTests": {
"score": 0.0009487789
},
"SpecifyName": {
"score": 0.0009410849
},
"Help": {
"score": 0.0001358991
},
"Cancel": {
"score": 0.000107549029
},
"Greeting": {
"score": 5.293933E-05
}
},
"entities": {
"$instance": {
"startloc": [
{
"startIndex": 34,
"endIndex": 40,
"text": "london",
"type": "builtin.geographyV2.city"
}
],
"endloc": [
{
"startIndex": 44,
"endIndex": 51,
"text": "jakarta",
"type": "builtin.geographyV2.city"
}
],
"startpos": [
{
"startIndex": 8,
"endIndex": 20,
"text": "next to last",
"type": "builtin.ordinalV2.relative"
}
],
"endpos": [
{
"startIndex": 24,
"endIndex": 28,
"text": "last",
"type": "builtin.ordinalV2.relative"
}
],
"parent": [
{
"startIndex": 56,
"endIndex": 69,
"text": "homer simpson",
"type": "builtin.personName"
}
],
"child": [
{
"startIndex": 87,
"endIndex": 99,
"text": "lisa simpson",
"type": "builtin.personName"
}
]
},
"startloc": [
{
"type": "city",
"location": "london"
}
],
"endloc": [
{
"type": "city",
"location": "jakarta"
}
],
"startpos": [
{
"relativeTo": "end",
"offset": -1
}
],
"endpos": [
{
"relativeTo": "end",
"offset": 0
}
],
"parent": [
"homer simpson"
],
"child": [
"lisa simpson"
]
},
"sentiment": {
"label": "neutral",
"score": 0.5
},
"v2": {
"query": "go from next to last to last move london to jakarta and homer simpson is the parent of lisa simpson",
"topScoringIntent": {
"intent": "Roles",
"score": 0.999204934
},
"intents": [
{
"intent": "Roles",
"score": 0.999204934
},
{
"intent": "search",
"score": 0.0309635121
},
{
"intent": "None",
"score": 0.0109820236
},
{
"intent": "Travel",
"score": 0.01095186
},
{
"intent": "Weather.GetForecast",
"score": 0.0106523167
},
{
"intent": "Delivery",
"score": 0.00123035291
},
{
"intent": "EntityTests",
"score": 0.0009487789
},
{
"intent": "SpecifyName",
"score": 0.0009410849
},
{
"intent": "Help",
"score": 0.0001358991
},
{
"intent": "Cancel",
"score": 0.000107549029
},
{
"intent": "Greeting",
"score": 5.293933E-05
}
],
"entities": [
{
"entity": "london",
"type": "builtin.geographyV2.city",
"startIndex": 34,
"endIndex": 39,
"role": "startloc"
},
{
"entity": "jakarta",
"type": "builtin.geographyV2.city",
"startIndex": 44,
"endIndex": 50,
"role": "endloc"
},
{
"entity": "next to last",
"type": "builtin.ordinalV2.relative",
"startIndex": 8,
"endIndex": 19,
"resolution": {
"offset": "-1",
"relativeTo": "end"
},
"role": "startpos"
},
{
"entity": "last",
"type": "builtin.ordinalV2.relative",
"startIndex": 24,
"endIndex": 27,
"resolution": {
"offset": "0",
"relativeTo": "end"
},
"role": "endpos"
},
{
"entity": "homer simpson",
"type": "builtin.personName",
"startIndex": 56,
"endIndex": 68,
"role": "parent"
},
{
"entity": "lisa simpson",
"type": "builtin.personName",
"startIndex": 87,
"endIndex": 98,
"role": "child"
}
],
"sentimentAnalysis": {
"label": "neutral",
"score": 0.5
}
}
}

Просмотреть файл

@ -2,41 +2,49 @@
"text": "email about something wicked this way comes from bart simpson and also kb435",
"intents": {
"search": {
"score": 0.999999046
},
"None": {
"score": 6.808464E-06
},
"Roles": {
"score": 4.005832E-06
},
"Weather_GetForecast": {
"score": 2.87446119E-06
},
"SpecifyName": {
"score": 2.84510975E-06
},
"Travel": {
"score": 2.84510975E-06
},
"Delivery": {
"score": 1.66666393E-06
"score": 0.9999993
},
"EntityTests": {
"score": 1.43664579E-06
"score": 1.044335E-05
},
"Roles": {
"score": 5.98274755E-06
},
"Travel": {
"score": 3.09763345E-06
},
"None": {
"score": 2.38094663E-06
},
"Weather_GetForecast": {
"score": 1.02792524E-06
},
"SpecifyName": {
"score": 3.0666667E-09
},
"Delivery": {
"score": 1.8E-09
},
"Greeting": {
"score": 9.9375E-10
"score": 1.0875E-09
},
"Cancel": {
"score": 9.2941177E-10
"score": 1.01764708E-09
},
"Help": {
"score": 9.2941177E-10
"score": 1.01764708E-09
}
},
"entities": {
"$instance": {
"personName": [
{
"startIndex": 49,
"endIndex": 61,
"text": "bart simpson",
"type": "builtin.personName"
}
],
"Part": [
{
"startIndex": 71,
@ -70,6 +78,9 @@
}
]
},
"personName": [
"bart simpson"
],
"Part": [
"kb435"
],
@ -91,55 +102,61 @@
"query": "email about something wicked this way comes from bart simpson and also kb435",
"topScoringIntent": {
"intent": "search",
"score": 0.999999046
"score": 0.9999993
},
"intents": [
{
"intent": "search",
"score": 0.999999046
},
{
"intent": "None",
"score": 6.808464E-06
},
{
"intent": "Roles",
"score": 4.005832E-06
},
{
"intent": "Weather.GetForecast",
"score": 2.87446119E-06
},
{
"intent": "SpecifyName",
"score": 2.84510975E-06
},
{
"intent": "Travel",
"score": 2.84510975E-06
},
{
"intent": "Delivery",
"score": 1.66666393E-06
"score": 0.9999993
},
{
"intent": "EntityTests",
"score": 1.43664579E-06
"score": 1.044335E-05
},
{
"intent": "Roles",
"score": 5.98274755E-06
},
{
"intent": "Travel",
"score": 3.09763345E-06
},
{
"intent": "None",
"score": 2.38094663E-06
},
{
"intent": "Weather.GetForecast",
"score": 1.02792524E-06
},
{
"intent": "SpecifyName",
"score": 3.0666667E-09
},
{
"intent": "Delivery",
"score": 1.8E-09
},
{
"intent": "Greeting",
"score": 9.9375E-10
"score": 1.0875E-09
},
{
"intent": "Cancel",
"score": 9.2941177E-10
"score": 1.01764708E-09
},
{
"intent": "Help",
"score": 9.2941177E-10
"score": 1.01764708E-09
}
],
"entities": [
{
"entity": "bart simpson",
"type": "builtin.personName",
"startIndex": 49,
"endIndex": 60
},
{
"entity": "kb435",
"type": "Part",

Просмотреть файл

@ -2,37 +2,37 @@
"text": "http://foo.com is where you can get a weather forecast for seattle",
"intents": {
"Weather_GetForecast": {
"score": 0.6606207
"score": 0.669524968
},
"EntityTests": {
"score": 0.415276438
"score": 0.342939854
},
"Roles": {
"score": 0.101625636
"score": 0.0432791822
},
"None": {
"score": 0.0172496215
"score": 0.0175834317
},
"search": {
"score": 0.0112974783
"score": 0.014743383
},
"Travel": {
"score": 0.004495183
"score": 0.013458414
},
"SpecifyName": {
"score": 0.00139474764
"score": 0.00172697916
},
"Delivery": {
"score": 0.00116541423
"score": 0.0011408634
},
"Help": {
"score": 0.0005478024
"score": 0.0005502715
},
"Cancel": {
"score": 0.000173182227
"score": 0.000171828113
},
"Greeting": {
"score": 0.000154677386
"score": 0.0001518702
}
},
"entities": {
@ -43,7 +43,15 @@
"endIndex": 66,
"text": "http : / / foo . com is where you can get a weather forecast for seattle",
"type": "Composite2",
"score": 0.68477273
"score": 0.456283748
}
],
"geographyV2": [
{
"startIndex": 59,
"endIndex": 66,
"text": "seattle",
"type": "builtin.geographyV2.city"
}
]
},
@ -64,7 +72,7 @@
"endIndex": 66,
"text": "seattle",
"type": "Weather.Location",
"score": 0.756665945
"score": 0.76184386
}
]
},
@ -75,6 +83,12 @@
"seattle"
]
}
],
"geographyV2": [
{
"type": "city",
"location": "seattle"
}
]
},
"sentiment": {
@ -85,52 +99,52 @@
"query": "http://foo.com is where you can get a weather forecast for seattle",
"topScoringIntent": {
"intent": "Weather.GetForecast",
"score": 0.6606207
"score": 0.669524968
},
"intents": [
{
"intent": "Weather.GetForecast",
"score": 0.6606207
"score": 0.669524968
},
{
"intent": "EntityTests",
"score": 0.415276438
"score": 0.342939854
},
{
"intent": "Roles",
"score": 0.101625636
"score": 0.0432791822
},
{
"intent": "None",
"score": 0.0172496215
"score": 0.0175834317
},
{
"intent": "search",
"score": 0.0112974783
"score": 0.014743383
},
{
"intent": "Travel",
"score": 0.004495183
"score": 0.013458414
},
{
"intent": "SpecifyName",
"score": 0.00139474764
"score": 0.00172697916
},
{
"intent": "Delivery",
"score": 0.00116541423
"score": 0.0011408634
},
{
"intent": "Help",
"score": 0.0005478024
"score": 0.0005502715
},
{
"intent": "Cancel",
"score": 0.000173182227
"score": 0.000171828113
},
{
"intent": "Greeting",
"score": 0.000154677386
"score": 0.0001518702
}
],
"entities": [
@ -139,14 +153,20 @@
"type": "Weather.Location",
"startIndex": 59,
"endIndex": 65,
"score": 0.756665945
"score": 0.76184386
},
{
"entity": "http : / / foo . com is where you can get a weather forecast for seattle",
"type": "Composite2",
"startIndex": 0,
"endIndex": 65,
"score": 0.68477273
"score": 0.456283748
},
{
"entity": "seattle",
"type": "builtin.geographyV2.city",
"startIndex": 59,
"endIndex": 65
},
{
"entity": "http://foo.com",

Просмотреть файл

@ -1,41 +1,59 @@
{
"Text": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5:30am and 4 acres and 4 pico meters and chrimc@hotmail.com and $4 and $4.25 and also 32 and 210.4 and first and 10% and 10.5% and 425-555-1234 and 3 degrees and -27.5 degrees c",
"Intents": {
"text": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5:30am and 4 acres and 4 pico meters and chrimc@hotmail.com and $4 and $4.25 and also 32 and 210.4 and first and 10% and 10.5% and 425-555-1234 and 3 degrees and -27.5 degrees c and the next one and the previous one",
"intents": {
"EntityTests": {
"score": 0.989627659
"score": 0.96595037
},
"Roles": {
"score": 0.180199549
"score": 0.184567839
},
"search": {
"score": 0.0275263824
"score": 0.149123311
},
"Weather_GetForecast": {
"score": 0.009608224
},
"None": {
"score": 0.00783522
"score": 0.0122321565
},
"Travel": {
"score": 0.004344591
"score": 0.0114093516
},
"None": {
"score": 0.009063047
},
"Delivery": {
"score": 0.000295953825
"score": 0.000278715248
},
"SpecifyName": {
"score": 0.000167466555
"score": 6.590373E-05
},
"Help": {
"score": 5.885256E-06
"score": 4.902734E-06
},
"Cancel": {
"score": 2.01380772E-06
"score": 1.602786E-06
},
"Greeting": {
"score": 1.080502E-06
"score": 8.547132E-07
}
},
"Entities": {
"entities": {
"ordinalV2": [
{
"relativeTo": "start",
"offset": 3
},
{
"relativeTo": "start",
"offset": 1
},
{
"relativeTo": "current",
"offset": 1
},
{
"relativeTo": "current",
"offset": -1
}
],
"Composite1": [
{
"age": [
@ -119,7 +137,9 @@
555.0,
1234.0,
3.0,
-27.5
-27.5,
1.0,
1.0
],
"ordinal": [
3.0,
@ -337,6 +357,20 @@
"text": "-27.5",
"type": "builtin.number",
"subtype": "decimal"
},
{
"startIndex": 276,
"endIndex": 279,
"text": "one",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 297,
"endIndex": 300,
"text": "one",
"type": "builtin.number",
"subtype": "integer"
}
],
"ordinal": [
@ -396,11 +430,37 @@
"Composite1": [
{
"startIndex": 0,
"endIndex": 262,
"text": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5 : 30am and 4 acres and 4 pico meters and chrimc @ hotmail . com and $ 4 and $ 4 . 25 and also 32 and 210 . 4 and first and 10 % and 10 . 5 % and 425 - 555 - 1234 and 3 degrees and - 27 . 5 degrees c",
"score": 0.4619997,
"endIndex": 300,
"text": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5 : 30am and 4 acres and 4 pico meters and chrimc @ hotmail . com and $ 4 and $ 4 . 25 and also 32 and 210 . 4 and first and 10 % and 10 . 5 % and 425 - 555 - 1234 and 3 degrees and - 27 . 5 degrees c and the next one and the previous one",
"score": 0.877445638,
"type": "Composite1"
}
],
"ordinalV2": [
{
"startIndex": 44,
"endIndex": 47,
"text": "3rd",
"type": "builtin.ordinalV2"
},
{
"startIndex": 188,
"endIndex": 193,
"text": "first",
"type": "builtin.ordinalV2"
},
{
"startIndex": 271,
"endIndex": 279,
"text": "next one",
"type": "builtin.ordinalV2.relative"
},
{
"startIndex": 288,
"endIndex": 300,
"text": "previous one",
"type": "builtin.ordinalV2.relative"
}
]
}
},
@ -409,64 +469,64 @@
"score": 0.5
},
"v2": {
"query": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5:30am and 4 acres and 4 pico meters and chrimc@hotmail.com and $4 and $4.25 and also 32 and 210.4 and first and 10% and 10.5% and 425-555-1234 and 3 degrees and -27.5 degrees c",
"query": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5:30am and 4 acres and 4 pico meters and chrimc@hotmail.com and $4 and $4.25 and also 32 and 210.4 and first and 10% and 10.5% and 425-555-1234 and 3 degrees and -27.5 degrees c and the next one and the previous one",
"topScoringIntent": {
"intent": "EntityTests",
"score": 0.989627659
"score": 0.96595037
},
"intents": [
{
"intent": "EntityTests",
"score": 0.989627659
"score": 0.96595037
},
{
"intent": "Roles",
"score": 0.180199549
"score": 0.184567839
},
{
"intent": "search",
"score": 0.0275263824
"score": 0.149123311
},
{
"intent": "Weather.GetForecast",
"score": 0.009608224
},
{
"intent": "None",
"score": 0.00783522
"score": 0.0122321565
},
{
"intent": "Travel",
"score": 0.004344591
"score": 0.0114093516
},
{
"intent": "None",
"score": 0.009063047
},
{
"intent": "Delivery",
"score": 0.000295953825
"score": 0.000278715248
},
{
"intent": "SpecifyName",
"score": 0.000167466555
"score": 6.590373E-05
},
{
"intent": "Help",
"score": 5.885256E-06
"score": 4.902734E-06
},
{
"intent": "Cancel",
"score": 2.01380772E-06
"score": 1.602786E-06
},
{
"intent": "Greeting",
"score": 1.080502E-06
"score": 8.547132E-07
}
],
"entities": [
{
"entity": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5 : 30am and 4 acres and 4 pico meters and chrimc @ hotmail . com and $ 4 and $ 4 . 25 and also 32 and 210 . 4 and first and 10 % and 10 . 5 % and 425 - 555 - 1234 and 3 degrees and - 27 . 5 degrees c",
"entity": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5 : 30am and 4 acres and 4 pico meters and chrimc @ hotmail . com and $ 4 and $ 4 . 25 and also 32 and 210 . 4 and first and 10 % and 10 . 5 % and 425 - 555 - 1234 and 3 degrees and - 27 . 5 degrees c and the next one and the previous one",
"type": "Composite1",
"startIndex": 0,
"endIndex": 261,
"score": 0.4619997
"endIndex": 299,
"score": 0.877445638
},
{
"entity": "12",
@ -628,6 +688,26 @@
"value": "-27.5"
}
},
{
"entity": "one",
"type": "builtin.number",
"startIndex": 276,
"endIndex": 278,
"resolution": {
"subtype": "integer",
"value": "1"
}
},
{
"entity": "one",
"type": "builtin.number",
"startIndex": 297,
"endIndex": 299,
"resolution": {
"subtype": "integer",
"value": "1"
}
},
{
"entity": "12 years old",
"type": "builtin.age",
@ -796,6 +876,46 @@
"value": "1"
}
},
{
"entity": "3rd",
"type": "builtin.ordinalV2",
"startIndex": 44,
"endIndex": 46,
"resolution": {
"offset": "3",
"relativeTo": "start"
}
},
{
"entity": "first",
"type": "builtin.ordinalV2",
"startIndex": 188,
"endIndex": 192,
"resolution": {
"offset": "1",
"relativeTo": "start"
}
},
{
"entity": "next one",
"type": "builtin.ordinalV2.relative",
"startIndex": 271,
"endIndex": 278,
"resolution": {
"offset": "1",
"relativeTo": "current"
}
},
{
"entity": "previous one",
"type": "builtin.ordinalV2.relative",
"startIndex": 288,
"endIndex": 299,
"resolution": {
"offset": "-1",
"relativeTo": "current"
}
},
{
"entity": "10%",
"type": "builtin.percentage",
@ -848,7 +968,7 @@
"compositeEntities": [
{
"parentType": "Composite1",
"value": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5 : 30am and 4 acres and 4 pico meters and chrimc @ hotmail . com and $ 4 and $ 4 . 25 and also 32 and 210 . 4 and first and 10 % and 10 . 5 % and 425 - 555 - 1234 and 3 degrees and - 27 . 5 degrees c",
"value": "12 years old and 3 days old and monday july 3rd and every monday and between 3am and 5 : 30am and 4 acres and 4 pico meters and chrimc @ hotmail . com and $ 4 and $ 4 . 25 and also 32 and 210 . 4 and first and 10 % and 10 . 5 % and 425 - 555 - 1234 and 3 degrees and - 27 . 5 degrees c and the next one and the previous one",
"children": [
{
"type": "builtin.age",
@ -962,6 +1082,14 @@
"type": "builtin.number",
"value": "-27.5"
},
{
"type": "builtin.number",
"value": "one"
},
{
"type": "builtin.number",
"value": "one"
},
{
"type": "builtin.ordinal",
"value": "3rd"

Просмотреть файл

@ -1,41 +1,47 @@
{
"Text": "http://foo.com is where you can get a weather forecast for seattle",
"Intents": {
"text": "http://foo.com is where you can get a weather forecast for seattle",
"intents": {
"Weather_GetForecast": {
"score": 0.6606207
"score": 0.669524968
},
"EntityTests": {
"score": 0.415276438
"score": 0.342939854
},
"Roles": {
"score": 0.07347516
"score": 0.0432791822
},
"None": {
"score": 0.0172496215
"score": 0.0175834317
},
"search": {
"score": 0.0105431341
"score": 0.014743383
},
"Travel": {
"score": 0.00389883434
"score": 0.013458414
},
"SpecifyName": {
"score": 0.001811265
"score": 0.00172697916
},
"Delivery": {
"score": 0.00116541423
"score": 0.0011408634
},
"Help": {
"score": 0.0005478024
"score": 0.0005502715
},
"Cancel": {
"score": 0.000173182227
"score": 0.000171828113
},
"Greeting": {
"score": 0.000154677386
"score": 0.0001518702
}
},
"Entities": {
"entities": {
"geographyV2": [
{
"type": "city",
"location": "seattle"
}
],
"Composite2": [
{
"url": [
@ -58,7 +64,7 @@
"startIndex": 59,
"endIndex": 66,
"text": "seattle",
"score": 0.756665945,
"score": 0.76184386,
"type": "Weather.Location"
}
]
@ -71,9 +77,17 @@
"startIndex": 0,
"endIndex": 66,
"text": "http : / / foo . com is where you can get a weather forecast for seattle",
"score": 0.617026448,
"score": 0.456283748,
"type": "Composite2"
}
],
"geographyV2": [
{
"startIndex": 59,
"endIndex": 66,
"text": "seattle",
"type": "builtin.geographyV2.city"
}
]
}
},
@ -85,52 +99,52 @@
"query": "http://foo.com is where you can get a weather forecast for seattle",
"topScoringIntent": {
"intent": "Weather.GetForecast",
"score": 0.6606207
"score": 0.669524968
},
"intents": [
{
"intent": "Weather.GetForecast",
"score": 0.6606207
"score": 0.669524968
},
{
"intent": "EntityTests",
"score": 0.415276438
"score": 0.342939854
},
{
"intent": "Roles",
"score": 0.07347516
"score": 0.0432791822
},
{
"intent": "None",
"score": 0.0172496215
"score": 0.0175834317
},
{
"intent": "search",
"score": 0.0105431341
"score": 0.014743383
},
{
"intent": "Travel",
"score": 0.00389883434
"score": 0.013458414
},
{
"intent": "SpecifyName",
"score": 0.001811265
"score": 0.00172697916
},
{
"intent": "Delivery",
"score": 0.00116541423
"score": 0.0011408634
},
{
"intent": "Help",
"score": 0.0005478024
"score": 0.0005502715
},
{
"intent": "Cancel",
"score": 0.000173182227
"score": 0.000171828113
},
{
"intent": "Greeting",
"score": 0.000154677386
"score": 0.0001518702
}
],
"entities": [
@ -139,14 +153,20 @@
"type": "Weather.Location",
"startIndex": 59,
"endIndex": 65,
"score": 0.756665945
"score": 0.76184386
},
{
"entity": "http : / / foo . com is where you can get a weather forecast for seattle",
"type": "Composite2",
"startIndex": 0,
"endIndex": 65,
"score": 0.617026448
"score": 0.456283748
},
{
"entity": "seattle",
"type": "builtin.geographyV2.city",
"startIndex": 59,
"endIndex": 65
},
{
"entity": "http://foo.com",

Просмотреть файл

@ -4,53 +4,46 @@
"Roles": {
"score": 1.0
},
"EntityTests": {
"score": 0.0115484772
"search": {
"score": 0.08896044
},
"Weather_GetForecast": {
"score": 0.009885744
},
"search": {
"score": 0.009508528
"score": 0.0100867962
},
"Travel": {
"score": 0.004027992
"score": 0.009896766
},
"EntityTests": {
"score": 0.0046325135
},
"None": {
"score": 0.00087468233
},
"SpecifyName": {
"score": 0.000113203794
"score": 0.00093744183
},
"Delivery": {
"score": 7.92103747E-05
"score": 7.978094E-05
},
"SpecifyName": {
"score": 5.360404E-05
},
"Help": {
"score": 6.826453E-07
"score": 7.622754E-07
},
"Greeting": {
"score": 4.24091354E-07
"score": 4.73494453E-07
},
"Cancel": {
"score": 4.06555785E-07
"score": 4.50860341E-07
}
},
"entities": {
"$instance": {
"Composite1": [
"likee": [
{
"startIndex": 0,
"endIndex": 211,
"text": "3 inches long by 2 inches wide and 5 % to 10 % and are you between 6 years old and 8 years old and can i trade kb457 for kb922 and change 425 - 777 - 1212 to 206 - 666 - 4123 and did delta buy virgin and did the rain from",
"type": "Composite1",
"score": 0.0632453859
},
{
"startIndex": 299,
"endIndex": 420,
"text": "68 degrees and 72 degrees and john likes mary and leave 3pm and arrive 5pm and pay between $ 400 and $ 500 and send chrimc @",
"type": "Composite1",
"score": 0.0442264825
"startIndex": 340,
"endIndex": 344,
"text": "mary",
"type": "Name",
"score": 0.9899757
}
],
"liker": [
@ -59,25 +52,7 @@
"endIndex": 333,
"text": "john",
"type": "Name",
"score": 0.9921442
}
],
"likee": [
{
"startIndex": 340,
"endIndex": 344,
"text": "mary",
"type": "Name",
"score": 0.9902693
}
],
"destination": [
{
"startIndex": 226,
"endIndex": 233,
"text": "redmond",
"type": "Weather.Location",
"score": 0.987181664
"score": 0.9922591
}
],
"source": [
@ -86,7 +61,130 @@
"endIndex": 218,
"text": "hawaii",
"type": "Weather.Location",
"score": 0.972107649
"score": 0.9713092
}
],
"destination": [
{
"startIndex": 226,
"endIndex": 233,
"text": "redmond",
"type": "Weather.Location",
"score": 0.985884964
}
],
"number": [
{
"startIndex": 0,
"endIndex": 1,
"text": "3",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 17,
"endIndex": 18,
"text": "2",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 35,
"endIndex": 36,
"text": "5",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 41,
"endIndex": 43,
"text": "10",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 65,
"endIndex": 66,
"text": "6",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 81,
"endIndex": 82,
"text": "8",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 136,
"endIndex": 139,
"text": "425",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 140,
"endIndex": 143,
"text": "777",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 144,
"endIndex": 148,
"text": "1212",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 152,
"endIndex": 155,
"text": "206",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 156,
"endIndex": 159,
"text": "666",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 160,
"endIndex": 164,
"text": "4123",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 299,
"endIndex": 301,
"text": "68",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 314,
"endIndex": 316,
"text": "72",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 391,
"endIndex": 394,
"text": "400",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 400,
"endIndex": 403,
"text": "500",
"type": "builtin.number",
"subtype": "integer"
}
],
"begin": [
@ -105,6 +203,20 @@
"type": "builtin.age"
}
],
"datetime": [
{
"startIndex": 65,
"endIndex": 72,
"text": "6 years",
"type": "builtin.datetimeV2.duration"
},
{
"startIndex": 81,
"endIndex": 88,
"text": "8 years",
"type": "builtin.datetimeV2.duration"
}
],
"leave": [
{
"startIndex": 355,
@ -137,6 +249,20 @@
"type": "builtin.dimension"
}
],
"dimension": [
{
"startIndex": 355,
"endIndex": 358,
"text": "3pm",
"type": "builtin.dimension"
},
{
"startIndex": 370,
"endIndex": 373,
"text": "5pm",
"type": "builtin.dimension"
}
],
"receiver": [
{
"startIndex": 413,
@ -153,6 +279,20 @@
"type": "builtin.email"
}
],
"geographyV2": [
{
"startIndex": 212,
"endIndex": 218,
"text": "hawaii",
"type": "builtin.geographyV2.state"
},
{
"startIndex": 226,
"endIndex": 233,
"text": "redmond",
"type": "builtin.geographyV2.city"
}
],
"min": [
{
"startIndex": 390,
@ -185,7 +325,37 @@
"type": "builtin.percentage"
}
],
"a": [
"personName": [
{
"startIndex": 329,
"endIndex": 333,
"text": "john",
"type": "builtin.personName"
},
{
"startIndex": 340,
"endIndex": 344,
"text": "mary",
"type": "builtin.personName"
}
],
"old": [
{
"startIndex": 136,
"endIndex": 148,
"text": "425-777-1212",
"type": "builtin.phonenumber"
}
],
"newPhone": [
{
"startIndex": 152,
"endIndex": 164,
"text": "206-666-4123",
"type": "builtin.phonenumber"
}
],
"temperature": [
{
"startIndex": 299,
"endIndex": 309,
@ -250,233 +420,35 @@
}
]
},
"Composite1": [
{
"$instance": {
"datetime": [
{
"startIndex": 65,
"endIndex": 72,
"text": "6 years",
"type": "builtin.datetimeV2.duration"
},
{
"startIndex": 81,
"endIndex": 88,
"text": "8 years",
"type": "builtin.datetimeV2.duration"
}
],
"number": [
{
"startIndex": 0,
"endIndex": 1,
"text": "3",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 17,
"endIndex": 18,
"text": "2",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 35,
"endIndex": 36,
"text": "5",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 41,
"endIndex": 43,
"text": "10",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 65,
"endIndex": 66,
"text": "6",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 81,
"endIndex": 82,
"text": "8",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 136,
"endIndex": 139,
"text": "425",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 140,
"endIndex": 143,
"text": "777",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 144,
"endIndex": 148,
"text": "1212",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 152,
"endIndex": 155,
"text": "206",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 156,
"endIndex": 159,
"text": "666",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 160,
"endIndex": 164,
"text": "4123",
"type": "builtin.number",
"subtype": "integer"
}
],
"phonenumber": [
{
"startIndex": 136,
"endIndex": 148,
"text": "425-777-1212",
"type": "builtin.phonenumber"
},
{
"startIndex": 152,
"endIndex": 164,
"text": "206-666-4123",
"type": "builtin.phonenumber"
}
]
},
"datetime": [
{
"type": "duration",
"timex": [
"P6Y"
]
},
{
"type": "duration",
"timex": [
"P8Y"
]
}
],
"number": [
3,
2,
5,
10,
6,
8,
425,
777,
1212,
206,
666,
4123
],
"phonenumber": [
"425-777-1212",
"206-666-4123"
]
},
{
"$instance": {
"dimension": [
{
"startIndex": 355,
"endIndex": 358,
"text": "3pm",
"type": "builtin.dimension"
},
{
"startIndex": 370,
"endIndex": 373,
"text": "5pm",
"type": "builtin.dimension"
}
],
"number": [
{
"startIndex": 299,
"endIndex": 301,
"text": "68",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 314,
"endIndex": 316,
"text": "72",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 391,
"endIndex": 394,
"text": "400",
"type": "builtin.number",
"subtype": "integer"
},
{
"startIndex": 400,
"endIndex": 403,
"text": "500",
"type": "builtin.number",
"subtype": "integer"
}
]
},
"dimension": [
{
"number": 3,
"units": "Picometer"
},
{
"number": 5,
"units": "Picometer"
}
],
"number": [
68,
72,
400,
500
]
}
"likee": [
"mary"
],
"liker": [
"john"
],
"likee": [
"mary"
"source": [
"hawaii"
],
"destination": [
"redmond"
],
"source": [
"hawaii"
"number": [
3,
2,
5,
10,
6,
8,
425,
777,
1212,
206,
666,
4123,
68,
72,
400,
500
],
"begin": [
{
@ -490,6 +462,20 @@
"units": "Year"
}
],
"datetime": [
{
"type": "duration",
"timex": [
"P6Y"
]
},
{
"type": "duration",
"timex": [
"P8Y"
]
}
],
"leave": [
{
"type": "time",
@ -518,12 +504,32 @@
"units": "Inch"
}
],
"dimension": [
{
"number": 3,
"units": "Picometer"
},
{
"number": 5,
"units": "Picometer"
}
],
"receiver": [
"chrimc@hotmail.com"
],
"sender": [
"emad@gmail.com"
],
"geographyV2": [
{
"type": "state",
"location": "hawaii"
},
{
"type": "city",
"location": "redmond"
}
],
"min": [
{
"number": 400,
@ -542,7 +548,17 @@
"maximum": [
10
],
"a": [
"personName": [
"john",
"mary"
],
"old": [
"425-777-1212"
],
"newPhone": [
"206-666-4123"
],
"temperature": [
{
"number": 68,
"units": "Degree"
@ -593,92 +609,78 @@
"score": 1.0
},
{
"intent": "EntityTests",
"score": 0.0115484772
"intent": "search",
"score": 0.08896044
},
{
"intent": "Weather.GetForecast",
"score": 0.009885744
},
{
"intent": "search",
"score": 0.009508528
"score": 0.0100867962
},
{
"intent": "Travel",
"score": 0.004027992
"score": 0.009896766
},
{
"intent": "EntityTests",
"score": 0.0046325135
},
{
"intent": "None",
"score": 0.00087468233
},
{
"intent": "SpecifyName",
"score": 0.000113203794
"score": 0.00093744183
},
{
"intent": "Delivery",
"score": 7.92103747E-05
"score": 7.978094E-05
},
{
"intent": "SpecifyName",
"score": 5.360404E-05
},
{
"intent": "Help",
"score": 6.826453E-07
"score": 7.622754E-07
},
{
"intent": "Greeting",
"score": 4.24091354E-07
"score": 4.73494453E-07
},
{
"intent": "Cancel",
"score": 4.06555785E-07
"score": 4.50860341E-07
}
],
"entities": [
{
"entity": "john",
"type": "Name",
"startIndex": 329,
"endIndex": 332,
"score": 0.9921442,
"role": "liker"
},
{
"entity": "mary",
"type": "Name",
"startIndex": 340,
"endIndex": 343,
"score": 0.9902693,
"score": 0.9899757,
"role": "likee"
},
{
"entity": "redmond",
"type": "Weather.Location",
"startIndex": 226,
"endIndex": 232,
"score": 0.987181664,
"role": "destination"
"entity": "john",
"type": "Name",
"startIndex": 329,
"endIndex": 332,
"score": 0.9922591,
"role": "liker"
},
{
"entity": "hawaii",
"type": "Weather.Location",
"startIndex": 212,
"endIndex": 217,
"score": 0.972107649,
"score": 0.9713092,
"role": "source"
},
{
"entity": "3 inches long by 2 inches wide and 5 % to 10 % and are you between 6 years old and 8 years old and can i trade kb457 for kb922 and change 425 - 777 - 1212 to 206 - 666 - 4123 and did delta buy virgin and did the rain from",
"type": "Composite1",
"startIndex": 0,
"endIndex": 210,
"score": 0.0632453859
},
{
"entity": "68 degrees and 72 degrees and john likes mary and leave 3pm and arrive 5pm and pay between $ 400 and $ 500 and send chrimc @",
"type": "Composite1",
"startIndex": 299,
"endIndex": 419,
"score": 0.0442264825
"entity": "redmond",
"type": "Weather.Location",
"startIndex": 226,
"endIndex": 232,
"score": 0.985884964,
"role": "destination"
},
{
"entity": "3",
@ -986,6 +988,18 @@
},
"role": "sender"
},
{
"entity": "hawaii",
"type": "builtin.geographyV2.state",
"startIndex": 212,
"endIndex": 217
},
{
"entity": "redmond",
"type": "builtin.geographyV2.city",
"startIndex": 226,
"endIndex": 232
},
{
"entity": "$400",
"type": "builtin.currency",
@ -1028,6 +1042,18 @@
},
"role": "maximum"
},
{
"entity": "john",
"type": "builtin.personName",
"startIndex": 329,
"endIndex": 332
},
{
"entity": "mary",
"type": "builtin.personName",
"startIndex": 340,
"endIndex": 343
},
{
"entity": "425-777-1212",
"type": "builtin.phonenumber",
@ -1036,7 +1062,8 @@
"resolution": {
"score": "0.9",
"value": "425-777-1212"
}
},
"role": "old"
},
{
"entity": "206-666-4123",
@ -1046,7 +1073,8 @@
"resolution": {
"score": "0.9",
"value": "206-666-4123"
}
},
"role": "newPhone"
},
{
"entity": "68 degrees",
@ -1056,8 +1084,7 @@
"resolution": {
"unit": "Degree",
"value": "68"
},
"role": "a"
}
},
{
"entity": "72 degrees",
@ -1128,108 +1155,6 @@
"role": "buy"
}
],
"compositeEntities": [
{
"parentType": "Composite1",
"value": "3 inches long by 2 inches wide and 5 % to 10 % and are you between 6 years old and 8 years old and can i trade kb457 for kb922 and change 425 - 777 - 1212 to 206 - 666 - 4123 and did delta buy virgin and did the rain from",
"children": [
{
"type": "builtin.datetimeV2.duration",
"value": "6 years"
},
{
"type": "builtin.datetimeV2.duration",
"value": "8 years"
},
{
"type": "builtin.number",
"value": "3"
},
{
"type": "builtin.number",
"value": "2"
},
{
"type": "builtin.number",
"value": "5"
},
{
"type": "builtin.number",
"value": "10"
},
{
"type": "builtin.number",
"value": "6"
},
{
"type": "builtin.number",
"value": "8"
},
{
"type": "builtin.number",
"value": "425"
},
{
"type": "builtin.number",
"value": "777"
},
{
"type": "builtin.number",
"value": "1212"
},
{
"type": "builtin.number",
"value": "206"
},
{
"type": "builtin.number",
"value": "666"
},
{
"type": "builtin.number",
"value": "4123"
},
{
"type": "builtin.phonenumber",
"value": "425-777-1212"
},
{
"type": "builtin.phonenumber",
"value": "206-666-4123"
}
]
},
{
"parentType": "Composite1",
"value": "68 degrees and 72 degrees and john likes mary and leave 3pm and arrive 5pm and pay between $ 400 and $ 500 and send chrimc @",
"children": [
{
"type": "builtin.dimension",
"value": "3pm"
},
{
"type": "builtin.dimension",
"value": "5pm"
},
{
"type": "builtin.number",
"value": "68"
},
{
"type": "builtin.number",
"value": "72"
},
{
"type": "builtin.number",
"value": "400"
},
{
"type": "builtin.number",
"value": "500"
}
]
}
],
"sentimentAnalysis": {
"label": "neutral",
"score": 0.5

Просмотреть файл

@ -1,6 +1,6 @@
{
"luis_schema_version": "3.2.0",
"versionId": "roles",
"versionId": "GeoPeople",
"name": "Contoso App",
"desc": "Default Intents for Azure Bot Service V2",
"culture": "en-us",
@ -37,19 +37,15 @@
"name": "Travel"
},
{
"name": "Weather.GetForecast",
"inherits": {
"domain_name": "Weather",
"model_name": "GetForecast"
}
"name": "Weather.GetForecast"
}
],
"entities": [
{
"name": "Name",
"roles": [
"liker",
"likee"
"likee",
"liker"
]
},
{
@ -58,10 +54,6 @@
},
{
"name": "Weather.Location",
"inherits": {
"domain_name": "Weather",
"model_name": "Location"
},
"roles": [
"source",
"destination"
@ -84,8 +76,8 @@
"State"
],
"roles": [
"Destination",
"Source"
"Source",
"Destination"
]
},
{
@ -152,8 +144,8 @@
{
"name": "person",
"roles": [
"to",
"from"
"from",
"to"
],
"explicitList": []
},
@ -179,36 +171,43 @@
{
"name": "age",
"roles": [
"end",
"begin"
"begin",
"end"
]
},
{
"name": "datetimeV2",
"roles": [
"leave",
"arrive"
"arrive",
"leave"
]
},
{
"name": "dimension",
"roles": [
"length",
"width"
"width",
"length"
]
},
{
"name": "email",
"roles": [
"sender",
"receiver"
"receiver",
"sender"
]
},
{
"name": "geographyV2",
"roles": [
"startloc",
"endloc"
]
},
{
"name": "money",
"roles": [
"max",
"min"
"min",
"max"
]
},
{
@ -221,6 +220,13 @@
"start"
]
},
{
"name": "ordinalV2",
"roles": [
"startpos",
"endpos"
]
},
{
"name": "percentage",
"roles": [
@ -228,10 +234,17 @@
"maximum"
]
},
{
"name": "personName",
"roles": [
"child",
"parent"
]
},
{
"name": "phonenumber",
"roles": [
"new",
"newPhone",
"old"
]
},
@ -253,16 +266,16 @@
"regex_features": [],
"patterns": [
{
"pattern": "email about {subject} [from {person}] [and also {subject:extra}]",
"intent": "search"
"pattern": "deliver from {Address:Source} to {Address:Destination}",
"intent": "Roles"
},
{
"pattern": "email from {person:from} to {person:to}",
"intent": "search"
},
{
"pattern": "deliver from {Address:Source} to {Address:Destination}",
"intent": "Roles"
"pattern": "email about {subject} [from {person}] [and also {subject:extra}]",
"intent": "search"
}
],
"utterances": [
@ -420,6 +433,18 @@
"startPos": 119,
"endPos": 123
},
{
"entity": "Airline",
"role": "Buyer",
"startPos": 173,
"endPos": 177
},
{
"entity": "Airline",
"role": "Seller",
"startPos": 183,
"endPos": 188
},
{
"entity": "Weather.Location",
"role": "source",
@ -703,6 +728,64 @@
"intent": "Help",
"entities": []
},
{
"text": "bart simpson",
"intent": "EntityTests",
"entities": []
},
{
"text": "bart simpson helps homer simpson",
"intent": "Roles",
"entities": [
{
"entity": "personName",
"role": "child",
"startPos": 0,
"endPos": 11
},
{
"entity": "personName",
"role": "parent",
"startPos": 19,
"endPos": 31
}
]
},
{
"text": "bart simpson is parent of lisa simpson to move calcutta to london",
"intent": "Roles",
"entities": [
{
"entity": "personName",
"role": "parent",
"startPos": 0,
"endPos": 11
},
{
"entity": "personName",
"role": "child",
"startPos": 26,
"endPos": 37
},
{
"entity": "geographyV2",
"role": "startloc",
"startPos": 47,
"endPos": 54
},
{
"entity": "geographyV2",
"role": "endloc",
"startPos": 59,
"endPos": 64
}
]
},
{
"text": "calcutta",
"intent": "EntityTests",
"entities": []
},
{
"text": "can i trade kb457 for kb922",
"intent": "Roles",
@ -756,7 +839,7 @@
},
{
"entity": "phonenumber",
"role": "new",
"role": "newPhone",
"startPos": 23,
"endPos": 34
}
@ -774,7 +857,7 @@
},
{
"entity": "phonenumber",
"role": "new",
"role": "newPhone",
"startPos": 23,
"endPos": 34
}
@ -822,6 +905,11 @@
}
]
},
{
"text": "did delta buy virgin",
"intent": "Roles",
"entities": []
},
{
"text": "did delta buy virgin?",
"intent": "Roles",
@ -965,6 +1053,72 @@
}
]
},
{
"text": "go from 3rd to 5th",
"intent": "Roles",
"entities": [
{
"entity": "ordinalV2",
"role": "startpos",
"startPos": 8,
"endPos": 10
},
{
"entity": "ordinalV2",
"role": "endpos",
"startPos": 15,
"endPos": 17
}
]
},
{
"text": "go from first to last",
"intent": "Roles",
"entities": [
{
"entity": "ordinalV2",
"role": "startpos",
"startPos": 8,
"endPos": 12
},
{
"entity": "ordinalV2",
"role": "endpos",
"startPos": 17,
"endPos": 20
}
]
},
{
"text": "go from next to last to last move london to jakarta and homer simpson is the parent of lisa simpson",
"intent": "Roles",
"entities": [
{
"entity": "ordinalV2",
"role": "startpos",
"startPos": 8,
"endPos": 19
},
{
"entity": "ordinalV2",
"role": "endpos",
"startPos": 24,
"endPos": 27
},
{
"entity": "personName",
"role": "parent",
"startPos": 56,
"endPos": 68
},
{
"entity": "personName",
"role": "child",
"startPos": 87,
"endPos": 98
}
]
},
{
"text": "good afternoon",
"intent": "Greeting",
@ -1057,6 +1211,53 @@
"intent": "Greeting",
"entities": []
},
{
"text": "homer simpson is parent of bart simpson",
"intent": "Roles",
"entities": []
},
{
"text": "homer simpson is parent of bart simpson to move jakarta to calcutta",
"intent": "Roles",
"entities": [
{
"entity": "personName",
"role": "child",
"startPos": 27,
"endPos": 38
},
{
"entity": "geographyV2",
"role": "startloc",
"startPos": 48,
"endPos": 54
},
{
"entity": "geographyV2",
"role": "endloc",
"startPos": 59,
"endPos": 66
}
]
},
{
"text": "homer simpson is parent of lisa simpson",
"intent": "Roles",
"entities": [
{
"entity": "personName",
"role": "parent",
"startPos": 0,
"endPos": 12
},
{
"entity": "personName",
"role": "child",
"startPos": 27,
"endPos": 38
}
]
},
{
"text": "how are you",
"intent": "Greeting",
@ -1282,12 +1483,6 @@
"role": "a",
"startPos": 15,
"endPos": 24
},
{
"entity": "temperature",
"role": "b",
"startPos": 30,
"endPos": 39
}
]
},
@ -1456,6 +1651,78 @@
"intent": "Help",
"entities": []
},
{
"text": "move calcutta to mumbai",
"intent": "Roles",
"entities": [
{
"entity": "geographyV2",
"role": "startloc",
"startPos": 5,
"endPos": 12
},
{
"entity": "geographyV2",
"role": "endloc",
"startPos": 17,
"endPos": 22
}
]
},
{
"text": "move jakarta to london",
"intent": "Roles",
"entities": [
{
"entity": "geographyV2",
"role": "startloc",
"startPos": 5,
"endPos": 11
},
{
"entity": "geographyV2",
"role": "endloc",
"startPos": 16,
"endPos": 21
}
]
},
{
"text": "move london to calcutta",
"intent": "Roles",
"entities": [
{
"entity": "geographyV2",
"role": "startloc",
"startPos": 5,
"endPos": 10
},
{
"entity": "geographyV2",
"role": "endloc",
"startPos": 15,
"endPos": 22
}
]
},
{
"text": "move london to jakarta",
"intent": "Roles",
"entities": [
{
"entity": "geographyV2",
"role": "startloc",
"startPos": 5,
"endPos": 10
},
{
"entity": "geographyV2",
"role": "endloc",
"startPos": 15,
"endPos": 21
}
]
},
{
"text": "my name is emad",
"intent": "SpecifyName",