Esempio n. 1
0
        private static IStemmer GetStemmer(StemmerSetting stemmerSetting)
        {
            if (stemmerSetting.CustomStemmer != null)
            {
                return(stemmerSetting.CustomStemmer);
            }

            return(stemmerSetting.UseDefaultPorterStemmer ? new PorterStemmer() : null);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets IndexerConfiguration from settings
        /// </summary>
        /// <param name="splitterSetting">Splitter Setting. Cannot be null.</param>
        /// <param name="dictionarySetting">Cannot be null.</param>
        /// <param name="textExtractorSetting">Cannot be null.</param>
        /// <param name="textCorrectorSetting">Cannot be null.</param>
        /// <param name="stemmerSetting">Cannot be null.</param>
        /// <param name="filesToScan">Cannot be null.</param>
        /// <param name="notificationHandler">Notification updater</param>
        /// <returns></returns>
        public static IndexerConfiguration GetIndexerConfiguration(SplitterSetting splitterSetting, DictionarySetting dictionarySetting,
                                                                   TextExtractorSetting textExtractorSetting, TextCorrectorSetting textCorrectorSetting, StemmerSetting stemmerSetting,
                                                                   List <IndexerFile> filesToScan, INotificationHandler notificationHandler = null)
        {
            if (splitterSetting == null)
            {
                throw new ArgumentNullException(nameof(splitterSetting));
            }

            if (dictionarySetting == null)
            {
                throw new ArgumentNullException(nameof(dictionarySetting));
            }

            if (textExtractorSetting == null)
            {
                throw new ArgumentNullException(nameof(textExtractorSetting));
            }

            if (textCorrectorSetting == null)
            {
                throw new ArgumentNullException(nameof(textCorrectorSetting));
            }

            if (stemmerSetting == null)
            {
                throw new ArgumentNullException(nameof(stemmerSetting));
            }

            if (filesToScan == null)
            {
                throw new ArgumentNullException(nameof(filesToScan));
            }

            IndexerConfiguration indexerConfiguration = new IndexerConfiguration(GetSplitter(splitterSetting), GetSplitType(textExtractorSetting),
                                                                                 GetDictionary(dictionarySetting), GetTextExtractors(textExtractorSetting), GetTextCorrector(textCorrectorSetting),
                                                                                 GetStemmer(stemmerSetting), filesToScan, notificationHandler);

            return(indexerConfiguration);
        }