Sha256: 3f17da98f181bf3a436ba5486281c7975dcb294da547bbbf7ca1e7eeb5975785

Contents?: true

Size: 410 Bytes

Versions: 3

Compression:

Stored size: 410 Bytes

Contents

module Lda
  class TextCorpus < Corpus
    attr_reader :filename

    # Load text documents from YAML file if filename is given.
    def initialize(filename)
      super()

      @filename = filename
      load_from_file
    end

    protected

    def load_from_file
      docs = YAML.load_file(@filename)
      docs.each do |doc|
        add_document(TextDocument.new(self, doc))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lda-ruby-0.3.8 lib/lda-ruby/corpus/text_corpus.rb
lda-ruby-0.3.7 lib/lda-ruby/corpus/text_corpus.rb
lda-ruby-0.3.6 lib/lda-ruby/corpus/text_corpus.rb