⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 baserulename.java

📁 It is the Speech recognition software. It is platform independent. To execute the source code,
💻 JAVA
字号:
/** * Copyright 1998-2003 Sun Microsystems, Inc. *  * See the file "license.terms" for information on usage and * redistribution of this file, and for a DISCLAIMER OF ALL  * WARRANTIES. */package com.sun.speech.engine.recognition;import javax.speech.recognition.*;/** * Simple extension of RuleName to store hidden resolved rulename. *  * @version 1.3 11/25/98 16:51:14 */public class BaseRuleName extends RuleName {    public BaseRuleName() {        super();    }    public BaseRuleName(String name) {        super(name);    }    /**     * Fully-qualified rulename generated by linkGrammars method.     */    public String resolvedRuleName;    /**     * Override clone to copy resolvedRuleName as well.     */    public Rule copy() {        BaseRuleName rn = new BaseRuleName(getRuleName());        rn.resolvedRuleName = resolvedRuleName;        return rn;    }    /**     * Copy the input rule object but change all instances of a      * RuleName to a BaseRuleName.  Used by setRule method in     * BaseRuleGrammar so there is a place to put the fully     * resolved rule name when linking a Grammar.     */    public static Rule copyForBaseRuleName(Rule r) {        if (r == null) {            return null;        }                if (r instanceof RuleToken) {            RuleToken rt = (RuleToken)r;            return new RuleToken(rt.getText());        }                if (r instanceof RuleAlternatives) {            RuleAlternatives ra = (RuleAlternatives)r;            Rule array[] = ra.getRules();            float[] weights = ra.getWeights();            for(int i=0; i<array.length; i++) {                array[i] = copyForBaseRuleName(array[i]);            }            return new RuleAlternatives(array, weights);        }                   if (r instanceof RuleSequence) {            RuleSequence rs = (RuleSequence)r;            Rule array[] = rs.getRules();            for(int i=0; i<array.length; i++) {                array[i] = copyForBaseRuleName(array[i]);            }            return new RuleSequence(array);        }                if (r instanceof RuleCount) {            RuleCount rc = (RuleCount)r;            return new RuleCount(copyForBaseRuleName(rc.getRule()),                                  rc.getCount());        }                if (r instanceof RuleTag) {            RuleTag rt = (RuleTag)r;            return new RuleTag(copyForBaseRuleName(rt.getRule()), rt.getTag());        }                if (r instanceof RuleName) {            RuleName rn = (RuleName)r;            return new BaseRuleName(rn.getRuleName());        }                throw new RuntimeException("Unknown rule type");    }}

⌨️ 快捷键说明

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