Example #1
0
 /**
  * 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);
   }
 }
Example #2
0
 /**
  * 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);
   }
 }
Example #3
0
 /**
  * Dumps this utterance in textual form.
  *
  * @param output where to send the formatted output
  * @param pad the initial padding
  * @param title the title to print when dumping out the utterance
  * @param justRelations if true don't print voice features
  */
 public void dump(PrintWriter output, int pad, String title, boolean justRelations) {
   output.println(" ============ " + title + " ========== ");
   if (!justRelations) {
     voice.dump(output, pad + 4, "Voice");
     features.dump(output, pad + 4, "Features");
   }
   relations.dump(output, pad + 4, "Relations");
   output.flush();
 }
Example #4
0
 /**
  * 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;
   }
 }
Example #5
0
 /**
  * Retrieves a relation from this utterance.
  *
  * @param name the name of the Relation
  * @return the relation or null if the relation is not found
  */
 public Relation getRelation(String name) {
   return (Relation) relations.getObject(name);
 }
Example #6
0
 /**
  * Creates a new relation with the given name and adds it to this utterance.
  *
  * @param name the name of the new relation
  * @return the newly created relation
  */
 public Relation createRelation(String name) {
   Relation relation = new Relation(name, this);
   relations.setObject(name, relation);
   return relation;
 }
Example #7
0
 /**
  * Sets the named feature.
  *
  * @param name the name of the feature
  * @param value the value of the feature
  */
 public void setObject(String name, Object value) {
   features.setObject(name, value);
 }
Example #8
0
 /**
  * Convenience method that sets the named feature as a String.
  *
  * @param name the name of the feature
  * @param value the value of the feature
  */
 public void setString(String name, String value) {
   features.setString(name, value);
 }
Example #9
0
 /**
  * Convenience method that sets the named feature as a float.
  *
  * @param name the name of the feature
  * @param value the value of the feature
  */
 public void setFloat(String name, float value) {
   features.setFloat(name, value);
 }
Example #10
0
 /**
  * Convenience method that sets the named feature as an int.
  *
  * @param name the name of the feature
  * @param value the value of the feature
  */
 public void setInt(String name, int value) {
   features.setInt(name, value);
 }
Example #11
0
 /**
  * Removes the named feature from this set of features.
  *
  * @param name the name of the feature of interest
  */
 public void remove(String name) {
   features.remove(name);
 }
Example #12
0
 /**
  * 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);
 }