コード例 #1
0
        public new virtual MixtureComponent clone()
        {
            MixtureComponent mixtureComponent = (MixtureComponent)base.clone();

            mixtureComponent.distFloor     = this.distFloor;
            mixtureComponent.varianceFloor = this.varianceFloor;
            mixtureComponent.logPreComputedGaussianFactor = this.logPreComputedGaussianFactor;
            mixtureComponent.mean = ((this.mean == null) ? null : ((float[])this.mean.Clone()));
            if (this.meanTransformationMatrix != null)
            {
                mixtureComponent.meanTransformationMatrix = (float[][])this.meanTransformationMatrix.Clone();
                for (int i = 0; i < this.meanTransformationMatrix.Length; i++)
                {
                    mixtureComponent.meanTransformationMatrix[i] = (float[])this.meanTransformationMatrix[i].Clone();
                }
            }
            mixtureComponent.meanTransformationVector = ((this.meanTransformationVector == null) ? null : ((float[])this.meanTransformationVector.Clone()));
            mixtureComponent.meanTransformed          = ((this.meanTransformed == null) ? null : ((float[])this.meanTransformed.Clone()));
            mixtureComponent.variance = ((this.variance == null) ? null : ((float[])this.variance.Clone()));
            if (this.varianceTransformationMatrix != null)
            {
                mixtureComponent.varianceTransformationMatrix = (float[][])this.varianceTransformationMatrix.Clone();
                for (int i = 0; i < this.varianceTransformationMatrix.Length; i++)
                {
                    mixtureComponent.varianceTransformationMatrix[i] = (float[])this.varianceTransformationMatrix[i].Clone();
                }
            }
            mixtureComponent.varianceTransformationVector = ((this.varianceTransformationVector == null) ? null : ((float[])this.varianceTransformationVector.Clone()));
            mixtureComponent.precisionTransformed         = ((this.precisionTransformed == null) ? null : ((float[])this.precisionTransformed.Clone()));
            return(mixtureComponent);
        }
コード例 #2
0
        protected internal virtual Pool createSenonePool(float distFloor, float varianceFloor)
        {
            Pool pool        = new Pool("senones");
            int  num         = this.meansPool.size();
            int  num2        = this.variancePool.size();
            int  gauPerState = this.mixtureWeights.getGauPerState();
            int  statesNum   = this.mixtureWeights.getStatesNum();
            int  streamsNum  = this.mixtureWeights.getStreamsNum();
            int  num3        = 0;

            this.logger.fine(new StringBuilder().append("Senones ").append(statesNum).toString());
            this.logger.fine(new StringBuilder().append("Gaussians Per Senone ").append(gauPerState).toString());
            this.logger.fine(new StringBuilder().append("Means ").append(num).toString());
            this.logger.fine(new StringBuilder().append("Variances ").append(num2).toString());
            if (!Sphinx3Loader.assertionsDisabled && gauPerState <= 0)
            {
                throw new AssertionError();
            }
            if (!Sphinx3Loader.assertionsDisabled && num2 != statesNum * gauPerState)
            {
                throw new AssertionError();
            }
            if (!Sphinx3Loader.assertionsDisabled && num != statesNum * gauPerState)
            {
                throw new AssertionError();
            }
            float[][] meanTransformationMatrix     = (this.meanTransformationMatrixPool != null) ? ((float[][])this.meanTransformationMatrixPool.get(0)) : ((float[][])null);
            float[]   meanTransformationVector     = (this.meanTransformationVectorPool != null) ? ((float[])this.meanTransformationVectorPool.get(0)) : null;
            float[][] varianceTransformationMatrix = (this.varianceTransformationMatrixPool != null) ? ((float[][])this.varianceTransformationMatrixPool.get(0)) : ((float[][])null);
            float[]   varianceTransformationVector = (this.varianceTransformationVectorPool != null) ? ((float[])this.varianceTransformationVectorPool.get(0)) : null;
            for (int i = 0; i < statesNum; i++)
            {
                MixtureComponent[] array = new MixtureComponent[gauPerState * streamsNum];
                for (int j = 0; j < gauPerState; j++)
                {
                    MixtureComponent[] array2 = array;
                    int num4 = j;
                    array2[num4] = new MixtureComponent((float[])this.meansPool.get(num3), meanTransformationMatrix, meanTransformationVector, (float[])this.variancePool.get(num3), varianceTransformationMatrix, varianceTransformationVector, distFloor, varianceFloor);
                    num3++;
                }
                GaussianMixture o = new GaussianMixture(this.mixtureWeights, array, i);
                pool.put(i, o);
            }
            return(pool);
        }
コード例 #3
0
        private Pool createSenonePool(float num, float num2)
        {
            Pool pool        = new Pool("senones");
            int  num3        = this.meansPool.size();
            int  num4        = this.variancePool.size();
            int  gauPerState = this.mixtureWeights.getGauPerState();
            int  statesNum   = this.mixtureWeights.getStatesNum();
            int  num5        = 0;

            this.logger.fine(new StringBuilder().append("NG ").append(gauPerState).toString());
            this.logger.fine(new StringBuilder().append("NS ").append(statesNum).toString());
            this.logger.fine(new StringBuilder().append("NMNS ").append(num3).toString());
            this.logger.fine(new StringBuilder().append("NMNS ").append(num4).toString());
            if (!HTKLoader.assertionsDisabled && gauPerState <= 0)
            {
                throw new AssertionError();
            }
            if (!HTKLoader.assertionsDisabled && num4 != statesNum * gauPerState)
            {
                throw new AssertionError();
            }
            if (!HTKLoader.assertionsDisabled && num3 != statesNum * gauPerState)
            {
                throw new AssertionError();
            }
            float[][] meanTransformationMatrix     = (this.meanTransformationMatrixPool != null) ? ((float[][])this.meanTransformationMatrixPool.get(0)) : ((float[][])null);
            float[]   meanTransformationVector     = (this.meanTransformationVectorPool != null) ? ((float[])this.meanTransformationVectorPool.get(0)) : null;
            float[][] varianceTransformationMatrix = (this.varianceTransformationMatrixPool != null) ? ((float[][])this.varianceTransformationMatrixPool.get(0)) : ((float[][])null);
            float[]   varianceTransformationVector = (this.varianceTransformationVectorPool != null) ? ((float[])this.varianceTransformationVectorPool.get(0)) : null;
            for (int i = 0; i < statesNum; i++)
            {
                MixtureComponent[] array = new MixtureComponent[gauPerState];
                for (int j = 0; j < gauPerState; j++)
                {
                    MixtureComponent[] array2 = array;
                    int num6 = j;
                    array2[num6] = new MixtureComponent((float[])this.meansPool.get(num5), meanTransformationMatrix, meanTransformationVector, (float[])this.variancePool.get(num5), varianceTransformationMatrix, varianceTransformationVector, num, num2);
                    num5++;
                }
                GaussianMixture o = new GaussianMixture(this.mixtureWeights, array, i);
                pool.put(i, o);
            }
            return(pool);
        }