Skip to content
This repository was archived by the owner on Oct 23, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions assignment1/src/main/java/edu/auburn/extraction/FeatureMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,14 @@ public String toString() {

return mapStringBuilder.toString();
}

public String toStringVector() {
StringBuilder mapStringBuilder = new StringBuilder();
for (T feature : getFeatures()) {
Integer featureCount = featureDistribution.get(feature);
double featureFraction = ((double) featureCount) / getTotalFeatureCount();
mapStringBuilder.append(String.format("%f ", featureFraction));
}
return mapStringBuilder.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public void write(String url, FeatureMap<Character> featureMap) throws IOExcepti
getFileWriter().write("\n");
}

public void writeVectors(String url, FeatureMap<Character> featureMap) throws IOException {
getFileWriter().write("0 0 "); //Dummy Value for TrainingSet's count
getFileWriter().write(featureMap.toStringVector());
getFileWriter().write("\n");
}

public void close() throws IOException {
getFileWriter().flush();
getFileWriter().close();
Expand Down