unigramprobability.java

来自「It is the Speech recognition software. 」· Java 代码 · 共 115 行

JAVA
115
字号
/* * Copyright 1999-2002 Carnegie Mellon University.   * Portions Copyright 2002 Sun Microsystems, Inc.   * Portions Copyright 2002 Mitsubishi Electric Research Laboratories. * All Rights Reserved.  Use is subject to license terms. *  * See the file "license.terms" for information on usage and * redistribution of this file, and for a DISCLAIMER OF ALL  * WARRANTIES. * */package edu.cmu.sphinx.linguist.language.ngram.large;/** * Represents a probability, a backoff probability, and the location * of the first bigram entry. */class UnigramProbability {    private int wordID;    private float logProbability;    private float logBackoff;    private int firstBigramEntry;    /**     * Constructs a UnigramProbability     *     * @param wordID the id of the word     * @param logProbability the probability     * @param logBackoff the backoff probability     * @param firstBigramEntry the first bigram entry     */    public UnigramProbability(int wordID, float logProbability, 			      float logBackoff, int firstBigramEntry) {	this.wordID = wordID;        this.logProbability = logProbability;        this.logBackoff = logBackoff;        this.firstBigramEntry = firstBigramEntry;    }    /**     * Returns a string representation of this object     *     * @return the string form of this object     */    public String toString() {        return "Prob: " + logProbability + " " + logBackoff;    }    /**     * Returns the word ID of this unigram     *     * @return the word ID of this unigram     */    public int getWordID() {	return wordID;    }    /**     * Returns the log probability of this unigram.     *     * @return the log probability of this unigram     */    public float getLogProbability() {        return logProbability;    }    /**     * Returns the log backoff weight of this unigram     *     * @return the log backoff weight of this unigram     */    public float getLogBackoff() {        return logBackoff;    }    /**     * Returns the index of the first bigram entry of this unigram.     *     * @return the index of the first bigram entry of this unigram     */    public int getFirstBigramEntry() {        return firstBigramEntry;    }    /**     * Sets the log probability of this unigram     *     * @param logProbability  the new log probability of this unigram     */    public void setLogProbability(float logProbability) {        this.logProbability = logProbability;    }    /**     * Sets the log backoff weight.     *     * @param logBackoff the new log backoff weight     */    public void setLogBackoff(float logBackoff) {        this.logBackoff = logBackoff;    }}

⌨️ 快捷键说明

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