private void LoadBuildinEntityTypePerUserSay(TAgent agent, IntentExpressionPart data) { /*var existedEntityType = agent.Entities.FirstOrDefault(x => x.Name == data.Meta); * * if (existedEntityType == null) * { * existedEntityType = new EntityType * { * Name = data.Meta, * Entries = new List<EntityEntry>(), * IsOverridable = true * }; * * agent.Entities.Add(existedEntityType); * } * * var entries = existedEntityType.Entries.Select(x => x.Value.ToLower()).ToList(); * if (!entries.Contains(data.Text.ToLower())) * { * existedEntityType.Entries.Add(new EntityEntry * { * Value = data.Text, * Synonyms = new List<EntrySynonym> * { * new EntrySynonym * { * Synonym = data.Text * } * } * }); * }*/ }
private void LoadBuildinEntityTypePerUserSay(Agent agent, IntentExpressionPart data) { var existedEntityType = agent.Entities.FirstOrDefault(x => x.Name == data.Meta); if (existedEntityType == null) { existedEntityType = new EntityType { Name = data.Meta, Entries = new List <EntityEntry>(), IsOverridable = true }; agent.Entities.Add(existedEntityType); } var entries = existedEntityType.Entries.Select(x => x.Value.ToLower()).ToList(); if (!entries.Contains(data.Text.ToLower())) { existedEntityType.Entries.Add(new EntityEntry { Value = data.Text, Synonyms = new List <EntrySynonym> { new EntrySynonym { Synonym = data.Text } } }); } }
public IntentExpressionPart ToIntentExpressionPart(IntentExpressionPart part = null) { if (part == null) { part = new IntentExpressionPart { Id = Guid.NewGuid().ToString(), Alias = Alias, Meta = Meta, Text = Text, UserDefined = UserDefined }; } return(part); }