private Pool <ISenone> CreateTiedSenonePool(float distFloor, float varianceFloor) { var pool = new Pool <ISenone>("senones"); var numMeans = MeansPool.Size; var numVariances = VariancePool.Size; var numGaussiansPerState = MixtureWeightsPool.GauPerState; var numSenones = MixtureWeightsPool.StatesNum; var numStreams = MixtureWeightsPool.StreamsNum; this.LogInfo("Senones " + numSenones); this.LogInfo("Gaussians Per State " + numGaussiansPerState); this.LogInfo("Means " + numMeans); this.LogInfo("Variances " + numVariances); Debug.Assert(numGaussiansPerState > 0); Debug.Assert(numVariances == _numBase * numGaussiansPerState * numStreams); Debug.Assert(numMeans == _numBase * numGaussiansPerState * numStreams); var meansTransformationMatrix = MeansTransformationMatrixPool == null ? null : MeansTransformationMatrixPool.Get(0); var meansTransformationVector = MeansTransformationVectorPool == null ? null : MeansTransformationVectorPool.Get(0); var varianceTransformationMatrix = VarianceTransformationMatrixPool == null ? null : VarianceTransformationMatrixPool.Get(0); var varianceTransformationVector = VarianceTransformationVectorPool == null ? null : VarianceTransformationVectorPool.Get(0); _phoneticTiedMixtures = new MixtureComponentSet[_numBase]; for (var i = 0; i < _numBase; i++) { var mixtureComponents = new List <PrunableMixtureComponent[]>(); for (var j = 0; j < numStreams; j++) { var featMixtureComponents = new PrunableMixtureComponent[numGaussiansPerState]; for (var k = 0; k < numGaussiansPerState; k++) { var whichGaussian = i * numGaussiansPerState * numStreams + j * numGaussiansPerState + k; featMixtureComponents[k] = new PrunableMixtureComponent( MeansPool.Get(whichGaussian), meansTransformationMatrix, meansTransformationVector, VariancePool.Get(whichGaussian), varianceTransformationMatrix, varianceTransformationVector, distFloor, varianceFloor, k); } mixtureComponents.Add(featMixtureComponents); } _phoneticTiedMixtures[i] = new MixtureComponentSet(mixtureComponents, _topGauNum); } for (var i = 0; i < numSenones; i++) { ISenone senone = new SetBasedGaussianMixture(MixtureWeightsPool, _phoneticTiedMixtures[Senone2Ci[i]], i); pool.Put(i, senone); } return(pool); }
private Pool createTiedSenonePool(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 streamsNum = this.mixtureWeights.getStreamsNum(); this.logger.fine(new StringBuilder().append("Senones ").append(statesNum).toString()); this.logger.fine(new StringBuilder().append("Gaussians Per State ").append(gauPerState).toString()); this.logger.fine(new StringBuilder().append("Means ").append(num3).toString()); this.logger.fine(new StringBuilder().append("Variances ").append(num4).toString()); if (!Sphinx3Loader.assertionsDisabled && gauPerState <= 0) { throw new AssertionError(); } if (!Sphinx3Loader.assertionsDisabled && num4 != this.numBase * gauPerState * streamsNum) { throw new AssertionError(); } if (!Sphinx3Loader.assertionsDisabled && num3 != this.numBase * gauPerState * streamsNum) { 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; this.phoneticTiedMixtures = new MixtureComponentSet[this.numBase]; for (int i = 0; i < this.numBase; i++) { ArrayList arrayList = new ArrayList(); for (int j = 0; j < streamsNum; j++) { PrunableMixtureComponent[] array = new PrunableMixtureComponent[gauPerState]; for (int k = 0; k < gauPerState; k++) { int id = i * gauPerState * streamsNum + j * gauPerState + k; PrunableMixtureComponent[] array2 = array; int num5 = k; array2[num5] = new PrunableMixtureComponent((float[])this.meansPool.get(id), meanTransformationMatrix, meanTransformationVector, (float[])this.variancePool.get(id), varianceTransformationMatrix, varianceTransformationVector, num, num2, k); } arrayList.add(array); } this.phoneticTiedMixtures[i] = new MixtureComponentSet(arrayList, this.topGauNum); } for (int i = 0; i < statesNum; i++) { SetBasedGaussianMixture o = new SetBasedGaussianMixture(this.mixtureWeights, this.phoneticTiedMixtures[this.senone2ci[i]], i); pool.put(i, o); } return(pool); }