/** * Returns the named feature as an object. If the named feature is not present in the utterance, * then this attempts to retrieve it from the voice. * * @param name the name of the feature * @return the value associated with the name or null if the value is not found */ public Object getObject(String name) { if (!features.isPresent(name)) { return getVoice().getFeatures().getObject(name); } else { return features.getObject(name); } }
/** * Determines if the given feature is present. If the feature is not present in the utterance, the * feature set of the voice is checked. * * @param name the name of the feature of interest * @return true if the named feature is present */ public boolean isPresent(String name) { if (!features.isPresent(name)) { return getVoice().getFeatures().isPresent(name); } else { return true; } }
/** * Convenience method that returns the named feature as a string. If the named feature is not * present in the utterance, then this attempts to retrieve it from the voice. * * @param name the name of the feature * @return the value associated with the name or null if the value is not found * @throws ClassCastException if the associated value is not a String */ public String getString(String name) { if (!features.isPresent(name)) { return getVoice().getFeatures().getString(name); } else { return features.getString(name); } }
/** * Determines if this utterance contains a relation with the given name. * * @param name the name of the relation of interest. */ public boolean hasRelation(String name) { return relations.isPresent(name); }