/** * Indicate whether the feature definition contains the feature with the given name * * @param name * the feature name in question, e.g. "next_next_phone" * @return featureNames.contains(name) */ public boolean hasFeature(String name) { return featureNames.contains(name); }
/** * Translate between a feature index and a feature name. * * @param index * a feature index, as could be used to access a feature value in a FeatureVector. * @return the name of the feature corresponding to the index * @throws IndexOutOfBoundsException * if index<0 or index>getNumberOfFeatures() */ public String getFeatureName(int index) { return featureNames.get(index); }
featureNames = new IntStringTranslator(numByteFeatures); featureWeights = new float[numByteFeatures]; featureWeights[i] = input.readFloat(); String featureName = input.readUTF(); featureNames.set(i, featureName); byte numberOfValuesEncoded = input.readByte(); // attention: this is an unsigned byte int numberOfValues = numberOfValuesEncoded & 0xFF; featureWeights[numByteFeatures + i] = input.readFloat(); String featureName = input.readUTF(); featureNames.set(numByteFeatures + i, featureName); short numberOfValues = input.readShort(); shortFeatureValues[i] = new ShortStringTranslator(numberOfValues); floatWeightFuncts[i] = input.readUTF(); String featureName = input.readUTF(); featureNames.set(numByteFeatures + numShortFeatures + i, featureName);
featureNames = new IntStringTranslator(numByteFeatures); featureWeights = new float[numByteFeatures]; featureWeights[i] = input.readFloat(); String featureName = input.readUTF(); featureNames.set(i, featureName); byte numberOfValuesEncoded = input.readByte(); // attention: this is an unsigned byte int numberOfValues = numberOfValuesEncoded & 0xFF; featureWeights[numByteFeatures + i] = input.readFloat(); String featureName = input.readUTF(); featureNames.set(numByteFeatures + i, featureName); short numberOfValues = input.readShort(); shortFeatureValues[i] = new ShortStringTranslator(numberOfValues); floatWeightFuncts[i] = input.readUTF(); String featureName = input.readUTF(); featureNames.set(numByteFeatures + numShortFeatures + i, featureName);
numContinuousFeatures = continuousFeatureLines.size(); int total = numByteFeatures + numShortFeatures + numContinuousFeatures; featureNames = new IntStringTranslator(total); byteFeatureValues = new ByteStringTranslator[numByteFeatures]; shortFeatureValues = new ShortStringTranslator[numShortFeatures]; featureNames.set(i, nameAndValues[0]); // the feature name byteFeatureValues[i] = new ByteStringTranslator(nameAndValues[1].split("\\s+")); // the feature values featureNames.set(numByteFeatures + i, nameAndValues[0]); // the feature name shortFeatureValues[i] = new ShortStringTranslator(nameAndValues[1].split("\\s+")); // the feature values featureNames.set(numByteFeatures + numShortFeatures + i, featureDefSplit[0]); } else { featureNames.set(numByteFeatures + numShortFeatures + i, featureDef);
/** * Translate between a feature name and a feature index. * * @param featureName * a valid feature name * @return a feature index, as could be used to access a feature value in a FeatureVector. * @throws IllegalArgumentException * if the feature name is unknown. */ public int getFeatureIndex(String featureName) { return featureNames.get(featureName); }
/** * Indicate whether the feature definition contains the feature with the given name * * @param name * the feature name in question, e.g. "next_next_phone" * @return featureNames.contains(name) */ public boolean hasFeature(String name) { return featureNames.contains(name); }
numContinuousFeatures = continuousFeatureLines.size(); int total = numByteFeatures + numShortFeatures + numContinuousFeatures; featureNames = new IntStringTranslator(total); byteFeatureValues = new ByteStringTranslator[numByteFeatures]; shortFeatureValues = new ShortStringTranslator[numShortFeatures]; featureNames.set(i, nameAndValues[0]); // the feature name byteFeatureValues[i] = new ByteStringTranslator(nameAndValues[1].split("\\s+")); // the feature values featureNames.set(numByteFeatures + i, nameAndValues[0]); // the feature name shortFeatureValues[i] = new ShortStringTranslator(nameAndValues[1].split("\\s+")); // the feature values featureNames.set(numByteFeatures + numShortFeatures + i, featureDefSplit[0]); } else { featureNames.set(numByteFeatures + numShortFeatures + i, featureDef);
/** * Translate between a feature name and a feature index. * * @param featureName * a valid feature name * @return a feature index, as could be used to access a feature value in a FeatureVector. * @throws IllegalArgumentException * if the feature name is unknown. */ public int getFeatureIndex(String featureName) { return featureNames.get(featureName); }
/** * Indicate whether the feature definition contains the feature with the given name * * @param name * the feature name in question, e.g. "next_next_phone" * @return featureNames.contains(name) */ public boolean hasFeature(String name) { return featureNames.contains(name); }
featureNames = new IntStringTranslator(numByteFeatures); featureWeights = new float[numByteFeatures]; featureWeights[i] = bb.getFloat(); String featureName = StreamUtils.readUTF(bb); featureNames.set(i, featureName); byte numberOfValuesEncoded = bb.get(); // attention: this is an unsigned byte int numberOfValues = numberOfValuesEncoded & 0xFF; featureWeights[numByteFeatures + i] = bb.getFloat(); String featureName = StreamUtils.readUTF(bb); featureNames.set(numByteFeatures + i, featureName); short numberOfValues = bb.getShort(); shortFeatureValues[i] = new ShortStringTranslator(numberOfValues); floatWeightFuncts[i] = StreamUtils.readUTF(bb); String featureName = StreamUtils.readUTF(bb); featureNames.set(numByteFeatures + numShortFeatures + i, featureName);
/** * Translate between a feature index and a feature name. * * @param index * a feature index, as could be used to access a feature value in a FeatureVector. * @return the name of the feature corresponding to the index * @throws IndexOutOfBoundsException * if index<0 or index>getNumberOfFeatures() */ public String getFeatureName(int index) { return featureNames.get(index); }
featureNames = new IntStringTranslator(numByteFeatures); featureWeights = new float[numByteFeatures]; featureWeights[i] = bb.getFloat(); String featureName = StreamUtils.readUTF(bb); featureNames.set(i, featureName); byte numberOfValuesEncoded = bb.get(); // attention: this is an unsigned byte int numberOfValues = numberOfValuesEncoded & 0xFF; featureWeights[numByteFeatures + i] = bb.getFloat(); String featureName = StreamUtils.readUTF(bb); featureNames.set(numByteFeatures + i, featureName); short numberOfValues = bb.getShort(); shortFeatureValues[i] = new ShortStringTranslator(numberOfValues); floatWeightFuncts[i] = StreamUtils.readUTF(bb); String featureName = StreamUtils.readUTF(bb); featureNames.set(numByteFeatures + numShortFeatures + i, featureName);
/** * List all feature names, separated by white space, in their order of definition. * * @return buf converted into a string */ public String getFeatureNames() { StringBuilder buf = new StringBuilder(); for (int i = 0, n = getNumberOfFeatures(); i < n; i++) { if (buf.length() > 0) buf.append(" "); buf.append(featureNames.get(i)); } return buf.toString(); }
featureNames = new IntStringTranslator(numByteFeatures); featureWeights = new float[numByteFeatures]; featureWeights[i] = input.readFloat(); String featureName = input.readUTF(); featureNames.set(i, featureName); byte numberOfValuesEncoded = input.readByte(); // attention: this is an unsigned byte int numberOfValues = numberOfValuesEncoded & 0xFF; featureWeights[numByteFeatures + i] = input.readFloat(); String featureName = input.readUTF(); featureNames.set(numByteFeatures + i, featureName); short numberOfValues = input.readShort(); shortFeatureValues[i] = new ShortStringTranslator(numberOfValues); floatWeightFuncts[i] = input.readUTF(); String featureName = input.readUTF(); featureNames.set(numByteFeatures + numShortFeatures + i, featureName);
/** * List all feature names, separated by white space, in their order of definition. * * @return buf converted into a string */ public String getFeatureNames() { StringBuilder buf = new StringBuilder(); for (int i = 0, n = getNumberOfFeatures(); i < n; i++) { if (buf.length() > 0) buf.append(" "); buf.append(featureNames.get(i)); } return buf.toString(); }
numContinuousFeatures = continuousFeatureLines.size(); int total = numByteFeatures + numShortFeatures + numContinuousFeatures; featureNames = new IntStringTranslator(total); byteFeatureValues = new ByteStringTranslator[numByteFeatures]; shortFeatureValues = new ShortStringTranslator[numShortFeatures]; featureNames.set(i, nameAndValues[0]); // the feature name byteFeatureValues[i] = new ByteStringTranslator(nameAndValues[1].split("\\s+")); // the feature values featureNames.set(numByteFeatures + i, nameAndValues[0]); // the feature name shortFeatureValues[i] = new ShortStringTranslator(nameAndValues[1].split("\\s+")); // the feature values featureNames.set(numByteFeatures + numShortFeatures + i, featureDefSplit[0]); } else { featureNames.set(numByteFeatures + numShortFeatures + i, featureDef);
/** * Translate between a feature index and a feature name. * * @param index * a feature index, as could be used to access a feature value in a FeatureVector. * @return the name of the feature corresponding to the index * @throws IndexOutOfBoundsException * if index<0 or index>getNumberOfFeatures() */ public String getFeatureName(int index) { return featureNames.get(index); }
featureNames = new IntStringTranslator(numByteFeatures); featureWeights = new float[numByteFeatures]; featureWeights[i] = bb.getFloat(); String featureName = StreamUtils.readUTF(bb); featureNames.set(i, featureName); byte numberOfValuesEncoded = bb.get(); // attention: this is an unsigned byte int numberOfValues = numberOfValuesEncoded & 0xFF; featureWeights[numByteFeatures + i] = bb.getFloat(); String featureName = StreamUtils.readUTF(bb); featureNames.set(numByteFeatures + i, featureName); short numberOfValues = bb.getShort(); shortFeatureValues[i] = new ShortStringTranslator(numberOfValues); floatWeightFuncts[i] = StreamUtils.readUTF(bb); String featureName = StreamUtils.readUTF(bb); featureNames.set(numByteFeatures + numShortFeatures + i, featureName);
/** * Translate between a feature name and a feature index. * * @param featureName * a valid feature name * @return a feature index, as could be used to access a feature value in a FeatureVector. * @throws IllegalArgumentException * if the feature name is unknown. */ public int getFeatureIndex(String featureName) { return featureNames.get(featureName); }