Sha256: 025abd68ae3aba75223fce2fd469d8ce47a2985ef69002584d7462512502894a

Contents?: true

Size: 711 Bytes

Versions: 6

Compression:

Stored size: 711 Bytes

Contents

require 'lib/semantic'

namespace :example do

  documents = ["The cat in the hat disabled", "A cat is a fine pet ponies.", "Dogs and cats make good pets.","I haven't got a hat."]

  desc "run main LSA example"
  task :lsa do
    search = Semantic::Search.new(documents, :verbose => true)
  end

  desc "run main Vector space example"
  task :vector_space do
    search = Semantic::Search.new(documents)

    puts "Documents:"
    documents.each_with_index { |document, index| puts "#{index}: #{document}"  }
    puts

    puts "Documents related to first document: #{documents[0]}"
    puts search.related(0)
    puts

    puts "Searching for the word cat:"
    puts search.search(["cat"])
    puts
  end

end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
josephwilk-rsemantic-0.1.0 gem_tasks/examples.rake
josephwilk-rsemantic-0.1.1 gem_tasks/examples.rake
josephwilk-rsemantic-0.1.2 gem_tasks/examples.rake
josephwilk-rsemantic-0.1.3 gem_tasks/examples.rake
josephwilk-semantic-0.1.0 gem_tasks/examples.rake
rsemantic-0.1.3 gem_tasks/examples.rake