Added translataion fixes + punctuation in export fix

This commit is contained in:
2019-03-19 14:06:39 +01:00
parent 39624fa4f2
commit 10666b4453
19 changed files with 586 additions and 421 deletions

View File

@@ -22,6 +22,7 @@ public enum CalculateFor {
// DIST_LEMMAS("lema");
WORD("calculateFor.WORD"),
LOWERCASE_WORD("calculateFor.LOWERCASE_WORD"),
NORMALIZED_WORD("calculateFor.NORMALIZED_WORD"),
LEMMA("calculateFor.LEMMA"),
MORPHOSYNTACTIC_SPECS("calculateFor.MORPHOSYNTACTIC_SPECS"),
@@ -47,6 +48,9 @@ public enum CalculateFor {
if (WORD.toString().equals(cf)) {
return WORD;
}
if (LOWERCASE_WORD.toString().equals(cf)) {
return LOWERCASE_WORD;
}
if (LEMMA.toString().equals(cf)) {
return LEMMA;
}
@@ -71,6 +75,8 @@ public enum CalculateFor {
switch (this) {
case WORD:
return I18N.get("exportTable.part.totalSumLetters") + " " + I18N.get("exportTable.part.word");
case LOWERCASE_WORD:
return I18N.get("exportTable.part.totalSumLetters") + " " + I18N.get("exportTable.part.lowercaseWord");
case NORMALIZED_WORD:
return I18N.get("exportTable.part.totalSumLetters") + " " + I18N.get("exportTable.part.normalizedWord");
case LEMMA:
@@ -92,6 +98,8 @@ public enum CalculateFor {
switch (this) {
case WORD:
return I18N.get("exportTable.part.totalSumString") + " " + I18N.get("exportTable.part.word");
case LOWERCASE_WORD:
return I18N.get("exportTable.part.totalSumString") + " " + I18N.get("exportTable.part.lowercaseWord");
case NORMALIZED_WORD:
return I18N.get("exportTable.part.totalSumString") + " " + I18N.get("exportTable.part.normalizedWord");
case LEMMA:
@@ -118,6 +126,8 @@ public enum CalculateFor {
switch (this) {
case WORD:
return I18N.get("exportTable.part.totalFoundLetters") + " " + I18N.get("exportTable.part.word");
case LOWERCASE_WORD:
return I18N.get("exportTable.part.totalFoundLetters") + " " + I18N.get("exportTable.part.lowercaseWord");
case NORMALIZED_WORD:
return I18N.get("exportTable.part.totalFoundLetters") + " " + I18N.get("exportTable.part.normalizedWord");
case LEMMA:
@@ -139,6 +149,8 @@ public enum CalculateFor {
switch (this) {
case WORD:
return I18N.get("exportTable.part.totalFound") + " " + I18N.get("exportTable.part.word");
case LOWERCASE_WORD:
return I18N.get("exportTable.part.totalFound") + " " + I18N.get("exportTable.part.lowercaseWord");
case NORMALIZED_WORD:
return I18N.get("exportTable.part.totalFound") + " " + I18N.get("exportTable.part.normalizedWord");
case LEMMA:
@@ -168,6 +180,8 @@ public enum CalculateFor {
switch(this){
case WORD:
return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.word2");
case LOWERCASE_WORD:
return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.lowercaseWord2");
case NORMALIZED_WORD:
return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.normalizedWord2");
case LEMMA:
@@ -194,6 +208,8 @@ public enum CalculateFor {
switch(this){
case WORD:
return I18N.get("exportTable.part.share") + " " + I18N.get("exportTable.part.word2");
case LOWERCASE_WORD:
return I18N.get("exportTable.part.share") + " " + I18N.get("exportTable.part.lowercaseWord2");
case NORMALIZED_WORD:
return I18N.get("exportTable.part.share") + " " + I18N.get("exportTable.part.normalizedWord2");
case LEMMA:
@@ -221,6 +237,8 @@ public enum CalculateFor {
case WORD:
case DIST_WORDS:
return I18N.get("exportTable.part.word3");
case LOWERCASE_WORD:
return I18N.get("exportTable.part.lowercaseWord3");
case NORMALIZED_WORD:
return I18N.get("exportTable.part.normalizedWord3");
case LEMMA:
@@ -240,6 +258,8 @@ public enum CalculateFor {
case WORD:
case DIST_WORDS:
return I18N.get("exportTable.part.word3") + " " + I18N.get("exportTable.part.set");
case LOWERCASE_WORD:
return I18N.get("exportTable.part.lowercaseWord3") + " " + I18N.get("exportTable.part.set");
case NORMALIZED_WORD:
return I18N.get("exportTable.part.normalizedWord3") + " " + I18N.get("exportTable.part.set");
case LEMMA:

View File

@@ -36,6 +36,7 @@ public class Corpus {
boolean hasMsdData;
private ArrayList<String> validationErrors;
private String corpusName = "";
private String punctuation = "punctuation.COMMA";
public Corpus() {
validationErrors = new ArrayList<>();
@@ -52,6 +53,16 @@ public class Corpus {
logger.info("Corpus.set: ", corpusName);
}
public String getPunctuation() {
return punctuation;
}
public void setPunctuation(String punctuation) {
// System.out.println(corpusName);
this.punctuation = punctuation;
logger.info("Punctuation.set: ", punctuation);
}
public CorpusType getCorpusType() {
return corpusType;
}

View File

@@ -320,6 +320,10 @@ public class Filter implements Cloneable {
ArrayList<CalculateFor> oldWp = ((ArrayList<CalculateFor>) filter.get(WORD_PARTS));
switch (wp) {
case LOWERCASE_WORD:
if (!oldWp.contains(CalculateFor.LOWERCASE_WORD))
oldWp.add(CalculateFor.LOWERCASE_WORD);
break;
case WORD:
case DIST_WORDS:
if (!oldWp.contains(CalculateFor.WORD))

View File

@@ -324,28 +324,28 @@ public class StatisticsNew {
return true;
}
public boolean recalculateAndSaveResultToDisk() throws UnsupportedEncodingException {
filter.setAl(AnalysisLevel.WORD_FORMATION);
resultTitle = generateResultTitle();
if (useDB) {
result = db.getDump();
db.delete();
}
// if no results and nothing to save, return false
if (!(result.size() > 0)) {
analysisProducedResults = false;
return false;
} else {
analysisProducedResults = true;
}
WordFormation.calculateStatistics(this);
Export.SetToCSV(resultTitle, resultCustom, corpus.getChosenResultsLocation(), headerInfoBlock());
return true;
}
// public boolean recalculateAndSaveResultToDisk() throws UnsupportedEncodingException {
// filter.setAl(AnalysisLevel.WORD_FORMATION);
// resultTitle = generateResultTitle();
//
// if (useDB) {
// result = db.getDump();
// db.delete();
// }
//
// // if no results and nothing to save, return false
// if (!(result.size() > 0)) {
// analysisProducedResults = false;
// return false;
// } else {
// analysisProducedResults = true;
// }
//
// WordFormation.calculateStatistics(this);
//
// Export.SetToCSV(resultTitle, resultCustom, corpus.getChosenResultsLocation(), headerInfoBlock());
// return true;
// }
private Map<String, Map<MultipleHMKeys, Long>> sortNestedMap(Map<String, ConcurrentHashMap<MultipleHMKeys, AtomicLong>> nestedMap, int limit) {
Map<String, Map<MultipleHMKeys, Long>> sorted = new HashMap<>();
@@ -682,6 +682,11 @@ public class StatisticsNew {
info.put(I18N.get("exportHeader.minOccurrences"), String.valueOf(filter.getMinimalOccurrences()));
info.put(I18N.get("exportHeader.minTaxonomies"), String.valueOf(filter.getMinimalTaxonomy()));
// if not letters extraction
if(filter.getNgramValue() > 0) {
info.put(I18N.get("exportHeader.minRelFre"), String.valueOf(filter.getMinimalRelFre()));
}
if (corpus.getCorpusType() == CorpusType.SOLAR) {
HashMap<String, ObservableList<String>> filters = corpus.getSolarSelectedFilters();

View File

@@ -28,7 +28,11 @@ public interface Word {
}
default String getWord(ArrayList<CalculateFor> wordParts){
return get(wordParts, CalculateFor.WORD);
String w = get(wordParts, CalculateFor.WORD);
if (w == null){
return get(wordParts, CalculateFor.LOWERCASE_WORD);
}
return w;
}
default String getLemma(ArrayList<CalculateFor> wordParts){
@@ -102,9 +106,9 @@ public interface Word {
String returnValue = "";
if (cvv) {
returnValue = calculateFor == CalculateFor.WORD ? getCVVWord(cf) : getCVVLemma(cf);
returnValue = (calculateFor == CalculateFor.WORD || calculateFor == CalculateFor.LOWERCASE_WORD) ? getCVVWord(cf) : getCVVLemma(cf);
} else {
returnValue = calculateFor == CalculateFor.WORD ? getWord(cf) : getLemma(cf);
returnValue = (calculateFor == CalculateFor.WORD || calculateFor == CalculateFor.LOWERCASE_WORD) ? getWord(cf) : getLemma(cf);
}
return returnValue;