/** * Class Constructor. */ public ItemContents() { features = new FeatureSet(); relations = new FeatureSet(); }
private static float getSegmentEnd(Item segment) { FeatureSet segmentFeatureSet = segment.getFeatures(); return segmentFeatureSet.getFloat("end"); }
/** * Given the name of a relation, returns the item the shares the same * ItemContents. * * @param relationName the name of the relation of interest * * @return the item associated with this ItemContents in the named * relation, or null if it does not exist */ public Item getItemRelation(String relationName) { return (Item) relations.getObject(relationName); }
FeatureSet featureSet = tokenItem.getFeatures(); String nsw = ""; if (featureSet.isPresent("nsw")) { nsw = featureSet.getString("nsw"); NumberExpander.expandID(tokenVal, wordRelation); } else { String rName = featureSet.getString("name"); String digitsType = null; digitsType = (String) cart.interpret(tokenItem); } else { featureSet.setString("name", tokenVal); digitsType = (String) cart.interpret(tokenItem); featureSet.setString("name", rName);
/** * 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); }
/** * 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) { setObject(name, value); }
public String toString() { // if we have a feature called 'name' use that // otherwise fall back on the default. String name = getFeatures().getString("name"); if (name == null) { name = ""; } return name; }
/** * 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); }
/** * 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); }
/** * Determines if this utterance contains a relation with the given name. * * @param name the name of the relation of interest. * @return if relation is present */ public boolean hasRelation(String name) { return relations.isPresent(name); }
/** * 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); }
String itemName = tokenFeatures.getString("name"); int tokenLength = tokenVal.length(); if (tokenFeatures.isPresent("phones")) { wordRelation.addWord(tokenVal); tokenItem.getFeatures().setString("punc", ""); wordRelation.addWord("mister"); } else if (tokenVal.equals("Mrs")) { tokenItem.getFeatures().setString("punc", ""); wordRelation.addWord("missus"); } else if (tokenLength == 1 .findFeature("n.name")).charAt(0))) { tokenFeatures.setString("punc", ""); String aaa = tokenVal.toLowerCase(); if (aaa.equals("a")) { tokenItem.getFeatures().setString("punc", ","); .findFeature("n.name")).charAt(0))) { tokenFeatures.setString("punc", ""); String aaa = tokenVal.toLowerCase(); if (aaa.equals("a")) {
/** * Sets the last Item in this WordRelation to the given word. * * @param word the word to set */ public void setLastWord(String word) { Item lastItem = relation.getTail(); FeatureSet featureSet = lastItem.getFeatures(); featureSet.setString("name", word); }
/** * 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); }
(Character.isLowerCase(next.charAt(0)) || tokenItem.getNext() == null || featureSet.getString("punc").equals(".") || ((nextLength == 5 || nextLength == 10) && matches( digitsPattern, next)));
/** * Removes the relation/item mapping from this ItemContents. * * @param relationName the name of the relation/item to remove */ public void removeItemRelation(String relationName) { relations.remove(relationName); }
/** * 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); }
/** * Determines if this utterance contains a relation with the given name. * * @param name the name of the relation of interest. * @return if relation is present */ public boolean hasRelation(String name) { return relations.isPresent(name); }