コード例 #1
0
 public WordsTokenizerFactory(
     string pattern,
     IWordItemFactory wordItemFactory,
     CombinedPipeline <string> pipeline,
     CombinedPipeline <WordEx> wordItemPipeline)
 {
     splitter             = new RegexSplitter(pattern);
     Pipeline             = pipeline ?? throw new System.ArgumentNullException(nameof(pipeline));
     this.wordItemFactory = wordItemFactory ?? throw new System.ArgumentNullException(nameof(wordItemFactory));
     WordItemPipeline     = wordItemPipeline ?? throw new System.ArgumentNullException(nameof(wordItemPipeline));
 }
コード例 #2
0
        public WordTokenizer(
            string sentence,
            IWordItemFactory wordItemFactory,
            IPipeline <string> pipeline,
            IPipeline <WordEx> wordItemPipeline,
            string[] words)
        {
            this.pipeline         = pipeline ?? throw new System.ArgumentNullException(nameof(pipeline));
            this.wordItemFactory  = wordItemFactory ?? throw new System.ArgumentNullException(nameof(wordItemFactory));
            this.wordItemPipeline = wordItemPipeline ?? throw new System.ArgumentNullException(nameof(wordItemPipeline));
            this.words            = words ?? throw new System.ArgumentNullException(nameof(words));
            if (this.words.Length == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(words));
            }

            SentenceText = sentence;
        }