Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AdTokenSampleStream" /> from a <paramref name="lineStream" /> object.
        /// </summary>
        /// <param name="lineStream">The line stream.</param>
        /// <param name="detokenizer">The detokenizer used create the samples.</param>
        /// <param name="splitHyphenatedTokens">if set to <c>true</c> hyphenated tokens will be separated: "carros-monstro" &gt; "carros" Hyphen "monstro".</param>
        /// <param name="safeParse">if set to <c>true</c> the invalid data in the file will be skipped.</param>
        /// <exception cref="System.ArgumentNullException">lineStream</exception>
        public AdTokenSampleStream(IObjectStream <string> lineStream, IDetokenizer detokenizer, bool splitHyphenatedTokens, bool safeParse)
        {
            if (lineStream == null)
            {
                throw new ArgumentNullException("lineStream");
            }

            if (detokenizer == null)
            {
                throw new ArgumentNullException("detokenizer");
            }

            adSentenceStream           = new AdSentenceStream(lineStream, safeParse);
            this.detokenizer           = detokenizer;
            this.splitHyphenatedTokens = splitHyphenatedTokens;
        }