Class: Lda::DirectoryCorpus

Inherits:
Corpus
  • Object
show all
Defined in:
lib/lda-ruby/corpus/directory_corpus.rb

Instance Attribute Summary collapse

Attributes inherited from Corpus

#documents, #num_docs, #num_terms, #stopwords, #vocabulary

Instance Method Summary collapse

Methods inherited from Corpus

#add_document, #remove_word

Constructor Details

#initialize(path, extension = nil) ⇒ DirectoryCorpus

load documents from a directory



6
7
8
9
10
11
12
13
# File 'lib/lda-ruby/corpus/directory_corpus.rb', line 6

def initialize(path, extension = nil)
  super()

  @path = path.dup.freeze
  @extension = extension ? extension.dup.freeze : nil

  load_from_directory
end

Instance Attribute Details

#extensionObject (readonly)

Returns the value of attribute extension.



3
4
5
# File 'lib/lda-ruby/corpus/directory_corpus.rb', line 3

def extension
  @extension
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/lda-ruby/corpus/directory_corpus.rb', line 3

def path
  @path
end