example/benchmark.rb
# Perform a benchmark of calculating the whole similarity matrix for a
# corpus of N documents. This isn't a great benchmark since
# Faker::Lorem generates random text from a fixed set of words
# (therefore the total number of terms in the corpus is small), but
# it's a start.
Perform a benchmark of calculating the whole similarity matrix for a
corpus of N documents. This isn't a great benchmark since
Faker::Lorem generates random text from a fixed set of words
(therefore the total number of terms in the corpus is small), but
it's a start.
Perform a benchmark of calculating the whole similarity matrix for a corpus of N documents . This isn ' t a great benchmark since Faker :: Lorem generates random text from a fixed set of words ( therefore the total number of terms in the corpus is small ) but it ' s a start .
def calculate_similarites(number_of_documents)
  corpus = Corpus.new
  number_of_documents.times do
    document = Document.new(:content => Faker::Lorem.paragraphs.join(' '))
    corpus << document
  end
  corpus.similarity_matrix
end
def calculate_similarites ( number_of_documents ) corpus = Corpus . new number_of_documents . times do document = Document . new ( :content => Faker :: Lorem . paragraphs . join ( ' ' ) ) corpus << document end corpus . similarity_matrix end
Perform a benchmark of calculating the whole similarity matrix for a
corpus of N documents.
Perform a benchmark of calculating the whole similarity matrix for a corpus of N documents .
number_of_documents
<not_specific>