Exemplo n.º 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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }