private void init() { this.skipSeqs.add(this.eps); this.skipSeqs.add(this.sb); this.skipSeqs.add(this.se); this.skipSeqs.add(this.skip); this.skipSeqs.add("-"); Compose.augment(0, this.g2pmodel, this.g2pmodel.getSemiring()); ArcSort.apply(this.g2pmodel, new ILabelCompare()); string[] isyms = this.g2pmodel.getIsyms(); this.loadClusters(isyms); this.epsilonFilter = Compose.getFilter(this.g2pmodel.getIsyms(), this.g2pmodel.getSemiring()); ArcSort.apply(this.epsilonFilter, new ILabelCompare()); }
public virtual ArrayList phoneticize(ArrayList entry, int nbest) { Fst fst = this.entryToFSA(entry); Semiring semiring = fst.getSemiring(); Compose.augment(1, fst, semiring); ArcSort.apply(fst, new OLabelCompare()); Fst fst2 = Compose.compose(fst, this.epsilonFilter, semiring, true); ArcSort.apply(fst2, new OLabelCompare()); fst2 = Compose.compose(fst2, this.g2pmodel, semiring, true); Project.apply(fst2, ProjectType.__OUTPUT); if (nbest == 1) { fst2 = NShortestPaths.get(fst2, 1, false); } else { fst2 = NShortestPaths.get(fst2, nbest * 10, false); } fst2 = RmEpsilon.get(fst2); return(this.findAllPaths(fst2, nbest, this.skipSeqs, this.tie)); }