public override Task <ParseResult> ParseAsync(ChatState state, Chat_ParseField chatParseField, ChatMessage message) { var tokens = TextClassificationService.Tokenize(message.UserInput); // HTC One and iPhone match words quite easily var cleanedTokens = (from t in tokens where t != "phone" && t != "phones" && t != "phone's" && t != "the" && t != "tone" select t.ToLower()).ToArray(); (string matchedText, int matchedIndex, float ratio) = MatchService.FindMatch(cleanedTokens, 1, 4, deviceCatalog.MatchCharacters); var device = deviceCatalog.MakeModelList[matchedIndex]; var deviceMatch = new DeviceMatchResult { Id = device.Id, Make = device.Make, Model = device.Model, DisplayName = device.DisplayName, IsUncommon = device.IsUncommon, Ratio = ratio }; double minConfidence = ChatConfiguration.MinimumDeviceConfidence; if (device.IsUncommon) { minConfidence = ChatConfiguration.MinimumUncommonDeviceConfidence; } if (deviceMatch.Ratio > minConfidence) { return(Task.FromResult(ParseResult.CreateSuccess(deviceMatch))); } return(Task.FromResult(ParseResult.Failed)); }
public IntentParser(TextClassificationService classificationService, UserDataFilterService filterService, double threshold, string defaultClassifier) { this.defaultClassifier = defaultClassifier; this.classificationService = classificationService; this.filterService = filterService; this.threshold = threshold; }
public TextClassificationServiceTests() { var configPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\ChatWeb\azureml-dev.config")); var chatConfiguration = new ChatConfiguration(); var awsDynamoService = new AWSDynamoService(chatConfiguration); ClassificationService = new TextClassificationService(configPath, awsDynamoService, null); }
public IntentGatewayParser(ChatModel chatModel, IChatScriptManager chatScriptManager, TextClassificationService classificationService, IExternalDataStorageService externalDataStorageService, ChatConfiguration chatConfiguration) { this.chatModel = chatModel; this.chatScriptManager = chatScriptManager; this.classificationService = classificationService; this.externalDataStorageService = externalDataStorageService; this.chatConfiguration = chatConfiguration; }
/// <summary> /// Initializes the services (it's based on the Dependency Injection pattern) /// </summary> private static void Init() { if (_container == null) { ServiceUtils.Init(); _container = Container.GetInstance(); _entityExtractionService = _container.Resolve <EntityExtractionService>(); _languageDetectionService = _container.Resolve <LanguageDetectionService>(); _sentimentAnalysisService = _container.Resolve <SentimentAnalysisService>(); _textClassificationService = _container.Resolve <TextClassificationService>(); _textSimilarityService = _container.Resolve <TextSimilarityService>(); _wikisearchService = _container.Resolve <WikisearchService>(); _customSpotService = _container.Resolve <CustomSpotService>(); _customModelService = _container.Resolve <CustomModelService>(); } }
public TextClassificationValidationTests(ServiceFixture fixture) { _fixture = fixture; _textClassificationService = fixture.TextClassificationService; }