Beispiel #1
0
        public async Task Construct()
        {
            var loader        = new LexiconConfigLoader(ApplicationLogging.LoggerFactory.CreateLogger <LexiconConfigLoader>());
            var configuration = loader.Load();

            Assert.IsNotNull(configuration);

            var builder = new ServiceCollection();

            builder.RegisterModule <LoggingModule>();
            builder.RegisterModule <CommonModule>();
            builder.RegisterModule(new SentimentMainModule {
                LocalConfig = true
            });
            builder.RegisterModule(new SentimentServiceModule());
            var container = builder.BuildServiceProvider();

            for (int i = 0; i < 2; i++)
            {
                using var scope = container.CreateScope();
                var session = scope.ServiceProvider.GetService <ISessionContainer>();
                var client  = session.GetTesting();
                client.Init();

                var result = await client
                             .Process(new ParsingDocumentHolder(session.GetTextSplitter(),
                                                                session.GetWordFactory(),
                                                                session.Resolve <IContextSentenceRepairHandler>(),
                                                                new Document("I like beer")))
                             .ConfigureAwait(false);

                Assert.AreEqual(5, result.Adjustment.Rating.StarsRating);
            }
        }
Beispiel #2
0
        public void Setup()
        {
            var loader = new LexiconConfigLoader(ApplicationLogging.LoggerFactory.CreateLogger <LexiconConfigLoader>());
            var config = loader.Load(TestContext.CurrentContext.TestDirectory);
            var path   = config.GetFullPath(item => item.Model);
            var stream = new DictionaryStream(Path.Combine(path, "EmotionLookupTable.txt"), new FileStreamSource());
            var data   = stream.ReadDataFromStream(double.Parse).ToDictionary(item => item.Word, item => item.Value, StringComparer.OrdinalIgnoreCase);

            sentimentData = SentimentDataHolder.PopulateEmotionsData(data);
        }
Beispiel #3
0
        public void Setup()
        {
            var loader = new LexiconConfigLoader(ApplicationLogging.LoggerFactory.CreateLogger <LexiconConfigLoader>());

            path = loader.Load().Resources;
        }