Ejemplo n.º 1
0
        public static IntegerExtractor GetInstance(string placeholder = NumbersDefinitions.PlaceHolderDefault)
        {
            if (!Instances.ContainsKey(placeholder))
            {
                var instance = new IntegerExtractor(placeholder);
                Instances.TryAdd(placeholder, instance);
            }

            return(Instances[placeholder]);
        }
Ejemplo n.º 2
0
        } = Constants.SYS_NUM_INTEGER;                                                     // "Integer";

        public static IntegerExtractor GetInstance(BaseNumberOptionsConfiguration config)
        {
            var extractorKey = config.Placeholder;

            if (!Instances.ContainsKey(extractorKey))
            {
                var instance = new IntegerExtractor(config);
                Instances.TryAdd(extractorKey, instance);
            }

            return(Instances[extractorKey]);
        }
Ejemplo n.º 3
0
        } = Constants.SYS_NUM_CARDINAL;                                                     //"Cardinal";

        public CardinalExtractor(string placeholder = @"\D|\b")
        {
            var builder = ImmutableDictionary.CreateBuilder <Regex, string>();

            //Add Integer Regexes
            var intExtract = new IntegerExtractor(placeholder);

            builder.AddRange(intExtract.Regexes);

            //Add Double Regexes
            var douExtract = new DoubleExtractor(placeholder);

            builder.AddRange(douExtract.Regexes);

            Regexes = builder.ToImmutable();
        }
Ejemplo n.º 4
0
        private CardinalExtractor(string placeholder = NumbersDefinitions.PlaceHolderDefault)
        {
            var builder = ImmutableDictionary.CreateBuilder <Regex, TypeTag>();

            // Add Integer Regexes
            var intExtract = IntegerExtractor.GetInstance(placeholder);

            builder.AddRange(intExtract.Regexes);

            // Add Double Regexes
            var douExtract = DoubleExtractor.GetInstance(placeholder);

            builder.AddRange(douExtract.Regexes);

            Regexes = builder.ToImmutable();
        }
        private CardinalExtractor(BaseNumberOptionsConfiguration config)
            : base(config.Options)
        {
            keyPrefix = string.Intern(ExtractType + "_" + config.Options + "_" + config.Placeholder + "_" + config.Culture);

            var builder = ImmutableDictionary.CreateBuilder <Regex, TypeTag>();

            // Add Integer Regexes
            var intExtract = IntegerExtractor.GetInstance(config);

            builder.AddRange(intExtract.Regexes);

            // Add Double Regexes
            var douExtract = DoubleExtractor.GetInstance(config);

            builder.AddRange(douExtract.Regexes);

            Regexes = builder.ToImmutable();
        }