Sha256: 04198dd6e89cce1d6c1a852e6b0669a19808ea27774590b78fdbbc51a99ea8b1

Contents?: true

Size: 398 Bytes

Versions: 9

Compression:

Stored size: 398 Bytes

Contents

module Lda
  class DataCorpus < Corpus
    attr_reader :filename

    def initialize(filename)
      super()

      @filename = filename
      load_from_file
    end

    protected

    def load_from_file
      txt = File.open(@filename, 'r') { |f| f.read }
      lines = txt.split(/[\r\n]+/)
      lines.each do |line|
        add_document(DataDocument.new(self, line))
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
lda-ruby-0.3.9 lib/lda-ruby/corpus/data_corpus.rb
ealdent-lda-ruby-0.3.0 lib/lda-ruby/corpus/data_corpus.rb
ealdent-lda-ruby-0.3.1 lib/lda-ruby/corpus/data_corpus.rb
lda-ruby-0.3.8 lib/lda-ruby/corpus/data_corpus.rb
lda-ruby-0.3.7 lib/lda-ruby/corpus/data_corpus.rb
lda-ruby-0.3.6 lib/lda-ruby/corpus/data_corpus.rb
lda-ruby-0.3.5 lib/lda-ruby/corpus/data_corpus.rb
lda-ruby-0.3.4 lib/lda-ruby/corpus/data_corpus.rb
lda-ruby-0.3.1 lib/lda-ruby/corpus/data_corpus.rb