Ejemplo n.º 1
0
        public AnalyzerFactory(ResourceLoader resourceLoader)
        {
            _tokenizerFactory = new WhitespaceTokenizerFactory();
            _lowerCaseFactory = new LowerCaseFilterFactory();

            _synonymFactory = new SynonymFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("ignoreCase", "true");
                args.put("expand", "false");
                args.put("synonyms", "synonyms.txt");
                _synonymFactory.init(args);
                ((ResourceLoaderAware)_synonymFactory).inform(resourceLoader);
            }

            _commonGramsFactory = new CommonGramsFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("ignoreCase", "true");
                _commonGramsFactory.init(args);
                ((ResourceLoaderAware)_commonGramsFactory).inform(resourceLoader);
            }

            _commonGramsQueryFactory = new CommonGramsQueryFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("ignoreCase", "true");
                _commonGramsQueryFactory.init(args);
                ((ResourceLoaderAware)_commonGramsQueryFactory).inform(resourceLoader);
            }

            _wordDelimiterFactory = new WordDelimiterFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("catenateWords", "1");
                args.put("catenateNumbers", "1");
                args.put("protected", "protwords.txt");
                _wordDelimiterFactory.init(args);
                ((ResourceLoaderAware)_wordDelimiterFactory).inform(resourceLoader);
            }

            _stemmerFactory = new KStemFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("protected", "protwords.txt");
                _stemmerFactory.init(args);
                ((ResourceLoaderAware)_stemmerFactory).inform(resourceLoader);
            }

            _edgeNGramFactory = new EdgeNGramTokenFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("side", "FRONT");
                args.put("minGramSize", 2);
                _edgeNGramFactory.init(args);
                ((ResourceLoaderAware)_edgeNGramFactory).inform(resourceLoader);
            }
        }
Ejemplo n.º 2
0
        public static void ClassInitialize(TestContext context)
        {
            var resourceLoader = new ResourceLoaderImpl(@"Apps\Config");

            _tokenizerFactory = new WhitespaceTokenizerFactory();
            _lowerCaseFactory = new LowerCaseFilterFactory();

            _synonymFactory = new SynonymFilterFactory();
            var args = new HashMap();

            args.put("ignoreCase", "true");
            args.put("expand", "false");
            args.put("synonyms", "synonyms.txt");
            _synonymFactory.init(args);
            ((ResourceLoaderAware)_synonymFactory).inform(resourceLoader);

            _stopFactory = new StopFilterFactory();
            args         = new HashMap();
            args.put("ignoreCase", "true");
            args.put("enablePositionIncrements", "true");
            args.put("words", "stopwords.txt");
            _stopFactory.init(args);
            ((ResourceLoaderAware)_stopFactory).inform(resourceLoader);

            _wordDelimiterFactory = new WordDelimiterFilterFactory();
            args = new HashMap();
            args.put("catenateWords", "1");
            args.put("catenateNumbers", "1");
            args.put("protected", "protwords.txt");
            _wordDelimiterFactory.init(args);
            ((ResourceLoaderAware)_wordDelimiterFactory).inform(resourceLoader);

            _stemmerFactory = new KStemFilterFactory();
            args            = new HashMap();
            args.put("protected", "protwords.txt");
            _stemmerFactory.init(args);
            ((ResourceLoaderAware)_stemmerFactory).inform(resourceLoader);
        }
Ejemplo n.º 3
0
        public AnalyzerFactory(ResourceLoader resourceLoader)
        {
            _tokenizerFactory = new WhitespaceTokenizerFactory();
            _lowerCaseFactory = new LowerCaseFilterFactory();

            _synonymFactory = new SynonymFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("ignoreCase", "true");
                args.put("expand", "false");
                args.put("synonyms", "synonyms.txt");
                _synonymFactory.init(args);
                ((ResourceLoaderAware)_synonymFactory).inform(resourceLoader);
            }

            _titleNormaliserFactory = new SynonymFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("ignoreCase", "true");
                args.put("expand", "true");
                args.put("synonyms", "titles.txt");
                _titleNormaliserFactory.init(args);
                ((ResourceLoaderAware)_titleNormaliserFactory).inform(resourceLoader);
            }

            _titleNormaliserQueryFactory = new SynonymFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("ignoreCase", "true");
                args.put("expand", "false");
                args.put("synonyms", "titles.txt");
                _titleNormaliserQueryFactory.init(args);
                ((ResourceLoaderAware)_titleNormaliserQueryFactory).inform(resourceLoader);
            }

            _nicknameSynonymFactory = new SynonymFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("ignoreCase", "true");
                args.put("expand", "true");
                args.put("synonyms", "nicknames.txt");
                _nicknameSynonymFactory.init(args);
                ((ResourceLoaderAware)_nicknameSynonymFactory).inform(resourceLoader);
            }

            _stopFactory = new StopFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("ignoreCase", "true");
                args.put("enablePositionIncrements", "true");
                args.put("words", "stopwords.txt");
                _stopFactory.init(args);
                ((ResourceLoaderAware)_stopFactory).inform(resourceLoader);
            }

            _commonGramsFactory = new CommonGramsFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("ignoreCase", "true");
                _commonGramsFactory.init(args);
                ((ResourceLoaderAware)_commonGramsFactory).inform(resourceLoader);
            }

            _commonGramsQueryFactory = new CommonGramsQueryFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("ignoreCase", "true");
                _commonGramsQueryFactory.init(args);
                ((ResourceLoaderAware)_commonGramsQueryFactory).inform(resourceLoader);
            }

            _wordDelimiterFactory = new WordDelimiterFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("catenateWords", "1");
                args.put("catenateNumbers", "1");
                args.put("protected", "protwords.txt");
                _wordDelimiterFactory.init(args);
                ((ResourceLoaderAware)_wordDelimiterFactory).inform(resourceLoader);
            }

            _stemmerFactory = new KStemFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put("protected", "protwords.txt");
                _stemmerFactory.init(args);
                ((ResourceLoaderAware)_stemmerFactory).inform(resourceLoader);
            }

            _phoneticFactory = new PhoneticFilterFactory();
            {
                var args = new java.util.HashMap();
                args.put(PhoneticFilterFactory.ENCODER, "DoubleMetaphone");
                _phoneticFactory.init(args);
            }
        }