private String getValue(Feature feature) { if (feature.getType().equals(FeatureType.STRING) || feature.getType().equals(FeatureType.NOMINAL)) { String value = feature.getValue().toString(); String idx = stringToIntegerMap.get(value); if (idx == null) { stringToIntegerMap.put(value, "" + maxStringId++); idx = stringToIntegerMap.get(value); } return idx.toString(); } return feature.getValue().toString(); }
public void collectMetaData(List<Instance> instances) { featureNames = new TreeSet<>(); for (Feature f : instances.get(0).getFeatures()) { featureNames.add(f.getName()); if (!featDesc.containsKey(f.getName())) { featDesc.put(f.getName(), f.getType()); } if (f.getType() == FeatureType.NOMINAL) { enumFeatureName.put(f.getName(), f.getValue().getClass().getName()); } } didCollect = true; }
public void collectMetaData(List<Instance> instances) { featureNames = new TreeSet<>(); for (Feature f : instances.get(0).getFeatures()) { featureNames.add(f.getName()); if (!featDesc.containsKey(f.getName())) { featDesc.put(f.getName(), f.getType()); } if (f.getType() == FeatureType.NOMINAL) { enumFeatureName.put(f.getName(), f.getValue().getClass().getName()); } } didCollect = true; }
bw.write(" "); bw.write(f.getName() + ":" + mapStringValues(f.getType(), f.getValue().toString()));