Exemplo n.º 1
0
 public UpdateDatabasesService(ConversationService conversationService, AnalyzationService analyzationService, ConversationUpdateService conversationUpdateService, UserService.UserService userService)
 {
     _conversationService       = conversationService;
     _analyzationService        = analyzationService;
     _covnersationUpdateService = conversationUpdateService;
     _userService = userService;
 }
 public UpdateDatabasesService()
 {
     conversationService       = new ConversationService();
     analyzationService        = new AnalyzationService();
     covnersationUpdateService = new ConversationUpdateService();
     userService = new UserService.UserService();
 }
Exemplo n.º 3
0
 public BotService()
 {
     conversationService       = new ConversationService();
     analyzationService        = new AnalyzationService();
     responseService           = new ResponseService();
     covnersationUpdateService = new ConversationUpdateService();
     userService            = new UserService.UserService();
     updateDatabasesService = new UpdateDatabasesService();
 }
Exemplo n.º 4
0
 public BotService(ConversationService conversationService, AnalyzationService analyzationService, ResponseService responseService, ReactionService reactionService, ConversationUpdateService conversationUpdateService, UserService.UserService userService, UpdateDatabasesService updateDatabasesService)
 {
     _conversationService       = conversationService;
     _analyzationService        = analyzationService;
     _responseService           = responseService;
     _reactionService           = reactionService;
     _covnersationUpdateService = conversationUpdateService;
     _userService            = userService;
     _updateDatabasesService = updateDatabasesService;
 }
Exemplo n.º 5
0
        public static void LoadDatabase(string directory, AnalyzationService analyzationService)
        {
            var conversationService = new ConversationLoadService(directory, analyzationService);

            var stopwatch = new Stopwatch();

            stopwatch.Start();

            conversationDatabase = new ConcurrentDictionary <string, ConversationList>(conversationService.LoadConversations());

            stopwatch.Stop();
            Debug.WriteLine("conversation database load time: " + stopwatch.Elapsed);
        }
