示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PtbSampleStream{T}" /> using a specified Penn Treebank stream.
        /// </summary>
        /// <param name="stream">The Penn Treebank stream.</param>
        /// <param name="detokenizer">The detokenizer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="detokenizer"/>
        /// or
        /// <paramref name="stream"/>
        /// </exception>
        public PtbTokenSampleStream(PtbStreamReader stream, IDetokenizer detokenizer) : base(stream)
        {
            if (detokenizer == null)
            {
                throw new ArgumentNullException(nameof(detokenizer));
            }

            this.detokenizer = detokenizer;
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PtbSampleStream{T}"/> class.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <exception cref="System.ArgumentNullException">stream</exception>
        protected PtbSampleStream(PtbStreamReader stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            Stream = stream;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PtbSampleStream{T}"/> class.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <param name="ownsStream"><c>true</c> to indicate that the stream will be disposed when this stream is disposed; <c>false</c> to indicate that the stream will not be disposed when this stream is disposed.</param>
        /// <exception cref="System.ArgumentNullException">stream</exception>
        protected PtbSampleStream(PtbStreamReader stream, bool ownsStream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            Stream = stream;

            this.ownsStream = ownsStream;
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PtbSentenceSampleStream" /> using a specified Penn Treebank stream.
        /// </summary>
        /// <param name="stream">The Penn Treebank stream.</param>
        /// <param name="detokenizer">The detokenizer.</param>
        /// <param name="sampleSize">The number of sentences in each sample.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="detokenizer" />
        /// or
        /// <paramref name="stream" /></exception>
        /// <exception cref="System.ArgumentOutOfRangeException">sampleSize</exception>
        public PtbSentenceSampleStream(PtbStreamReader stream, IDetokenizer detokenizer, int sampleSize) : base(stream)
        {
            if (detokenizer == null)
            {
                throw new ArgumentNullException("detokenizer");
            }

            if (sampleSize < 1)
            {
                throw new ArgumentOutOfRangeException("sampleSize");
            }

            this.detokenizer = detokenizer;
            this.sampleSize  = sampleSize;
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PtbSampleStream{T}"/> class.
 /// </summary>
 /// <param name="stream">The stream.</param>
 /// <exception cref="System.ArgumentNullException">stream</exception>
 protected PtbSampleStream(PtbStreamReader stream) : this(stream, true)
 {
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PtbPosSampleStream"/> class.
 /// </summary>
 /// <param name="stream">The stream.</param>
 /// <exception cref="System.ArgumentNullException">
 /// <paramref name="stream"/>
 /// </exception>
 public PtbPosSampleStream(PtbStreamReader stream) : base(stream)
 {
 }