Sha256: 72148cb5e3754a8bbb2ff5dd0b9bd0f9e53795b9c82ea961bf5518d9cbfc1f18
Contents?: true
Size: 594 Bytes
Versions: 1
Compression:
Stored size: 594 Bytes
Contents
require 'nano/string/to_arr' require 'nano/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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-0.9.0 | lib/nano/string/probability.rb |