Sha256: d3997dc3d1ab4d2731f1cfb4851e6e2dc5f945be4543cdc2bbc282ccc7cc166b

Contents?: true

Size: 613 Bytes

Versions: 8

Compression:

Stored size: 613 Bytes

Contents

# DEPRECATED!!!!

require 'facet/string/to_arr'
require 'facet/enumerable/probability'

class String

  def probability(*args)
    to_arr(*args).probability
  end

end


#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCString < Test::Unit::TestCase

    def test_probability
      assert_equal( {'a'=>0.5,'b'=>0.5}, "ab".probability )
      assert_equal( {'tom'=>0.5,'boy'=>0.5}, "tom boy".probability(:word) )
      assert_equal( {'tom'=>0.5,'boy'=>0.5}, "tom\nboy".probability(:line) )
    end

  end

=end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
facets-1.4.2 forge/core/string/probability.rb
facets-1.4.3 forge/core/string/probability.rb
facets-1.4.4 forge/core/string/probability.rb
facets-1.4.5 snip/core/string/probability.rb
facets-1.8.0 work/core/string/probability.rb
facets-1.8.20 work/core/string/probability.rb
facets-1.8.49 work/core/string/probability.rb
facets-1.8.8 work/core/string/probability.rb