Sha256: ee4d69c626a6c2d6f262b726bdfc6662a2d4bedee82ac4dac354ac6819bee469

Contents?: true

Size: 409 Bytes

Versions: 5

Compression:

Stored size: 409 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

5 entries across 5 versions & 2 rubygems

Version Path
ealdent-lda-ruby-0.3.0 lib/lda-ruby/corpus/text_corpus.rb
ealdent-lda-ruby-0.3.1 lib/lda-ruby/corpus/text_corpus.rb
lda-ruby-0.3.5 lib/lda-ruby/corpus/text_corpus.rb
lda-ruby-0.3.4 lib/lda-ruby/corpus/text_corpus.rb
lda-ruby-0.3.1 lib/lda-ruby/corpus/text_corpus.rb