Sha256: becb28e972813741e1606e808fd81a064f30a3b354fe806e09364b545a5d068b

Contents?: true

Size: 715 Bytes

Versions: 32

Compression:

Stored size: 715 Bytes

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), '../../test_helper.rb')
require 'rbbt/bow/bow'
require 'test/unit'

class TestBow < Test::Unit::TestCase

  def test_words
    assert_equal(["hello", "world"], "Hello World".words)
  end
   
  def test_terms
    text = "Hello World"

    assert_equal(["hello", "world"], BagOfWords.terms(text,false).keys.sort)
    assert_equal(["hello", "hello world", "world"], BagOfWords.terms(text,true).keys.sort)
  end

  def test_features
    text = "Hello world!"
    text += "Hello World Again!"

    assert_equal([2, 2], BagOfWords.features(text, "Hello World".words.uniq.sort))
  end

  def test_stem
    assert_equal(["protein"], "Proteins".words)
  end
end


Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
rbbt-text-1.5.2 test/rbbt/bow/test_bow.rb
rbbt-text-1.5.1 test/rbbt/bow/test_bow.rb
rbbt-text-1.5.0 test/rbbt/bow/test_bow.rb
rbbt-text-1.4.0 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.11 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.10 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.9 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.8 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.7 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.6 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.5 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.4 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.3 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.2 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.1 test/rbbt/bow/test_bow.rb
rbbt-text-1.3.0 test/rbbt/bow/test_bow.rb
rbbt-text-1.2.0 test/rbbt/bow/test_bow.rb
rbbt-text-1.1.9 test/rbbt/bow/test_bow.rb
rbbt-text-1.1.8 test/rbbt/bow/test_bow.rb
rbbt-text-1.1.7 test/rbbt/bow/test_bow.rb