Taxonomy refactored
This commit is contained in:
@@ -60,7 +60,7 @@ public class Export {
|
||||
|
||||
public static String SetToCSV(Set<Pair<String, Map<MultipleHMKeys, Long>>> set, File resultsPath, LinkedHashMap<String, String> headerInfoBlock,
|
||||
StatisticsNew statistics, Filter filter) {
|
||||
Map<String, Map<MultipleHMKeys, AtomicLong>> taxonomyResults = statistics.getTaxonomyResult();
|
||||
Map<Taxonomy, Map<MultipleHMKeys, AtomicLong>> taxonomyResults = statistics.getTaxonomyResult();
|
||||
|
||||
//Delimiter used in CSV file
|
||||
String NEW_LINE_SEPARATOR = "\n";
|
||||
@@ -85,7 +85,7 @@ public class Export {
|
||||
// num_taxonomy_frequencies.put(taxonomyKey, val);
|
||||
// }
|
||||
// }
|
||||
Map<String, AtomicLong> num_taxonomy_frequencies = statistics.getUniGramOccurrences();
|
||||
Map<Taxonomy, AtomicLong> num_taxonomy_frequencies = statistics.getUniGramOccurrences();
|
||||
|
||||
|
||||
//CSV file header
|
||||
@@ -106,7 +106,7 @@ public class Export {
|
||||
}
|
||||
}
|
||||
|
||||
headerInfoBlock.put(filter.getCalculateFor().toMetadataString(), String.valueOf(statistics.getUniGramOccurrences().get("Total").longValue()));
|
||||
headerInfoBlock.put(filter.getCalculateFor().toMetadataString(), String.valueOf(statistics.getUniGramOccurrences().get(Taxonomy.TOTAL).longValue()));
|
||||
// headerInfoBlock.put(filter.getCalculateFor().toMetadataString(), String.valueOf(num_frequencies));
|
||||
|
||||
for (CalculateFor otherKey : filter.getMultipleKeys()) {
|
||||
@@ -127,11 +127,11 @@ public class Export {
|
||||
}
|
||||
}
|
||||
|
||||
for (String key : taxonomyResults.keySet()) {
|
||||
if(!key.equals("Total") && num_taxonomy_frequencies.get(key).longValue() > 0) {
|
||||
FILE_HEADER_AL.add("Absolutna pogostost [" + key + "]");
|
||||
FILE_HEADER_AL.add("Delež [" + key + "]");
|
||||
FILE_HEADER_AL.add("Relativna pogostost [" + key + "]");
|
||||
for (Taxonomy key : taxonomyResults.keySet()) {
|
||||
if(!key.equals(Taxonomy.TOTAL) && num_taxonomy_frequencies.containsKey(key) && num_taxonomy_frequencies.get(key).longValue() > 0) {
|
||||
FILE_HEADER_AL.add("Absolutna pogostost [" + key.toString() + "]");
|
||||
FILE_HEADER_AL.add("Delež [" + key.toString() + "]");
|
||||
FILE_HEADER_AL.add("Relativna pogostost [" + key.toString() + "]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,8 +270,8 @@ public class Export {
|
||||
dataEntry.add(e.getValue().toString());
|
||||
dataEntry.add(formatNumberAsPercent((double) e.getValue() / num_frequencies));
|
||||
dataEntry.add(String.format("%.2f", ((double) e.getValue() * 1000000)/num_frequencies));
|
||||
for (String key : taxonomyResults.keySet()){
|
||||
if(!key.equals("Total") && num_taxonomy_frequencies.get(key).longValue() > 0) {
|
||||
for (Taxonomy key : taxonomyResults.keySet()){
|
||||
if(!key.equals(Taxonomy.TOTAL) && num_taxonomy_frequencies.containsKey(key) && num_taxonomy_frequencies.get(key).longValue() > 0) {
|
||||
AtomicLong frequency = taxonomyResults.get(key).get(e.getKey());
|
||||
dataEntry.add(frequency.toString());
|
||||
dataEntry.add(formatNumberAsPercent((double) frequency.get() / num_taxonomy_frequencies.get(key).longValue()));
|
||||
|
||||
Reference in New Issue
Block a user