public void testInitialState () { Iterator iter = transducer.initialStateIterator (); int count = 0; FeatureTransducer.State state; while (iter.hasNext ()) { count++; state = (FeatureTransducer.State) iter.next(); assertTrue (state.getName().equals ("0")); } assertTrue (count == 1); }
public void testInitialState () { Iterator iter = transducer.initialStateIterator (); int count = 0; FeatureTransducer.State state; while (iter.hasNext ()) { count++; state = (FeatureTransducer.State) iter.next(); assertTrue (state.getName().equals ("0")); } assertTrue (count == 1); }
public void testViterbi () { double weight = new MaxLatticeDefault (transducer, seq).bestWeight(); System.out.println ("weight = "+weight); assertTrue (weight == seqWeight); }
public void testViterbi () { double weight = new MaxLatticeDefault (transducer, seq).bestWeight(); System.out.println ("weight = "+weight); assertTrue (weight == seqWeight); }
public void testForwardBackward () { SumLatticeDefault lattice = new SumLatticeDefault (transducer, seq); System.out.println ("weight= "+lattice.getTotalWeight()); assertTrue (lattice.getTotalWeight() == seqWeight); }
public void testForwardBackward () { SumLatticeDefault lattice = new SumLatticeDefault (transducer, seq); System.out.println ("weight= "+lattice.getTotalWeight()); assertTrue (lattice.getTotalWeight() == seqWeight); }
public void testIncrement () { transducer.setTrainable (true); SumLatticeDefault lattice = new SumLatticeDefault (transducer, seq); // used to have third argument: true double oldWeight = lattice.getTotalWeight (); System.out.println ("State 0 transition estimator"); Multinomial.Estimator est = ((FeatureTransducer.State)transducer.getState(0)).getTransitionEstimator(); est.print(); assertTrue (est.getCount(0) == 2.0); assertTrue (est.getCount(1) == 1.0); }
public void testIncrement () { transducer.setTrainable (true); SumLatticeDefault lattice = new SumLatticeDefault (transducer, seq); // used to have third argument: true double oldWeight = lattice.getTotalWeight (); System.out.println ("State 0 transition estimator"); Multinomial.Estimator est = ((FeatureTransducer.State)transducer.getState(0)).getTransitionEstimator(); est.print(); assertTrue (est.getCount(0) == 2.0); assertTrue (est.getCount(1) == 1.0); }
public void testEstimate () { transducer.setTrainable (true); SumLatticeDefault lattice = new SumLatticeDefault (transducer, seq); // used to have third argument: true double oldWeight = lattice.getTotalWeight (); transducer.estimate (); lattice = new SumLatticeDefault (transducer, seq); // used to have third argument: false double newWeight = lattice.getTotalWeight (); System.out.println ("oldWeight="+oldWeight+" newWeight="+newWeight); assertTrue (newWeight < oldWeight); }
public void testEstimate () { transducer.setTrainable (true); SumLatticeDefault lattice = new SumLatticeDefault (transducer, seq); // used to have third argument: true double oldWeight = lattice.getTotalWeight (); transducer.estimate (); lattice = new SumLatticeDefault (transducer, seq); // used to have third argument: false double newWeight = lattice.getTotalWeight (); System.out.println ("oldWeight="+oldWeight+" newWeight="+newWeight); assertTrue (newWeight < oldWeight); }