Ejemplo n.º 1
0
        private TrainerScore[][] prepareScore()
        {
            ArrayList arrayList = new ArrayList();
            int       num       = this.graph.size();

            TrainerScore[] array = new TrainerScore[num];
            this.betas            = new float[num];
            this.outputProbs      = new float[num];
            this.probCurrentFrame = new float[num];
            Node initialNode = this.graph.getInitialNode();
            int  num2        = this.graph.indexOf(initialNode);

            for (int i = 0; i < num; i++)
            {
                this.probCurrentFrame[i] = float.MinValue;
            }
            this.probCurrentFrame[num2] = 0f;
            initialNode.startOutgoingEdgeIterator();
            while (initialNode.hasMoreOutgoingEdges())
            {
                Edge edge        = initialNode.nextOutgoingEdge();
                Node destination = edge.getDestination();
                int  num3        = this.graph.indexOf(destination);
                if (!destination.isType("STATE"))
                {
                    this.probCurrentFrame[num3] = 0f;
                }
                else
                {
                    HMMState hmmstate = (HMMState)destination.getObject();
                    if (!hmmstate.isEmitting())
                    {
                        this.probCurrentFrame[num3] = 0f;
                    }
                    if (!BaumWelchLearner.assertionsDisabled)
                    {
                        throw new AssertionError();
                    }
                }
            }
            this.lastFeatureIndex = 0;
            while (this.getFeature())
            {
                this.forwardPass(array);
                arrayList.add(array);
                this.lastFeatureIndex++;
            }
            BaumWelchLearner.logger.info(new StringBuilder().append("Feature frames read: ").append(this.lastFeatureIndex).toString());
            for (int i = 0; i < this.probCurrentFrame.Length; i++)
            {
                this.probCurrentFrame[i] = float.MinValue;
            }
            Node finalNode = this.graph.getFinalNode();
            int  num4      = this.graph.indexOf(finalNode);

            this.probCurrentFrame[num4] = 0f;
            finalNode.startIncomingEdgeIterator();
            while (finalNode.hasMoreIncomingEdges())
            {
                Edge edge2  = finalNode.nextIncomingEdge();
                Node source = edge2.getSource();
                int  num5   = this.graph.indexOf(source);
                if (!source.isType("STATE"))
                {
                    this.probCurrentFrame[num5] = 0f;
                    if (!BaumWelchLearner.assertionsDisabled)
                    {
                        throw new AssertionError();
                    }
                }
                else
                {
                    HMMState hmmstate2 = (HMMState)source.getObject();
                    if (!hmmstate2.isEmitting())
                    {
                        this.probCurrentFrame[num5] = 0f;
                    }
                }
            }
            return((TrainerScore[][])arrayList.toArray(new TrainerScore[arrayList.size()][]));
        }