Esempio n. 1
0
        public SlowSynonymFilterFactory(IDictionary <string, string> args)
            : base(args)
        {
            synonyms   = Require(args, "synonyms");
            ignoreCase = GetBoolean(args, "ignoreCase", false);
            expand     = GetBoolean(args, "expand", true);

            tf = Get(args, "tokenizerFactory");
            if (tf != null)
            {
                AssureMatchVersion();
                tokArgs["luceneMatchVersion"] = LuceneMatchVersion.ToString();

                var keys = new List <string>(args.Keys);
                foreach (string key in keys)
                {
                    tokArgs[Regex.Replace(key, "^tokenizerFactory\\.", "")] = args[key];
                    args.Remove(key);
                }
            }
            if (args.Count > 0)
            {
                throw new System.ArgumentException("Unknown parameters: " + args);
            }
        }
Esempio n. 2
0
        public FSTSynonymFilterFactory(IDictionary <string, string> args)
            : base(args)
        {
            ignoreCase = GetBoolean(args, "ignoreCase", false);
            synonyms   = Require(args, "synonyms");
            format     = Get(args, "format");
            expand     = GetBoolean(args, "expand", true);

            tokenizerFactory = Get(args, "tokenizerFactory");
            if (tokenizerFactory != null)
            {
                AssureMatchVersion();
                tokArgs["luceneMatchVersion"] = LuceneMatchVersion.ToString();

                var keys = new List <string>(args.Keys);
                foreach (string key in keys)
                {
                    tokArgs[Holder.TOKENIZER_FACTORY_REPLACEMENT_PATTERN.Replace(key, "")] = args[key];
                    args.Remove(key);
                }
            }
            if (args.Count > 0)
            {
                throw new ArgumentException("Unknown parameters: " + args);
            }
        }
Esempio n. 3
0
        public SlowSynonymFilterFactory(IDictionary <string, string> args)
            : base(args)
        {
            synonyms   = Require(args, "synonyms");
            ignoreCase = GetBoolean(args, "ignoreCase", false);
            expand     = GetBoolean(args, "expand", true);

            tf = Get(args, "tokenizerFactory");
            if (tf != null)
            {
                AssureMatchVersion();
                tokArgs["luceneMatchVersion"] = LuceneMatchVersion.ToString();

                var keys = new JCG.List <string>(args.Keys);
                foreach (string key in keys)
                {
                    tokArgs[Holder.TOKENIZER_FACTORY_REPLACEMENT_PATTERN.Replace(key, "")] = args[key];
                    args.Remove(key);
                }
            }
            if (args.Count > 0)
            {
                throw new ArgumentException(string.Format(J2N.Text.StringFormatter.CurrentCulture, "Unknown parameters: {0}", args));
            }
        }
Esempio n. 4
0
        public FSTSynonymFilterFactory(IDictionary <string, string> args)
            : base(args)
        {
            ignoreCase = getBoolean(args, "ignoreCase", false);
            synonyms   = require(args, "synonyms");
            format     = get(args, "format");
            expand     = getBoolean(args, "expand", true);

            tokenizerFactory = get(args, "tokenizerFactory");
            if (tokenizerFactory != null)
            {
                assureMatchVersion();
                tokArgs["luceneMatchVersion"] = LuceneMatchVersion.ToString();
                for (var itr = args.Keys.GetEnumerator(); itr.MoveNext();)
                {
                    var key = itr.Current;
                    tokArgs[Regex.Replace(itr.Current, "^tokenizerFactory\\.", string.Empty)] = args[key];
                    itr.Remove();
                }
            }
            if (args.Count > 0)
            {
                throw new System.ArgumentException("Unknown parameters: " + args);
            }
        }
        public SlowSynonymFilterFactory(IDictionary <string, string> args) : base(args)
        {
            synonyms   = require(args, "synonyms");
            ignoreCase = getBoolean(args, "ignoreCase", false);
            expand     = getBoolean(args, "expand", true);

            tf = get(args, "tokenizerFactory");
            if (tf != null)
            {
                assureMatchVersion();
                tokArgs["luceneMatchVersion"] = LuceneMatchVersion.ToString();
                for (IEnumerator <string> itr = args.Keys.GetEnumerator(); itr.MoveNext();)
                {
                    string key = itr.Current;
                    tokArgs[key.replaceAll("^tokenizerFactory\\.", "")] = args[key];
                    itr.remove();
                }
            }
            if (args.Count > 0)
            {
                throw new System.ArgumentException("Unknown parameters: " + args);
            }
        }