Exemplo n.º 1
0
 public static IExtractor Create(ExtractorSettings settings,
                                 ILoggerFactory loggerFactory        = null,
                                 IEnumerable <IExtension> extensions = null,
                                 IMorphAnalizer morph = null)
 {
     return(new ExtractorFactory(settings,
                                 loggerFactory,
                                 extensions,
                                 morph).CreateExtractor());
 }
Exemplo n.º 2
0
 public ExtractorFactory(ExtractorSettings settings,
                         ILoggerFactory loggerFactory        = null,
                         IEnumerable <IExtension> extensions = null,
                         IMorphAnalizer morph = null)
 {
     _settings      = settings;
     _loggerFactory = loggerFactory;
     _extensions    = extensions;
     _morph         = morph ?? new RuMorphAnalizer();
 }
Exemplo n.º 3
0
 public Extractor(ITokenizer tokenizer,
                  IMorphAnalizer morphAnalizer,
                  IChartParser parser,
                  ExtractorSettings settings,
                  ILogger <IExtractor> logger)
 {
     _tokenizer     = tokenizer;
     _morphAnalizer = morphAnalizer;
     _parser        = parser;
     _settings      = settings;
     _logger        = logger;
 }
Exemplo n.º 4
0
        public static IExtractor Create(string rules,
                                        ExtractorSettings settings,
                                        ILoggerFactory loggerFactory        = null,
                                        IMorphAnalizer morph                = null,
                                        IEnumerable <IExtension> extensions = null)
        {
            var grammar = _createMainGrammar(rules, settings.Language);

            settings.MainGrammar = grammar;
            return(Create(settings,
                          loggerFactory,
                          extensions,
                          morph));
        }
Exemplo n.º 5
0
        public static void Check(string text,
                                 string rules,
                                 IEnumerable <ExtractionDic> etalon,
                                 ExtractorSettings settings          = null,
                                 IEnumerable <IExtension> extensions = null,
                                 IMorphAnalizer morph = null,
                                 params string[] rulesToExtract)
        {
            if (settings == null)
            {
                settings = new ExtractorSettings();
            }

            var extractor = ExtractorFactory.Create(rules,
                                                    settings,
                                                    extensions: extensions,
                                                    morph: morph);
            var result = extractor.Parse(text, rulesToExtract);

            _check(etalon.ToArray(), result.ToArray());
        }
Exemplo n.º 6
0
 public GrammarCompiler(ITokenizer tokenizer, IMorphAnalizer morph, IEnumerable <IExtension> extensions)
 {
     _condMan            = new ConditionManager();
     _valMan             = new ValidationManager();
     _variablesProcessor = new VariablesProcessor(tokenizer, morph, extensions);
 }
Exemplo n.º 7
0
 public VariablesProcessor(ITokenizer tokenizer, IMorphAnalizer morph, IEnumerable <IExtension> extensions)
 {
     _morph      = morph;
     _tokenizer  = tokenizer;
     _extensions = extensions?.ToDictionary(x => x.Name, x => x);
 }