Exemplo n.º 6
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(option => option.EnableEndpointRouting = false);

            var corsUrls = Configuration.GetSection("CORS").Get <List <string> >();

            services.AddCors(options =>
            {
                options.AddPolicy("AllowSpecificOrigin", builder => builder.WithOrigins(corsUrls.ToArray()).AllowAnyHeader().AllowAnyMethod());
            });

            services.AddSingleton <ChatRequestValidationService, ChatRequestValidationService>();
            services.AddSingleton <ConversationRequestValidationService, ConversationRequestValidationService>();
            services.AddSingleton <ResponseRequestValidationService, ResponseRequestValidationService>();
            services.AddSingleton <ReactionRequestValidationService, ReactionRequestValidationService>();

            var client = new HttpClient();
            var naturalLanguageApiUrl = Configuration.GetSection("NaturalLanguage:ApiUrl").Value;

            client.BaseAddress = new Uri(naturalLanguageApiUrl);
            var naturalLanguageApiService = new NaturalLanguageApiService(client);

            var redditStalkerHttpClient = new HttpClient();
            var redditStalkerApiUrl     = Configuration.GetSection("Stalker:Reddit").Value;

            redditStalkerHttpClient.BaseAddress = new Uri(redditStalkerApiUrl);

            var analyzationService    = new AnalyzationService(new ConversationSubjectService(new ResponseSubjectService()), new ResponseAnalyzationService(), new ConversationTypeService(), new UserlessMessageService(), new ConversationReadingLevelService(), new ResponseSubjectService(), naturalLanguageApiService);
            var userService           = new UserService.UserService(new UserService.UserNickNameService(), new UserService.UserPropertyService(new UserService.UserNaturalLanguageService(), new UserService.PropertyMatchService(), new UserService.PropertyFromQuestionService()), new UserService.OtherUserPropertyService(new UserService.UserNaturalLanguageService(), new UserService.PropertyMatchService()), new UserService.UserDerivedPropertyService(), new UserDatabase.Services.UserSaveService());
            var updateDatabaseService = new UpdateDatabasesService(new ConversationService(), analyzationService, new ConversationDatabase.Services.ConversationUpdateService(new ConversationDatabase.Services.ConversationSaveService()), userService);

            var matchService             = new ConversationMatcher.Services.MatchService(new ConversationMatcher.Services.SubjectConfidenceService(), new ConversationMatcher.Services.MatchConfidenceService(new SentenceScoreService(new OpenieScoreService(), new SubjectPredicateObjectScoreService(new SubjectPredicateObjectTokenScoreService()), new TokenScoreService(), new SentimentScoreService(), new SentenceTypeScoreService(), new VoiceScoreService())), new ConversationMatcher.Services.GroupChatConfidenceService(), new ConversationMatcher.Services.UniqueConfidenceService(), new ConversationMatcher.Services.ReadingLevelConfidenceService(), new ConversationSteerService.ConversationPathService(new ConversationSteerService.Services.EdgeService(), new ConversationSteerService.Services.VerticeService(), new ConversationSteerService.Services.ShortestPathService()));
            var conversationMatchService = new SharkbotReplier.Services.ConversationMatchService(new ConversationMatcher.Services.BestMatchService(matchService));
            var userPropertyMatchService = new SharkbotReplier.Services.UserPropertyMatchService(new UserService.UserPropertyRetrievalService(new UserService.PropertyValueService(), new UserService.UserSelfPropertyRetrievalService(new UserService.UserNaturalLanguageService(), new UserService.PropertyValueService()), new UserService.UserNaturalLanguageService()), new UserService.BotPropertyRetrievalService(new UserService.BotSelfPropertyRetrievalService(new UserService.PropertyValueService(), new UserService.UserNaturalLanguageService()), new UserService.UserNaturalLanguageService(), new UserService.PropertyValueService()));
            var queueService             = new QueueService(
                new BotService(new ConversationService(), analyzationService,
                               new SharkbotReplier.Services.ResponseService(conversationMatchService, userPropertyMatchService, new SharkbotReplier.Services.LyricsMatchService(), new GoogleMatchService.GoogleMatchService(new ScrapySharp.Network.ScrapingBrowser()), new SharkbotReplier.Services.UrbanDictionaryMatchService(), new SharkbotReplier.Services.SalutationService(), new SharkbotReplier.Services.ResponseConversionService(new UserService.UserPropertyService(new UserService.UserNaturalLanguageService(), new UserService.PropertyMatchService(), new UserService.PropertyFromQuestionService()), new UserService.PropertyValueService())),
                               new SharkbotReplier.Services.ReactionService(new SharkbotReplier.Services.ConversationReactionMatchService(new ConversationMatcher.Services.BestReactionMatchService(matchService))),
                               new ConversationDatabase.Services.ConversationUpdateService(new ConversationDatabase.Services.ConversationSaveService()), userService, updateDatabaseService), new ConversationService(), updateDatabaseService, new StalkerService(redditStalkerHttpClient));

            services.AddSingleton(queueService);

            ConfigurationService.AnalyzationVersion = Configuration.GetSection("NaturalLanguage:AnalyzationVersion").Value;

            UserDatabase.UserDatabase.userDirectory = Configuration.GetSection("UserDirectory").Value;
            UserDatabase.UserDatabase.LoadDatabase(UserDatabase.UserDatabase.userDirectory);

            ConversationDatabase.ConversationDatabase.conversationDirectory = Configuration.GetSection("ConversationDirectory").Value;
            ConversationDatabase.ConversationDatabase.LoadDatabase(ConversationDatabase.ConversationDatabase.conversationDirectory, analyzationService);
        }
Exemplo n.º 7
0
 public ConversationLoadService(string databaseDirectory, AnalyzationService analyzationService)
 {
     _databaseDirectory  = databaseDirectory;
     _analyzationService = analyzationService;
 }
 public ConversationLoadService(string databaseDirectory)
 {
     _databaseDirectory = databaseDirectory;
     analyzationService = new AnalyzationService();
 }