outofgrammargraph.java

来自「It is the Speech recognition software. 」· Java 代码 · 共 611 行 · 第 1/2 页

JAVA
611
字号
        /**         * Determines if this is an emitting state         *         * @return true if this is an emitting state         */        public boolean isEmitting() {            return hmmState.isEmitting();        }        /**         * Generate a hashcode for an object         *          * @return the hashcode         */        public int hashCode() {            return 191 + hmmState.hashCode();        }        /**         * Returns the acoustic probability for this state         *         * @return the probability         */        public float getAcousticProbability() {            return logProbability;        }        /**         * Determines if the given object is equal to this object         *          * @param o         *                the object to test         * @return <code>true</code> if the object is equal to this         */        public boolean equals(Object o) {            if (o == this) {                return true;            } else if (o instanceof OogHMMState) {                OogHMMState other = (OogHMMState) o;                return other.hmmState == hmmState;            } else {                return false;            }        }        /**         * Returns the order of this state type among all of the search states         *         * @return the order         */        public int getOrder() {            return isEmitting() ? 4 : 0;        }        /**         * Gets the successor states for this search graph         *          * @return the successor states         */        public SearchStateArc[] getSuccessors() {            if (hmmState.isExitState()) {                return lbsArcSet;            } else {                HMMStateArc[] arcs = hmmState. getSuccessors();                SearchStateArc[] successors = new SearchStateArc[arcs.length];                for (int i = 0; i < arcs.length; i++) {                    successors[i] = new OogHMMState(arcs[i].getHMMState(),                                arcs[i].getLogProbability());                }                return successors;            }        }    }    /**     * Represents the last branch state in the search graph     */    class LastBranchState extends OogSearchState {        private SearchStateArc[] successors;        /**         * Creates the last branch state         */       LastBranchState() {            successors = new SearchStateArc[2];            successors[0] = fbs;            successors[1] = new FinalState();        }        /**         * Gets the state order for this state         *         * @return the state order         */        public int getOrder() {            return 1;        }        /**         * Returns the signature for this state         *         * @return the signature         */        public String getSignature() {            return "oogLBS";        }        /**         * Gets the successor states for this search graph         *          * @return the successor states         */        public SearchStateArc[] getSuccessors() {            return successors;        }    }    /**     * Represents the final state in the search graph     */    class FinalState extends OogSearchState {        /**         * Gets the state order for this state         *         * @return the state order         */        public int getOrder() {            return 2;        }        /**         * Returns the signature for this state         *         * @return the signature         */        public String getSignature() {            return "oogFinal";        }        /**         * Determines if this is a final state         *         * @return true if this is a final state         */        public boolean isFinal() {            return true;        }        /**         * Gets the successor states for this search graph         *          * @return the successor states         */        public SearchStateArc[] getSuccessors() {            return EMPTY_ARCS;        }    }    /**     * The base search state for this dynamic flat linguist.     */    abstract class OogSearchState implements SearchState , SearchStateArc {        final static int ANY = 0;        /**         * Gets the set of successors for this state         *         * @return the set of successors         */        public abstract SearchStateArc[] getSuccessors();        /**         * Returns a unique string representation of the state. This string is         * suitable (and typically used) for a label for a GDL node         *         * @return the signature         */        public abstract String getSignature();        /**         * Returns the order of this state type among all of the search states         *         * @return the order         */        public abstract int getOrder();         /**         * Determines if this state is an emitting state         *         * @return true if this is an emitting state         */        public boolean isEmitting() {            return false;        }        /**         * Determines if this is a final state         *         * @return true if this is a final state         */        public boolean isFinal() {            return false;        }        /**         * Returns a lex state associated with the searc state (not applicable         * to this linguist)         *         * @return the lex state (null for this linguist)         */        public Object getLexState() {            return null;        }        /**         * Returns a well formatted string representation of this state         *         * @return the formatted string         */        public String toPrettyString() {            return toString();        }        /**         * Returns a string representation of this object         *         * @return a string representation         */        public String toString() {            return getSignature();        }        /**         * Returns the word history for this state (not applicable to this         * linguist)         * @return the word history (null for this linguist)         */        public WordSequence getWordHistory() {            return null;        }        /**         * Gets a successor to this search state         *          * @return the sucessor state         */        public SearchState getState() {            return this;        }        /**         * Gets the composite probability of entering this state         *          * @return the log probability         */        public float getProbability() {            return getLanguageProbability() + getAcousticProbability()                    + getInsertionProbability();        }        /**         * Gets the language probability of entering this state         *          * @return the log probability         */        public float getLanguageProbability() {            return LogMath.getLogOne();        }        /**         * Gets the acoustic probability of entering this state         *          * @return the log probability         */        public float getAcousticProbability() {            return LogMath.getLogOne();        }        /**         * Gets the insertion probability of entering this state         *          * @return the log probability         */        public float getInsertionProbability() {            return LogMath.getLogOne();        }        /**         * Simple debugging output         *         * @param msg the debug message         */        void debug(String msg) {            if (false) {                System.out.println(msg);            }        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?