Ejemplo n.º 1
0
        public RedisDocumentCache(ILogger <RedisDocumentCache> log, POSTaggerType tagger, IRedisLink manager, LocalDocumentsCache local, IJsonSerializer serializer)
        {
            this.tagger  = tagger;
            this.manager = manager ?? throw new ArgumentNullException(nameof(manager));
            this.local   = local ?? throw new ArgumentNullException(nameof(local));
            this.log     = log ?? throw new ArgumentNullException(nameof(log));

            manager.PersistencyRegistration.RegisterObjectHashSingle <LightDocument>(new JsonDataSerializer(serializer));
        }
Ejemplo n.º 2
0
        public RedisDocumentCache(ILogger <RedisDocumentCache> log, POSTaggerType tagger, IRedisLink manager, LocalDocumentsCache local)
        {
            this.tagger  = tagger;
            this.manager = manager ?? throw new ArgumentNullException(nameof(manager));
            this.local   = local ?? throw new ArgumentNullException(nameof(local));
            this.log     = log ?? throw new ArgumentNullException(nameof(log));

            if (!manager.HasDefinition <LightDocument>())
            {
                manager.RegisterNormalized <LightDocument>(new XmlDataSerializer()).IsSingleInstance = true;
            }
        }
Ejemplo n.º 3
0
        public MainContainerFactory Splitter(POSTaggerType value = POSTaggerType.SharpNLP, bool useNER = false)
        {
            initialized["Splitter"] = true;
            builder.RegisterModule(
                new SentimentMainModule
            {
                Tagger      = value,
                UseNER      = useNER,
                LocalConfig = true,
                Root        = rootPath
            });

            return(this);
        }
        public ActualWordsHandler(POSTaggerType type)
        {
            var factory = MainContainerFactory.Setup(new ServiceCollection())
                          .Config(configuration =>
            {
                var resources     = configuration.GetConfiguration("Resources");
                var resourcesPath = Path.Combine(TestContext.CurrentContext.TestDirectory, resources);
                configuration.SetConfiguration("Resources", resourcesPath);
            })
                          .Splitter(type)
                          .SetupNullCache();

            container = factory.Create();
            Container = container.StartSession();
            Loader    = new DocumentLoader(Container);
        }
        public ActualWordsHandler(POSTaggerType type)
        {
            var factory = MainContainerFactory.Setup(new ServiceCollection())
                          .Config()
                          .Splitter(type, true)
                          .AddNER(
                new DictionaryNERResolver(
                    new Dictionary <string, string>
            {
                { "XXX", "XXX" }
            }))
                          .SetupNullCache();

            container = factory.Create();
            Container = container.StartSession();
            Loader    = new DocumentLoader(Container);
        }
        public MainContainerFactory Splitter(POSTaggerType value = POSTaggerType.SharpNLP)
        {
            initialized["Splitter"] = true;
            switch (value)
            {
            case POSTaggerType.Simple:
                builder.AddTransient <ITextSplitter, SimpleTextSplitter>();
                break;

            case POSTaggerType.SharpNLP:
                builder.AddTransient <OpenNLPTextSplitter>();
                builder.AddTransient <Func <ITextSplitter> >(
                    ctx => () => new RecyclableTextSplitter(ctx.GetService <ILogger <RecyclableTextSplitter> >(), ctx.GetService <OpenNLPTextSplitter>, new RecyclableConfig()),
                    "underlying");
                break;

            default:
                throw new NotSupportedException(value.ToString());
            }

            return(this);
        }
Ejemplo n.º 7
0
 public ICachedDocumentsSource Create(POSTaggerType tagger)
 {
     return(new LocalDocumentsCache(log, cache));
 }
 public ICachedDocumentsSource Create(POSTaggerType tagger)
 {
     return(new RedisDocumentCache(factory.CreateLogger <RedisDocumentCache>(), tagger, redis, local));
 }
 public ICachedDocumentsSource Create(POSTaggerType tagger)
 {
     return(new NullCachedDocumentsSource());
 }