public virtual string getWordPath(bool wantFiller, bool wantPronunciations) { StringBuilder stringBuilder = new StringBuilder(); for (Token token = this; token != null; token = token.getPredecessor()) { if (token.isWord()) { WordSearchState wordSearchState = (WordSearchState)token.getSearchState(); Pronunciation pronunciation = wordSearchState.getPronunciation(); Word word = wordSearchState.getPronunciation().getWord(); if (wantFiller || !word.isFiller()) { if (wantPronunciations) { stringBuilder.insert(0, ']'); Unit[] units = pronunciation.getUnits(); for (int i = units.Length - 1; i >= 0; i--) { if (i < units.Length - 1) { stringBuilder.insert(0, ','); } stringBuilder.insert(0, units[i].getName()); } stringBuilder.insert(0, '['); } stringBuilder.insert(0, word.getSpelling()); stringBuilder.insert(0, ' '); } } } return(String.instancehelper_trim(stringBuilder.toString())); }
private long dumpBestPath(DataOutputStream dataOutputStream, BatchNISTRecognizer.CTLUtterance ctlutterance, Token token) { if (token == null) { return(0L); } Token predecessor = token.getPredecessor(); long num = this.dumpBestPath(dataOutputStream, ctlutterance, predecessor); if (token.isWord()) { long collectTime = token.getCollectTime(); WordSearchState wordSearchState = (WordSearchState)token.getSearchState(); Word word = wordSearchState.getPronunciation().getWord(); string spelling = word.getSpelling(); if (!String.instancehelper_startsWith(spelling, "<")) { string[] array = String.instancehelper_split(ctlutterance.name, "_"); dataOutputStream.write(String.instancehelper_getBytes(new StringBuilder().append(array[0]).append('_').append(array[1]).append('_').append(array[2]).append(" 1 ").append((double)((long)ctlutterance.startOffset + num) / 100.0).append(' ').append((double)(collectTime - num) / 100.0).append(' ').toString())); dataOutputStream.write(BatchNISTRecognizer.hex2Binary(spelling)); dataOutputStream.write(String.instancehelper_getBytes(" 0.700000\n")); } return(collectTime); } return(num); }
public virtual Word getWord() { if (this.isWord()) { WordSearchState wordSearchState = (WordSearchState)this.searchState; return(wordSearchState.getPronunciation().getWord()); } return(null); }
private WordSequence getWordSequence(Token predecessor) { LinkedList linkedList = new LinkedList(); while (predecessor != null) { if (predecessor.isWord()) { WordSearchState wordSearchState = (WordSearchState)predecessor.getSearchState(); Word word = wordSearchState.getPronunciation().getWord(); linkedList.add(0, word); } predecessor = predecessor.getPredecessor(); } return(new WordSequence(linkedList)); }
public override ActiveList purge() { int num = 0; HashMap hashMap = new HashMap(); Collections.sort(this.tokenList, Scoreable.COMPARATOR); Iterator iterator = this.tokenList.iterator(); while (iterator.hasNext()) { Token token = (Token)iterator.next(); WordSearchState wordSearchState = (WordSearchState)token.getSearchState(); Word word = wordSearchState.getPronunciation().getWord(); if (WordActiveListFactory.access_000(this.this_0) > 0 && word.isFiller()) { if (num >= WordActiveListFactory.access_000(this.this_0)) { iterator.remove(); continue; } num++; } if (WordActiveListFactory.access_100(this.this_0) > 0) { Integer integer = (Integer)hashMap.get(word); int num2 = (integer != null) ? integer.intValue() : 0; if (num2 < WordActiveListFactory.access_100(this.this_0) - 1) { hashMap.put(word, Integer.valueOf(num2 + 1)); } else { iterator.remove(); } } } if (this.tokenList.size() > this.this_0.absoluteBeamWidth) { this.tokenList = this.tokenList.subList(0, this.this_0.absoluteBeamWidth); } return(this); }
public virtual string getWordUnitPath() { StringBuilder stringBuilder = new StringBuilder(); for (Token token = this; token != null; token = token.getPredecessor()) { SearchState searchState = token.getSearchState(); if (searchState is WordSearchState) { WordSearchState wordSearchState = (WordSearchState)searchState; Word word = wordSearchState.getPronunciation().getWord(); stringBuilder.insert(0, new StringBuilder().append(' ').append(word.getSpelling()).toString()); } else if (searchState is UnitSearchState) { UnitSearchState unitSearchState = (UnitSearchState)searchState; Unit unit = unitSearchState.getUnit(); stringBuilder.insert(0, new StringBuilder().append(' ').append(unit.getName()).toString()); } } return(String.instancehelper_trim(stringBuilder.toString())); }