private void parseTopology(KaldiTextParser kaldiTextParser)
        {
            kaldiTextParser.expectToken("<Topology>");
            this.phoneStates = new HashMap();
            string token;

            while (String.instancehelper_equals("<TopologyEntry>", token = kaldiTextParser.getToken()))
            {
                kaldiTextParser.assertToken("<TopologyEntry>", token);
                kaldiTextParser.expectToken("<ForPhones>");
                ArrayList arrayList = new ArrayList();
                while (!String.instancehelper_equals("</ForPhones>", token = kaldiTextParser.getToken()))
                {
                    arrayList.add(Integer.valueOf(Integer.parseInt(token)));
                }
                ArrayList arrayList2 = new ArrayList(3);
                while (String.instancehelper_equals("<State>", kaldiTextParser.getToken()))
                {
                    int @int = kaldiTextParser.getInt();
                    token = kaldiTextParser.getToken();
                    if (String.instancehelper_equals("<PdfClass>", token))
                    {
                        int       int2       = kaldiTextParser.getInt();
                        ArrayList arrayList3 = new ArrayList();
                        while (String.instancehelper_equals("<Transition>", token = kaldiTextParser.getToken()))
                        {
                            arrayList3.add(Integer.valueOf(kaldiTextParser.getInt()));
                            kaldiTextParser.getToken();
                        }
                        kaldiTextParser.assertToken("</State>", token);
                        arrayList2.add(new HmmState(@int, int2, arrayList3));
                    }
                }
                Iterator iterator = arrayList.iterator();
                while (iterator.hasNext())
                {
                    Integer integer = (Integer)iterator.next();
                    this.phoneStates.put(integer, arrayList2);
                }
            }
            kaldiTextParser.assertToken("</Topology>", token);
        }
        public TransitionModel(KaldiTextParser parser)
        {
            parser.expectToken("<TransitionModel>");
            this.parseTopology(parser);
            parser.expectToken("<Triples>");
            this.transitionStates = new HashMap();
            int @int = parser.getInt();
            int num  = 1;

            for (int i = 0; i < @int; i++)
            {
                int    j      = parser.getInt();
                int    int2   = parser.getInt();
                int    int3   = parser.getInt();
                Triple triple = new Triple(j, int2, int3);
                this.transitionStates.put(triple, Integer.valueOf(num));
                num += ((HmmState)((List)this.phoneStates.get(Integer.valueOf(j))).get(int2)).getTransitions().size();
            }
            parser.expectToken("</Triples>");
            parser.expectToken("<LogProbs>");
            this.logProbabilities = parser.getFloatArray();
            parser.expectToken("</LogProbs>");
            parser.expectToken("</TransitionModel>");
            LogMath logMath = LogMath.getLogMath();

            for (int j = 0; j < this.logProbabilities.Length; j++)
            {
                this.logProbabilities[j] = logMath.lnToLog(this.logProbabilities[j]);
            }
        }
Beispiel #3
0
 public DiagGmm(int id, KaldiTextParser parser)
 {
     this.id = id;
     parser.expectToken("<DiagGMM>");
     parser.expectToken("<GCONSTS>");
     this.gconsts = parser.getFloatArray();
     parser.expectToken("<WEIGHTS>");
     parser.getFloatArray();
     parser.expectToken("<MEANS_INVVARS>");
     this.meansInvVars = parser.getFloatArray();
     parser.expectToken("<INV_VARS>");
     this.invVars = parser.getFloatArray();
     parser.expectToken("</DiagGMM>");
 }