hmm 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/hmm.gemspec +1 -1
  3. data/test/test_hmm.rb +24 -3
  4. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hmm}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Tresner-Kirsch"]
@@ -1,7 +1,28 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestHmm < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- #flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
4
+ should "create new classifier" do
5
+ model = HMM::Classifier.new
6
+ assert model.class == HMM::Classifier
7
+ end
8
+
9
+ should "decode using hand-built model" do
10
+ model = HMM::Classifier.new
11
+
12
+ # manually build a classifier
13
+ model.o_lex = ["A", "B"]
14
+ model.q_lex = ["X", "Y", "Z"]
15
+ model.a = NArray[[0.8, 0.1, 0.1],
16
+ [0.2, 0.5, 0.3],
17
+ [0.9, 0.1, 0.0]].transpose(1,0)
18
+ model.b = NArray[ [0.2, 0.8],
19
+ [0.7, 0.3],
20
+ [0.9, 0.1]].transpose(1,0)
21
+ model.pi = NArray[0.5, 0.3, 0.2]
22
+
23
+ # apply classifier to a sample observation string
24
+ q_star = model.decode(["A","B","A"])
25
+ assert q_star == ["Z", "X", "X"]
26
+ end
27
+
7
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hmm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Tresner-Kirsch