Added the rest of collocabilities
This commit is contained in:
@@ -94,6 +94,17 @@ public class Export {
|
||||
FILE_HEADER_AL.add(filter.getCalculateFor().toHeaderString());
|
||||
if (filter.getCalculateFor().equals(CalculateFor.LEMMA))
|
||||
FILE_HEADER_AL.add("Lema male črke");
|
||||
|
||||
if (filter.getSuffixLength() != null && filter.getSuffixList() != null && filter.getPrefixLength() != null && filter.getPrefixList() != null) {
|
||||
if (filter.getPrefixLength() > 0 || filter.getPrefixList().size() > 0) {
|
||||
FILE_HEADER_AL.add("Predpona");
|
||||
}
|
||||
FILE_HEADER_AL.add("Preostali del besede");
|
||||
if (filter.getSuffixLength() > 0 || filter.getSuffixList().size() > 0) {
|
||||
FILE_HEADER_AL.add("Pripona");
|
||||
}
|
||||
}
|
||||
|
||||
headerInfoBlock.put(filter.getCalculateFor().toMetadataString(), String.valueOf(num_frequencies));
|
||||
|
||||
for (CalculateFor otherKey : filter.getMultipleKeys()) {
|
||||
@@ -109,7 +120,9 @@ public class Export {
|
||||
FILE_HEADER_AL.add("Skupna relativna pogostost (na milijon pojavitev)");
|
||||
|
||||
if (filter.getCollocability().size() > 0){
|
||||
FILE_HEADER_AL.add(filter.getCollocability().get(0).toHeaderString());
|
||||
for (Collocability c : filter.getCollocability()) {
|
||||
FILE_HEADER_AL.add(c.toHeaderString());
|
||||
}
|
||||
}
|
||||
|
||||
for (String key : taxonomyResults.keySet()) {
|
||||
@@ -167,6 +180,45 @@ public class Export {
|
||||
dataEntry.add(eraseSkipgramStars(e.getKey().getK1().toLowerCase(), filter));
|
||||
}
|
||||
|
||||
if (filter.getSuffixLength() != null || filter.getSuffixList() != null || filter.getPrefixLength() != null || filter.getPrefixList() != null) {
|
||||
if(filter.getSuffixLength() > 0 || filter.getPrefixLength() > 0) {
|
||||
if (filter.getPrefixLength() > 0) {
|
||||
dataEntry.add(((String) dataEntry.get(0)).substring(0, filter.getPrefixLength()));
|
||||
}
|
||||
dataEntry.add(((String) dataEntry.get(0)).substring(filter.getPrefixLength(), ((String) dataEntry.get(0)).length() - filter.getSuffixLength()));
|
||||
if (filter.getSuffixLength() > 0) {
|
||||
dataEntry.add(((String) dataEntry.get(0)).substring(((String) dataEntry.get(0)).length() - filter.getSuffixLength()));
|
||||
}
|
||||
} else {
|
||||
String key = (String) dataEntry.get(0);
|
||||
// real prefix
|
||||
String rpf = "";
|
||||
for(String pf : filter.getPrefixList()){
|
||||
if (pf.equals(key.substring(0, pf.length()))){
|
||||
rpf = pf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// real suffix
|
||||
String rsf = "";
|
||||
for(String sf : filter.getSuffixList()){
|
||||
if (sf.equals(key.substring(key.length() - sf.length()))){
|
||||
rsf = sf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (filter.getPrefixList().size() > 0) {
|
||||
dataEntry.add(rpf);
|
||||
}
|
||||
dataEntry.add(key.substring(rpf.length(), key.length() - rsf.length()));
|
||||
if (filter.getSuffixList().size() > 0) {
|
||||
dataEntry.add(rsf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (CalculateFor otherKey : filter.getMultipleKeys()){
|
||||
switch(i){
|
||||
@@ -207,7 +259,9 @@ public class Export {
|
||||
}
|
||||
|
||||
if (filter.getCollocability().size() > 0){
|
||||
dataEntry.add(String.format("%.4f", statistics.getCollocability().get(filter.getCollocability().get(0)).get(e.getKey())));
|
||||
for (Collocability c : filter.getCollocability()) {
|
||||
dataEntry.add(statistics.getCollocability().get(c).get(e.getKey()));
|
||||
}
|
||||
}
|
||||
|
||||
// Write msd separated per letters at the end of each line in csv
|
||||
@@ -419,6 +473,5 @@ public class Export {
|
||||
List values = new ArrayList();
|
||||
csvFilePrinter.printRecord(values);
|
||||
csvFilePrinter.printRecord(values);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user