public async Task RawSentimentDetection(SentimentTestData data) { log.LogInformation("RawSentimentDetection: {0}", data); var helper = new TestHelper(); var runner = new TestRunner(helper, data); await runner.Load().LastOrDefaultAsync(); var testing = runner.Active.GetTesting(); testing.DisableAspects = true; testing.DisableSvm = true; testing.TrackArff = true; testing.Init(); using var persistency = runner.Active.Resolve <IPipelinePersistency>(); persistency.Start(Path.Combine(TestContext.CurrentContext.TestDirectory, "Results", data.Product)); persistency.Debug = true; await testing.Process(runner.Load()).ForEachAsync( item => { //persistency.Save(item); }); Assert.AreEqual(data.Errors, testing.Errors); Assert.AreEqual(data.Performance, testing.GetPerformanceDescription()); }
public TestRunner(TestHelper helper, SentimentTestData definition) { this.helper = helper; this.definition = definition; Active = helper.ContainerHelper; var maxParallel = Environment.ProcessorCount / 2; semaphore = new SemaphoreSlim(maxParallel, maxParallel); }
public async Task FindAnomally() { log.LogInformation("FindAnomally"); var data = new SentimentTestData("B00002EQCW"); var runner = new TestRunner(TestHelper.Instance, data); var sentences = await runner.Load() .ObserveOn(TaskPoolScheduler.Default) .Select(GetSentence) .Merge(); Assert.AreEqual(154, sentences.Length); }
public async Task SentimentTests(SentimentTestData data) { log.LogInformation("SentimentTests: {0}", data); string file; switch (data.Category) { case ProductCategory.Electronics: file = "Electronics.csv"; break; case ProductCategory.Video: file = "video.csv"; break; case ProductCategory.Kitchen: file = "kitchen.csv"; break; case ProductCategory.Medic: case ProductCategory.Games: case ProductCategory.Toys: case ProductCategory.Book: throw new NotImplementedException(); default: throw new ArgumentOutOfRangeException(); } ISentimentDataHolder holder = SentimentDataHolder.Load(Path.Combine(TestContext.CurrentContext.TestDirectory, "Sentiments", file)); var runner = new TestRunner(TestHelper.Instance, data); Analysis.Processing.ITestingClient testing = runner.Active.GetTesting(); runner.Active.Context.Lexicon = holder; testing.DisableAspects = true; testing.DisableSvm = true; testing.TrackArff = true; testing.Init(); await testing.Process(runner.Load()).LastOrDefaultAsync(); testing.Save(Path.Combine(TestContext.CurrentContext.TestDirectory, "Word2Vec")); Assert.AreEqual(data.Performance, testing.GetPerformanceDescription()); Assert.AreEqual(data.Errors, testing.Errors); }
public SentimentAspectData(SentimentTestData sentiment, TopItems attributes, TopItems features) { Sentiment = sentiment; Features = features; Attributes = attributes; }