Implemented interlinguality and fixed some bugs"

master
Luka 5 years ago
parent ca83cb023b
commit 5e686ff681

@ -1026,7 +1026,6 @@ public class XML_processing {
} //else { } //else {
// System.out.println("Error"); // System.out.println("Error");
// } // }
} }
} }
@ -1068,10 +1067,22 @@ public class XML_processing {
// add sentence to corpus if it passes filters // add sentence to corpus if it passes filters
if (includeFile && !ValidationUtil.isEmpty(sentence)) { if (includeFile && !ValidationUtil.isEmpty(sentence)) {
// for(Word w : sentence) {
// if (w.getW1().equals("")) {
// System.out.println("HERE!!!");
// }
// }
sentence = runFilters(sentence, stats.getFilter()); sentence = runFilters(sentence, stats.getFilter());
// for(Word w : sentence) {
// if (w.getW1().equals("")) {
// System.out.println("HERE!!!");
// }
// }
corpus.add(new Sentence(sentence, currentFiletaxonomy)); corpus.add(new Sentence(sentence, currentFiletaxonomy));
} }
wordIndex = 0; wordIndex = 0;

@ -236,9 +236,10 @@ public class Ngrams {
.collect(Collectors.toList())); .collect(Collectors.toList()));
return StringUtils.join(candidate, " "); return StringUtils.join(candidate, " ");
case WORD_TYPE: case WORD_TYPE:
//'/' has to be a possiblility for when i.e. msd in GOS equals anon
candidate.addAll(ngramCandidate candidate.addAll(ngramCandidate
.stream() .stream()
.map(w -> Character.toString(w.getMsd(wordParts).charAt(0))) .map(w -> Character.toString(w.getMsd(wordParts).length() > 0 ? w.getMsd(wordParts).charAt(0) : '/'))
.collect(Collectors.toList())); .collect(Collectors.toList()));
// candidate.addAll(ngramCandidate // candidate.addAll(ngramCandidate
// .stream() // .stream()

@ -1,14 +1,34 @@
package data; package data;
import gui.I18N;
public enum CalculateFor { public enum CalculateFor {
WORD("različnica"), // calculateFor.WORD=word
NORMALIZED_WORD("normalizirana različnica"), // calculateFor.NORMALIZED_WORD=normalized word
LEMMA("lema"), // calculateFor.LEMMA=lemma
MORPHOSYNTACTIC_SPECS("oblikoskladenjska oznaka"), // calculateFor.MORPHOSYNTACTIC_SPECS=msd
MORPHOSYNTACTIC_PROPERTY("oblikoskladenjska lastnost"), // calculateFor.MORPHOSYNTACTIC_PROPERTY=oblikoskladenjska lastnost
WORD_TYPE("besedna vrsta"), // calculateFor.WORD_TYPE=besedna vrsta
DIST_WORDS("različnica"), // calculateFor.DIST_WORDS=različnica
DIST_LEMMAS("lema"); // calculateFor.DIST_LEMMAS=lema
// WORD("različnica"),
// NORMALIZED_WORD("normalizirana različnica"),
// LEMMA("lema"),
// MORPHOSYNTACTIC_SPECS("oblikoskladenjska oznaka"),
// MORPHOSYNTACTIC_PROPERTY("oblikoskladenjska lastnost"),
// WORD_TYPE("besedna vrsta"),
// DIST_WORDS("različnica"),
// DIST_LEMMAS("lema");
WORD("calculateFor.WORD"),
NORMALIZED_WORD("calculateFor.NORMALIZED_WORD"),
LEMMA("calculateFor.LEMMA"),
MORPHOSYNTACTIC_SPECS("calculateFor.MORPHOSYNTACTIC_SPECS"),
MORPHOSYNTACTIC_PROPERTY("calculateFor.MORPHOSYNTACTIC_PROPERTY"),
WORD_TYPE("calculateFor.WORD_TYPE"),
DIST_WORDS("calculateFor.DIST_WORDS"),
DIST_LEMMAS("calculateFor.DIST_LEMMAS");
private final String name; private final String name;
@ -18,11 +38,12 @@ public enum CalculateFor {
} }
public String toString() { public String toString() {
return this.name; return I18N.get(this.name);
} }
public static CalculateFor factory(String cf) { public static CalculateFor factory(String cf) {
if (cf != null) { if (cf != null) {
// String name = I18N.findI18NString(cf, "calculateFor");
if (WORD.toString().equals(cf)) { if (WORD.toString().equals(cf)) {
return WORD; return WORD;
} }
@ -49,42 +70,42 @@ public enum CalculateFor {
if (ngram == 0) { if (ngram == 0) {
switch (this) { switch (this) {
case WORD: case WORD:
return "Skupna vsota vseh črkovnih nizov različnic:"; return I18N.get("exportTable.part.totalSumLetters") + " " + I18N.get("exportTable.part.word");
case NORMALIZED_WORD: case NORMALIZED_WORD:
return "Skupna vsota vseh črkovnih nizov normaliziranih različnic:"; return I18N.get("exportTable.part.totalSumLetters") + " " + I18N.get("exportTable.part.normalizedWord");
case LEMMA: case LEMMA:
return "Skupna vsota vseh črkovnih nizov lem:"; return I18N.get("exportTable.part.totalSumLetters") + " " + I18N.get("exportTable.part.lemma");
case MORPHOSYNTACTIC_SPECS: case MORPHOSYNTACTIC_SPECS:
return "Skupna vsota vseh črkovnih nizov oblikoskladenjskih oznak:"; return I18N.get("exportTable.part.totalSumLetters") + " " + I18N.get("exportTable.part.msd");
case MORPHOSYNTACTIC_PROPERTY: case MORPHOSYNTACTIC_PROPERTY:
return "Skupna vsota vseh črkovnih nizov oblikoskladenjskih lastnosti:"; return I18N.get("exportTable.part.totalSumLetters") + " " + I18N.get("exportTable.part.msdProperty");
case WORD_TYPE: case WORD_TYPE:
return "Skupna vsota vseh črkovnih nizov besednih vrst:"; return I18N.get("exportTable.part.totalSumLetters") + " " + I18N.get("exportTable.part.wordType");
case DIST_WORDS: case DIST_WORDS:
return "Skupna vsota vseh črkovnih nizov različnic:"; return I18N.get("exportTable.part.totalSumLetters") + " " + I18N.get("exportTable.part.word");
case DIST_LEMMAS: case DIST_LEMMAS:
return "Skupna vsota vseh črkovnih nizov lem:"; return I18N.get("exportTable.part.totalSumLetters") + " " + I18N.get("exportTable.part.lemma");
default: default:
return null; return null;
} }
} else if (ngram >= 1) { } else if (ngram >= 1) {
switch (this) { switch (this) {
case WORD: case WORD:
return "Skupna vsota vseh različnic:"; return I18N.get("exportTable.part.totalSumString") + " " + I18N.get("exportTable.part.word");
case NORMALIZED_WORD: case NORMALIZED_WORD:
return "Skupna vsota vseh normaliziranih različnic:"; return I18N.get("exportTable.part.totalSumString") + " " + I18N.get("exportTable.part.normalizedWord");
case LEMMA: case LEMMA:
return "Skupna vsota vseh lem:"; return I18N.get("exportTable.part.totalSumString") + " " + I18N.get("exportTable.part.lemma");
case MORPHOSYNTACTIC_SPECS: case MORPHOSYNTACTIC_SPECS:
return "Skupna vsota vseh oblikoskladenjskih oznak:"; return I18N.get("exportTable.part.totalSumString") + " " + I18N.get("exportTable.part.msd");
case MORPHOSYNTACTIC_PROPERTY: case MORPHOSYNTACTIC_PROPERTY:
return "Skupna vsota vseh oblikoskladenjskih lastnosti:"; return I18N.get("exportTable.part.totalSumString") + " " + I18N.get("exportTable.part.msdProperty");
case WORD_TYPE: case WORD_TYPE:
return "Skupna vsota vseh besednih vrst:"; return I18N.get("exportTable.part.totalSumString") + " " + I18N.get("exportTable.part.wordType");
case DIST_WORDS: case DIST_WORDS:
return "Skupna vsota vseh različnic:"; return I18N.get("exportTable.part.totalSumString") + " " + I18N.get("exportTable.part.word");
case DIST_LEMMAS: case DIST_LEMMAS:
return "Skupna vsota vseh lem:"; return I18N.get("exportTable.part.totalSumString") + " " + I18N.get("exportTable.part.lemma");
default: default:
return null; return null;
} }
@ -96,42 +117,42 @@ public enum CalculateFor {
if (ngram == 0) { if (ngram == 0) {
switch (this) { switch (this) {
case WORD: case WORD:
return "Skupna vsota vseh najdenih črkovnih nizov različnic:"; return I18N.get("exportTable.part.totalFoundLetters") + " " + I18N.get("exportTable.part.word");
case NORMALIZED_WORD: case NORMALIZED_WORD:
return "Skupna vsota vseh najdenih črkovnih nizov normaliziranih različnic:"; return I18N.get("exportTable.part.totalFoundLetters") + " " + I18N.get("exportTable.part.normalizedWord");
case LEMMA: case LEMMA:
return "Skupna vsota vseh najdenih črkovnih nizov lem:"; return I18N.get("exportTable.part.totalFoundLetters") + " " + I18N.get("exportTable.part.lemma");
case MORPHOSYNTACTIC_SPECS: case MORPHOSYNTACTIC_SPECS:
return "Skupna vsota vseh najdenih črkovnih nizov oblikoskladenjskih oznak:"; return I18N.get("exportTable.part.totalFoundLetters") + " " + I18N.get("exportTable.part.msd");
case MORPHOSYNTACTIC_PROPERTY: case MORPHOSYNTACTIC_PROPERTY:
return "Skupna vsota vseh najdenih črkovnih nizov oblikoskladenjskih lastnosti:"; return I18N.get("exportTable.part.totalFoundLetters") + " " + I18N.get("exportTable.part.msdProperty");
case WORD_TYPE: case WORD_TYPE:
return "Skupna vsota vseh najdenih črkovnih nizov besednih vrst:"; return I18N.get("exportTable.part.totalFoundLetters") + " " + I18N.get("exportTable.part.wordType");
case DIST_WORDS: case DIST_WORDS:
return "Skupna vsota vseh najdenih črkovnih nizov različnic:"; return I18N.get("exportTable.part.totalFoundLetters") + " " + I18N.get("exportTable.part.word");
case DIST_LEMMAS: case DIST_LEMMAS:
return "Skupna vsota vseh najdenih črkovnih nizov lem:"; return I18N.get("exportTable.part.totalFoundLetters") + " " + I18N.get("exportTable.part.lemma");
default: default:
return null; return null;
} }
} else if (ngram >= 1) { } else if (ngram >= 1) {
switch (this) { switch (this) {
case WORD: case WORD:
return "Skupna vsota vseh najdenih različnic:"; return I18N.get("exportTable.part.totalFound") + " " + I18N.get("exportTable.part.word");
case NORMALIZED_WORD: case NORMALIZED_WORD:
return "Skupna vsota vseh najdenih normaliziranih različnic:"; return I18N.get("exportTable.part.totalFound") + " " + I18N.get("exportTable.part.normalizedWord");
case LEMMA: case LEMMA:
return "Skupna vsota vseh najdenih lem:"; return I18N.get("exportTable.part.totalFound") + " " + I18N.get("exportTable.part.lemma");
case MORPHOSYNTACTIC_SPECS: case MORPHOSYNTACTIC_SPECS:
return "Skupna vsota vseh najdenih oblikoskladenjskih oznak:"; return I18N.get("exportTable.part.totalFound") + " " + I18N.get("exportTable.part.msd");
case MORPHOSYNTACTIC_PROPERTY: case MORPHOSYNTACTIC_PROPERTY:
return "Skupna vsota vseh najdenih oblikoskladenjskih lastnosti:"; return I18N.get("exportTable.part.totalFound") + " " + I18N.get("exportTable.part.msdProperty");
case WORD_TYPE: case WORD_TYPE:
return "Skupna vsota vseh najdenih besednih vrst:"; return I18N.get("exportTable.part.totalFound") + " " + I18N.get("exportTable.part.wordType");
case DIST_WORDS: case DIST_WORDS:
return "Skupna vsota vseh najdenih različnic:"; return I18N.get("exportTable.part.totalFound") + " " + I18N.get("exportTable.part.word");
case DIST_LEMMAS: case DIST_LEMMAS:
return "Skupna vsota vseh najdenih lem:"; return I18N.get("exportTable.part.totalFound") + " " + I18N.get("exportTable.part.lemma");
default: default:
return null; return null;
} }
@ -142,25 +163,25 @@ public enum CalculateFor {
public String totalAbsoluteFrequencyString(int ngram) { public String totalAbsoluteFrequencyString(int ngram) {
if (ngram == 0) { if (ngram == 0) {
return "Skupna absolutna pogostost črkovnega niza"; return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.letterSet");
} }
switch(this){ switch(this){
case WORD: case WORD:
return "Skupna absolutna pogostost različnice"; return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.word2");
case NORMALIZED_WORD: case NORMALIZED_WORD:
return "Skupna absolutna pogostost normalizirane različnice"; return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.normalizedWord2");
case LEMMA: case LEMMA:
return "Skupna absolutna pogostost leme"; return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.lemma2");
case MORPHOSYNTACTIC_SPECS: case MORPHOSYNTACTIC_SPECS:
return "Skupna absolutna pogostost oblikoskladenjske oznake"; return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.msd2");
case MORPHOSYNTACTIC_PROPERTY: case MORPHOSYNTACTIC_PROPERTY:
return "Skupna absolutna pogostost oblikoskladenjske lastnosti"; return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.msdProperty2");
case WORD_TYPE: case WORD_TYPE:
return "Skupna absolutna pogostost besedne vrste"; return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.wordType2");
case DIST_WORDS: case DIST_WORDS:
return "Skupna absolutna pogostost različnice"; return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.word2");
case DIST_LEMMAS: case DIST_LEMMAS:
return "Skupna absolutna pogostost leme"; return I18N.get("exportTable.part.absoluteFrequency") + " " + I18N.get("exportTable.part.lemma2");
default: default:
return null; return null;
} }
@ -168,25 +189,25 @@ public enum CalculateFor {
public String shareOfTotalString(int ngram) { public String shareOfTotalString(int ngram) {
if (ngram == 0) { if (ngram == 0) {
return "Delež glede na skupno vsoto vseh najdenih črkovnih nizov"; return I18N.get("exportTable.part.letterSet2");
} }
switch(this){ switch(this){
case WORD: case WORD:
return "Delež glede na vse najdene različnice"; return I18N.get("exportTable.part.share") + " " + I18N.get("exportTable.part.word2");
case NORMALIZED_WORD: case NORMALIZED_WORD:
return "Delež glede na vse najdene normalizirane različnice"; return I18N.get("exportTable.part.share") + " " + I18N.get("exportTable.part.normalizedWord2");
case LEMMA: case LEMMA:
return "Delež glede na vse najdene leme"; return I18N.get("exportTable.part.share") + " " + I18N.get("exportTable.part.lemma2");
case MORPHOSYNTACTIC_SPECS: case MORPHOSYNTACTIC_SPECS:
return "Delež glede na vse najdene oblikoskladenjske oznake"; return I18N.get("exportTable.part.share") + " " + I18N.get("exportTable.part.msd2");
case MORPHOSYNTACTIC_PROPERTY: case MORPHOSYNTACTIC_PROPERTY:
return "Delež glede na vse najdene oblikoskladenjske lastnosti"; return I18N.get("exportTable.part.share") + " " + I18N.get("exportTable.part.msdProperty2");
case WORD_TYPE: case WORD_TYPE:
return "Delež glede na vse najdene besedne vrste"; return I18N.get("exportTable.part.share") + " " + I18N.get("exportTable.part.wordType2");
case DIST_WORDS: case DIST_WORDS:
return "Delež glede na vse najdene različnice"; return I18N.get("exportTable.part.share") + " " + I18N.get("exportTable.part.word2");
case DIST_LEMMAS: case DIST_LEMMAS:
return "Delež glede na vse najdene leme"; return I18N.get("exportTable.part.share") + " " + I18N.get("exportTable.part.lemma2");
default: default:
return null; return null;
} }
@ -194,25 +215,23 @@ public enum CalculateFor {
public String toHeaderString(int ngram) { public String toHeaderString(int ngram) {
if (ngram == 0) { if (ngram == 0) {
return "Črkovni niz"; return I18N.get("exportTable.part.letterSet3");
} else if (ngram == 1) { } else if (ngram == 1) {
switch (this) { switch (this) {
case WORD: case WORD:
return "Različnica"; case DIST_WORDS:
return I18N.get("exportTable.part.word3");
case NORMALIZED_WORD: case NORMALIZED_WORD:
return "Normalizirana različnica"; return I18N.get("exportTable.part.normalizedWord3");
case LEMMA: case LEMMA:
return "Lema"; case DIST_LEMMAS:
return I18N.get("exportTable.part.lemma3");
case MORPHOSYNTACTIC_SPECS: case MORPHOSYNTACTIC_SPECS:
return "Oblikoskladenjska oznaka"; return I18N.get("exportTable.part.msd3");
case MORPHOSYNTACTIC_PROPERTY: case MORPHOSYNTACTIC_PROPERTY:
return "Oblikoskladenjska lastnost"; return I18N.get("exportTable.part.msdProperty3");
case WORD_TYPE: case WORD_TYPE:
return "Besedna vrsta"; return I18N.get("exportTable.part.wordType3");
case DIST_WORDS:
return "Različnica";
case DIST_LEMMAS:
return "Lema";
default: default:
return null; return null;
} }
@ -220,18 +239,18 @@ public enum CalculateFor {
switch (this) { switch (this) {
case WORD: case WORD:
case DIST_WORDS: case DIST_WORDS:
return "Različnica niza"; return I18N.get("exportTable.part.word3") + " " + I18N.get("exportTable.part.set");
case NORMALIZED_WORD: case NORMALIZED_WORD:
return "Normalizirana različnica niza"; return I18N.get("exportTable.part.normalizedWord3") + " " + I18N.get("exportTable.part.set");
case LEMMA: case LEMMA:
case DIST_LEMMAS: case DIST_LEMMAS:
return "Lema niza"; return I18N.get("exportTable.part.lemma3") + " " + I18N.get("exportTable.part.set");
case MORPHOSYNTACTIC_SPECS: case MORPHOSYNTACTIC_SPECS:
return "Oblikoskladenjska oznaka niza"; return I18N.get("exportTable.part.msd3") + " " + I18N.get("exportTable.part.set");
case MORPHOSYNTACTIC_PROPERTY: case MORPHOSYNTACTIC_PROPERTY:
return "Oblikoskladenjska lastnost niza"; return I18N.get("exportTable.part.msdProperty3") + " " + I18N.get("exportTable.part.set");
case WORD_TYPE: case WORD_TYPE:
return "Besedna vrsta niza"; return I18N.get("exportTable.part.wordType3") + " " + I18N.get("exportTable.part.set");
default: default:
return null; return null;
} }

@ -8,6 +8,7 @@ import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import gui.I18N;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -136,15 +137,15 @@ public class Corpus {
public boolean validate() { public boolean validate() {
if (corpusType == null) { if (corpusType == null) {
validationErrors.add(LABEL_RESULTS_CORPUS_TYPE_NOT_SET); validationErrors.add(I18N.get("message.LABEL_RESULTS_CORPUS_TYPE_NOT_SET"));
} }
if (chosenCorpusLocation == null) { if (chosenCorpusLocation == null) {
validationErrors.add(LABEL_CORPUS_LOCATION_NOT_SET); validationErrors.add(I18N.get("message.LABEL_CORPUS_LOCATION_NOT_SET"));
} }
if (chosenResultsLocation == null) { if (chosenResultsLocation == null) {
validationErrors.add(LABEL_RESULTS_LOCATION_NOT_SET); validationErrors.add(I18N.get("message.LABEL_RESULTS_LOCATION_NOT_SET"));
} }
if (!headerRead && corpusType != null) { if (!headerRead && corpusType != null) {

@ -12,6 +12,7 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import gui.I18N;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
@ -112,7 +113,7 @@ public class StatisticsNew {
if(ngramLevel == 0) { if(ngramLevel == 0) {
sb.append(corpus.getCorpusType().toString()) sb.append(corpus.getCorpusType().toString())
.append(separator) .append(separator)
.append("crke") .append(I18N.get("exportFileName.letters"))
.append(separator) .append(separator)
.append(filter.getCalculateFor()) .append(filter.getCalculateFor())
.append(separator); .append(separator);
@ -120,30 +121,30 @@ public class StatisticsNew {
if (filter.getSuffixLength() != null && filter.getSuffixList() != null && filter.getPrefixLength() != null && filter.getPrefixList() != null) { if (filter.getSuffixLength() != null && filter.getSuffixList() != null && filter.getPrefixLength() != null && filter.getPrefixList() != null) {
sb.append(corpus.getCorpusType().toString()) sb.append(corpus.getCorpusType().toString())
.append(separator) .append(separator)
.append("besedni-deli") .append(I18N.get("exportFileName.wordParts"))
.append(separator) .append(separator)
.append(filter.getCalculateFor()) .append(filter.getCalculateFor())
.append(separator); .append(separator);
} else { } else {
sb.append(corpus.getCorpusType().toString()) sb.append(corpus.getCorpusType().toString())
.append(separator) .append(separator)
.append("besede") .append(I18N.get("exportFileName.words"))
.append(separator) .append(separator)
.append(filter.getCalculateFor()) .append(filter.getCalculateFor())
.append(separator); .append(separator);
} }
} }
else { else {
sb.append(filter.getAl().toString()) sb.append(corpus.getCorpusType().toString())
.append(separator) .append(separator)
.append(corpus.getCorpusType().toString()) .append(I18N.get("exportFileName.wordSets"))
.append(separator); .append(separator);
sb.append(filter.getCalculateFor().toString()) sb.append(filter.getCalculateFor().toString())
.append(separator); .append(separator);
// ngram value // ngram value
sb.append(filter.getNgramValue()).append("-gram") sb.append(filter.getNgramValue()).append(I18N.get("exportFileName.gram"))
.append(separator); .append(separator);
sb.append(filter.getSkipValue()).append("-preskok") sb.append(filter.getSkipValue()).append(I18N.get("exportFileName.skip"))
.append(separator); .append(separator);
} }
// TODO: assure skip is not null but zero // TODO: assure skip is not null but zero
@ -229,6 +230,9 @@ public class StatisticsNew {
db.delete(); db.delete();
} }
removeMinimalOccurrences(filter.getMinimalOccurrences());
removeMinimalTaxonomy(taxonomyResult, filter.getMinimalTaxonomy());
// if no results and nothing to save, return false // if no results and nothing to save, return false
if (!(taxonomyResult.get(Taxonomy.TOTAL).size() > 0)) { if (!(taxonomyResult.get(Taxonomy.TOTAL).size() > 0)) {
analysisProducedResults = false; analysisProducedResults = false;
@ -237,8 +241,6 @@ public class StatisticsNew {
analysisProducedResults = true; analysisProducedResults = true;
} }
removeMinimalOccurrences(filter.getMinimalOccurrences());
removeMinimalTaxonomy(taxonomyResult, filter.getMinimalTaxonomy());
stats.add(ImmutablePair.of(resultTitle, getSortedResult(taxonomyResult.get(Taxonomy.TOTAL), Util.getValidInt(limit)))); stats.add(ImmutablePair.of(resultTitle, getSortedResult(taxonomyResult.get(Taxonomy.TOTAL), Util.getValidInt(limit))));
Export.SetToCSV(stats, corpus.getChosenResultsLocation(), headerInfoBlock(), this, filter); Export.SetToCSV(stats, corpus.getChosenResultsLocation(), headerInfoBlock(), this, filter);
return true; return true;
@ -465,40 +467,40 @@ public class StatisticsNew {
private LinkedHashMap<String, String> headerInfoBlock() { private LinkedHashMap<String, String> headerInfoBlock() {
LinkedHashMap<String, String> info = new LinkedHashMap<>(); LinkedHashMap<String, String> info = new LinkedHashMap<>();
info.put("Korpus:", corpus.getCorpusType().toString()); info.put(I18N.get("exportHeader.corpus"), corpus.getCorpusType().toString());
setTimeEnding(); setTimeEnding();
info.put("Datum:", timeEnding.format(DateTimeFormatter.ofPattern("dd.MM.yyyy hh:mm"))); info.put(I18N.get("exportHeader.date"), timeEnding.format(DateTimeFormatter.ofPattern("dd.MM.yyyy hh:mm")));
// time elapsed // time elapsed
long seconds = ChronoUnit.MILLIS.between(timeBeginning, timeEnding) / 1000; long seconds = ChronoUnit.MILLIS.between(timeBeginning, timeEnding) / 1000;
info.put("Čas izvajanja:", String.valueOf(seconds) + " s"); info.put(I18N.get("exportHeader.executionTime"), String.valueOf(seconds) + " s");
if (filter.getAl() == AnalysisLevel.STRING_LEVEL) { if (filter.getAl() == AnalysisLevel.STRING_LEVEL) {
Integer ngramLevel = filter.getNgramValue(); Integer ngramLevel = filter.getNgramValue();
if (ngramLevel == 0) if (ngramLevel == 0)
info.put("Analiza:", "črke"); info.put(I18N.get("exportHeader.analysis"), I18N.get("exportHeader.analysis.letters"));
else if (ngramLevel == 1) { else if (ngramLevel == 1) {
// if suffixes or prefixes are not null print word parts // if suffixes or prefixes are not null print word parts
if (filter.getSuffixLength() != null || filter.getSuffixList() != null || filter.getPrefixLength() != null || filter.getPrefixList() != null) { if (filter.getSuffixLength() != null || filter.getSuffixList() != null || filter.getPrefixLength() != null || filter.getPrefixList() != null) {
info.put("Analiza:", "besedni deli"); info.put(I18N.get("exportHeader.analysis"), I18N.get("exportHeader.analysis.wordParts"));
} else { } else {
info.put("Analiza:", "besede"); info.put(I18N.get("exportHeader.analysis"), I18N.get("exportHeader.analysis.words"));
} }
} else } else
info.put("Analiza:", filter.getAl().toString()); info.put(I18N.get("exportHeader.analysis"), I18N.get("exportHeader.analysis.wordSets"));
} else { } else {
info.put("Analiza:", filter.getAl().toString()); info.put(I18N.get("exportHeader.analysis"), filter.getAl().toString());
} }
// if (filter.getAl() == AnalysisLevel.STRING_LEVEL) { // if (filter.getAl() == AnalysisLevel.STRING_LEVEL) {
Integer ngramLevel = filter.getNgramValue(); Integer ngramLevel = filter.getNgramValue();
if (ngramLevel == 0){ if (ngramLevel == 0){
info.put("Število črk:", filter.getStringLength().toString()); info.put(I18N.get("exportHeader.numberLetters"), filter.getStringLength().toString());
} }
// calculate for // calculate for
info.put("Izračunaj za:", filter.getCalculateFor().toString()); info.put(I18N.get("exportHeader.calculateFor"), filter.getCalculateFor().toString());
// also write // also write
if (ngramLevel > 0) { if (ngramLevel > 0) {
@ -508,34 +510,34 @@ public class StatisticsNew {
for (CalculateFor s : filter.getMultipleKeys()) { for (CalculateFor s : filter.getMultipleKeys()) {
mk.append(s.toString()).append("; "); mk.append(s.toString()).append("; ");
} }
info.put("Upoštevaj tudi: ", String.join("; ", mk.substring(0, mk.length() - 2))); info.put(I18N.get("exportHeader.alsoFilter"), String.join("; ", mk.substring(0, mk.length() - 2)));
} else { } else {
info.put("Upoštevaj tudi: ", ""); info.put(I18N.get("exportHeader.alsoFilter"), "");
} }
} }
// data limitations // data limitations
if (filter.getDisplayTaxonomy()){ if (filter.getDisplayTaxonomy()){
info.put("Izpiši taksonomije: ", "da"); info.put(I18N.get("exportHeader.displayTaxonomies"), I18N.get("exportHeader.yes"));
} else { } else {
info.put("Izpiši taksonomije: ", "ne"); info.put(I18N.get("exportHeader.displayTaxonomies"), I18N.get("exportHeader.no"));
} }
// n.gram nivo // n.gram nivo
if (ngramLevel > 1) { if (ngramLevel > 1) {
info.put("N-gram nivo:", String.valueOf(ngramLevel)); info.put(I18N.get("exportHeader.ngramLevel"), String.valueOf(ngramLevel));
} }
// skip // skip
if (ngramLevel > 1) if (ngramLevel > 1)
info.put("Preskok besed:", isNotEmpty(filter.getSkipValue()) ? filter.getSkipValue().toString() : "0"); info.put(I18N.get("exportHeader.skipValue"), isNotEmpty(filter.getSkipValue()) ? filter.getSkipValue().toString() : "0");
// note punctuations - ngram > 1 // note punctuations - ngram > 1
if(ngramLevel > 1) { if(ngramLevel > 1) {
if (filter.getNotePunctuations()) { if (filter.getNotePunctuations()) {
info.put("Upoštevaj ločila: ", "da"); info.put(I18N.get("exportHeader.notePunctuations"), I18N.get("exportHeader.yes"));
} else { } else {
info.put("Upoštevaj ločila: ", "ne"); info.put(I18N.get("exportHeader.notePunctuations"), I18N.get("exportHeader.no"));
} }
} }
@ -546,28 +548,28 @@ public class StatisticsNew {
for (Collocability s : filter.getCollocability()) { for (Collocability s : filter.getCollocability()) {
mk.append(s.toString()).append("; "); mk.append(s.toString()).append("; ");
} }
info.put("Kolokabilnost: ", String.join("; ", mk.substring(0, mk.length() - 2))); info.put(I18N.get("exportHeader.collocability"), String.join("; ", mk.substring(0, mk.length() - 2)));
} else { } else {
info.put("Kolokabilnost: ", ""); info.put(I18N.get("exportHeader.collocability"), "");
} }
} }
// fragmented MSD - n-gram = 1 // fragmented MSD - n-gram = 1
if (info.get("Analiza:").equals("besede")){ if (info.get(I18N.get("exportHeader.analysis")).equals(I18N.get("exportHeader.analysis.words"))){
if (filter.getWriteMsdAtTheEnd()){ if (filter.getWriteMsdAtTheEnd()){
info.put("Izpiši razbit MSD: ", "da"); info.put(I18N.get("exportHeader.writeMSDAtTheEnd"), I18N.get("exportHeader.yes"));
} else { } else {
info.put("Izpiši razbit MSD: ", "ne"); info.put(I18N.get("exportHeader.writeMSDAtTheEnd"), I18N.get("exportHeader.no"));
} }
} }
if (filter.getSuffixLength() != null || filter.getSuffixList() != null || filter.getPrefixLength() != null || filter.getPrefixList() != null) { if (filter.getSuffixLength() != null || filter.getSuffixList() != null || filter.getPrefixLength() != null || filter.getPrefixList() != null) {
if (filter.getPrefixLength() > 0 || filter.getSuffixLength() > 0) { if (filter.getPrefixLength() > 0 || filter.getSuffixLength() > 0) {
info.put("Dolžina predpone: ", String.valueOf(filter.getPrefixLength())); info.put(I18N.get("exportHeader.prefixLength"), String.valueOf(filter.getPrefixLength()));
info.put("Dolžina pripone: ", String.valueOf(filter.getSuffixLength())); info.put(I18N.get("exportHeader.suffixLength"), String.valueOf(filter.getSuffixLength()));
} else { } else {
info.put("Seznam predpon: ", String.join("; ", filter.getPrefixList())); info.put(I18N.get("exportHeader.prefixList"), String.join("; ", filter.getPrefixList()));
info.put("Seznam pripon: ", String.join("; ", filter.getSuffixList())); info.put(I18N.get("exportHeader.suffixList"), String.join("; ", filter.getSuffixList()));
} }
} }
@ -578,15 +580,15 @@ public class StatisticsNew {
msdPattern.append(pattern.toString()).append(" "); msdPattern.append(pattern.toString()).append(" ");
} }
info.put("Oznaka MSD:", msdPattern.toString()); info.put(I18N.get("exportHeader.msd"), msdPattern.toString());
} else { } else {
info.put("Oznaka MSD:", ""); info.put(I18N.get("exportHeader.msd"), "");
} }
// } // }
info.put("Taksonomija: ", ""); info.put(I18N.get("exportHeader.taxonomy"), "");
if (isNotEmpty(filter.getTaxonomy()) && Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType()) || filter.getDisplayTaxonomy()) { if (isNotEmpty(filter.getTaxonomy()) && Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType()) || filter.getDisplayTaxonomy()) {
ArrayList<String> tax = Tax.getTaxonomyForInfo(corpus.getCorpusType(), filter.getTaxonomy()); ArrayList<String> tax = Tax.getTaxonomyForInfo(corpus.getCorpusType(), filter.getTaxonomy());
@ -631,14 +633,14 @@ public class StatisticsNew {
} }
info.put("Min. št. pojavitev: ", String.valueOf(filter.getMinimalOccurrences())); info.put(I18N.get("exportHeader.minOccurrences"), String.valueOf(filter.getMinimalOccurrences()));
info.put("Min. št. taksonomij: ", String.valueOf(filter.getMinimalTaxonomy())); info.put(I18N.get("exportHeader.minTaxonomies"), String.valueOf(filter.getMinimalTaxonomy()));
if (corpus.getCorpusType() == CorpusType.SOLAR) { if (corpus.getCorpusType() == CorpusType.SOLAR) {
HashMap<String, ObservableList<String>> filters = corpus.getSolarFilters(); HashMap<String, ObservableList<String>> filters = corpus.getSolarFilters();
if (!isEmpty(filters)) { if (!isEmpty(filters)) {
info.put("Dodatni filtri: ", ""); info.put(I18N.get("exportHeader.additionalFilters"), "");
for (Map.Entry<String, ObservableList<String>> f : filters.entrySet()) { for (Map.Entry<String, ObservableList<String>> f : filters.entrySet()) {
info.put(f.getKey(), StringUtils.join(f.getValue(), ", ")); info.put(f.getKey(), StringUtils.join(f.getValue(), ", "));

@ -5,6 +5,7 @@ import static gui.ValidationUtil.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import gui.I18N;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import gui.Messages; import gui.Messages;
@ -17,12 +18,12 @@ public class Validation {
// should not be null, error if null, because init failed // should not be null, error if null, because init failed
if (filter.getNgramValue() == null) { if (filter.getNgramValue() == null) {
errors.add(Messages.MISSING_NGRAM_LEVEL); errors.add(I18N.get("message.MISSING_NGRAM_LEVEL"));
} }
// should not be null, error if null, because init failed // should not be null, error if null, because init failed
if (filter.getCalculateFor() == null) { if (filter.getCalculateFor() == null) {
errors.add(Messages.MISSING_CALCULATE_FOR); errors.add(I18N.get("message.MISSING_CALCULATE_FOR"));
} }
if (filter.getSkipValue() == null) { if (filter.getSkipValue() == null) {
@ -32,20 +33,20 @@ public class Validation {
if (filter.getNgramValue() != null && ValidationUtil.isEmpty(filter.getMsd()) && if (filter.getNgramValue() != null && ValidationUtil.isEmpty(filter.getMsd()) &&
(filter.getMsd().size() != filter.getNgramValue())) { (filter.getMsd().size() != filter.getNgramValue())) {
if (!(filter.getMsd().size() == 1 && filter.getNgramValue() == 0) && !ValidationUtil.isEmpty(filter.getMsd())) if (!(filter.getMsd().size() == 1 && filter.getNgramValue() == 0) && !ValidationUtil.isEmpty(filter.getMsd()))
errors.add(Messages.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES); errors.add(I18N.get("message.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES"));
} }
Integer ngramValue = filter.getNgramValue(); Integer ngramValue = filter.getNgramValue();
ArrayList<Pattern> msd = filter.getMsd(); ArrayList<Pattern> msd = filter.getMsd();
if (ngramValue > 0 && !ValidationUtil.isEmpty(msd) && ngramValue != msd.size()) { if (ngramValue > 0 && !ValidationUtil.isEmpty(msd) && ngramValue != msd.size()) {
errors.add(String.format(Messages.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES, ngramValue, msd.size())); errors.add(String.format(I18N.get("message.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES"), ngramValue, msd.size()));
} }
if (filter.getNgramValue() != null && filter.getNgramValue() == 0 && isEmpty(filter.getStringLength())) { if (filter.getNgramValue() != null && filter.getNgramValue() == 0 && isEmpty(filter.getStringLength())) {
// if count letters, make sure that the length is given // if count letters, make sure that the length is given
// TODO: check that words we're adding in xml reader are longer than this value // TODO: check that words we're adding in xml reader are longer than this value
errors.add(Messages.MISSING_STRING_LENGTH); errors.add(I18N.get("message.MISSING_STRING_LENGTH"));
} }
return isEmpty(errors) ? null : StringUtils.join(errors, ", \n"); return isEmpty(errors) ? null : StringUtils.join(errors, ", \n");

@ -2,6 +2,7 @@ package gui;
import data.*; import data.*;
import javafx.application.HostServices; import javafx.application.HostServices;
import javafx.beans.binding.Bindings;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
@ -35,6 +36,31 @@ public class CharacterAnalysisTab {
@FXML @FXML
public Label selectedFiltersLabel; public Label selectedFiltersLabel;
@FXML
public Label stringLengthL;
@FXML
public Label calculateForL;
@FXML
public Label displayTaxonomyL;
@FXML
public Label dataLimitL;
@FXML
public Label msdL;
@FXML
public Label taxonomyL;
@FXML
public Label minimalOccurrencesL;
@FXML
public Label minimalTaxonomyL;
@FXML @FXML
public Label solarFilters; public Label solarFilters;
@ -90,6 +116,9 @@ public class CharacterAnalysisTab {
@FXML @FXML
private Button cancel; private Button cancel;
@FXML
private Button changeLanguageB;
@FXML @FXML
public ProgressBar ngramProgressBar; public ProgressBar ngramProgressBar;
@FXML @FXML
@ -109,8 +138,12 @@ public class CharacterAnalysisTab {
private Filter filter; private Filter filter;
private boolean useDb; private boolean useDb;
private HostServices hostService; private HostServices hostService;
private ListChangeListener<String> taxonomyListener;
private static final String [] N_GRAM_COMPUTE_FOR_LETTERS_ARRAY = {"calculateFor.WORD", "calculateFor.LEMMA"};
private static final ArrayList<String> N_GRAM_COMPUTE_FOR_LETTERS = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_LETTERS_ARRAY));
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("različnica", "lema"); // private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("različnica", "lema");
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = FXCollections.observableArrayList("različnica"); private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = FXCollections.observableArrayList("različnica");
@ -123,6 +156,8 @@ public class CharacterAnalysisTab {
characterAnalysisTab.getStylesheets().add("style.css"); characterAnalysisTab.getStylesheets().add("style.css");
characterAnalysisTab.getStyleClass().add("root"); characterAnalysisTab.getStyleClass().add("root");
manageTranslations();
currentMode = MODE.LETTER; currentMode = MODE.LETTER;
toggleMode(currentMode); toggleMode(currentMode);
@ -138,8 +173,13 @@ public class CharacterAnalysisTab {
// }); // });
calculateForCB.valueProperty().addListener((observable, oldValue, newValue) -> { calculateForCB.valueProperty().addListener((observable, oldValue, newValue) -> {
if(newValue == null){
newValue = I18N.getTranslatedValue(oldValue, N_GRAM_COMPUTE_FOR_LETTERS);
calculateForCB.getSelectionModel().select(newValue);
}
// System.out.println(oldValue);
// System.out.println(newValue);
calculateFor = CalculateFor.factory(newValue); calculateFor = CalculateFor.factory(newValue);
logger.info("calculateForCB:", calculateFor.toString()); logger.info("calculateForCB:", calculateFor.toString());
}); });
@ -157,7 +197,7 @@ public class CharacterAnalysisTab {
int nOfRequiredMsdTokens = 1; int nOfRequiredMsdTokens = 1;
if (msdTmp.size() != nOfRequiredMsdTokens) { if (msdTmp.size() != nOfRequiredMsdTokens) {
String msg = String.format(Messages.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES, nOfRequiredMsdTokens, msdTmp.size()); String msg = String.format(I18N.get("message.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES"), nOfRequiredMsdTokens, msdTmp.size());
logAlert(msg); logAlert(msg);
showAlert(Alert.AlertType.ERROR, msg); showAlert(Alert.AlertType.ERROR, msg);
} }
@ -181,10 +221,11 @@ public class CharacterAnalysisTab {
// taxonomy // taxonomy
if (Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType())) { if (Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType())) {
taxonomyCCB.setDisable(false); if (taxonomyListener != null){
taxonomyCCB.getItems().removeAll(); taxonomyCCB.getCheckModel().getCheckedItems().removeListener(taxonomyListener);
taxonomyCCB.getItems().setAll(corpus.getTaxonomy()); }
taxonomyCCB.getCheckModel().getCheckedItems().addListener(new ListChangeListener<String>() {
taxonomyListener = new ListChangeListener<String>() {
boolean changing = true; boolean changing = true;
@Override @Override
@ -211,8 +252,13 @@ public class CharacterAnalysisTab {
logger.info(String.format("Selected taxonomy: %s", StringUtils.join(checkedItems, ","))); logger.info(String.format("Selected taxonomy: %s", StringUtils.join(checkedItems, ",")));
} }
} }
}); };
taxonomyCCB.getCheckModel().clearChecks(); taxonomyCCB.getCheckModel().clearChecks();
taxonomyCCB.setDisable(false);
taxonomyCCB.getItems().removeAll();
taxonomyCCB.getItems().setAll(corpus.getTaxonomy());
taxonomyCCB.getCheckModel().getCheckedItems().addListener(taxonomyListener);
} else { } else {
taxonomyCCB.setDisable(true); taxonomyCCB.setDisable(true);
} }
@ -235,7 +281,7 @@ public class CharacterAnalysisTab {
logger.info("display taxonomy: ", displayTaxonomy); logger.info("display taxonomy: ", displayTaxonomy);
}); });
displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB)); displayTaxonomyChB.setTooltip(new Tooltip(I18N.get("message.TOOLTIP_readDisplayTaxonomyChB")));
} else { } else {
displayTaxonomyChB.setDisable(true); displayTaxonomyChB.setDisable(true);
} }
@ -254,14 +300,14 @@ public class CharacterAnalysisTab {
String value = stringLengthTF.getText(); String value = stringLengthTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("stringlengthTf: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("stringlengthTf: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} }
stringLength = Integer.parseInt(value); stringLength = Integer.parseInt(value);
} else { } else {
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_MISSING_STRING_LENGTH); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_MISSING_STRING_LENGTH"));
stringLengthTF.setText("1"); stringLengthTF.setText("1");
logAlert(WARNING_MISSING_STRING_LENGTH); logAlert(I18N.get("message.WARNING_MISSING_STRING_LENGTH"));
} }
} }
}); });
@ -281,8 +327,8 @@ public class CharacterAnalysisTab {
String value = minimalOccurrencesTF.getText(); String value = minimalOccurrencesTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("minimalOccurrencesTF: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("minimalOccurrencesTF: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} else { } else {
minimalOccurrences = Integer.parseInt(value); minimalOccurrences = Integer.parseInt(value);
} }
@ -299,8 +345,8 @@ public class CharacterAnalysisTab {
String value = minimalTaxonomyTF.getText(); String value = minimalTaxonomyTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("minimalTaxonomyTF: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("minimalTaxonomyTF: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} else { } else {
minimalTaxonomy = Integer.parseInt(value); minimalTaxonomy = Integer.parseInt(value);
} }
@ -316,7 +362,19 @@ public class CharacterAnalysisTab {
logger.info("compute button"); logger.info("compute button");
}); });
helpH.setOnAction(e -> openHelpWebsite()); changeLanguageB.setOnAction(e -> {
if (I18N.getLocale() == new Locale.Builder().setLanguage("sl").setRegion("SI").build()){
I18N.setLocale(Locale.ENGLISH);
} else {
I18N.setLocale(new Locale.Builder().setLanguage("sl").setRegion("SI").build());
}
Messages.reload();
Messages.updateChooseCorpusL();
logger.info("change language");
});
helpH.setOnAction(e -> openHelpWebsite());
cancel.setVisible(false); cancel.setVisible(false);
} }
@ -412,6 +470,27 @@ public class CharacterAnalysisTab {
// //
// } // }
private void manageTranslations(){
helpH.textProperty().bind(I18N.createStringBinding("hyperlink.help"));
changeLanguageB.textProperty().bind(I18N.createStringBinding("button.language"));
computeNgramsB.textProperty().bind(I18N.createStringBinding("button.computeNgrams"));
cancel.textProperty().bind(I18N.createStringBinding("button.cancel"));
stringLengthL.textProperty().bind(I18N.createStringBinding("label.stringLength"));
calculateForL.textProperty().bind(I18N.createStringBinding("label.calculateFor"));
displayTaxonomyL.textProperty().bind(I18N.createStringBinding("label.displayTaxonomy"));
dataLimitL.textProperty().bind(I18N.createStringBinding("label.dataLimit"));
msdL.textProperty().bind(I18N.createStringBinding("label.msd"));
taxonomyL.textProperty().bind(I18N.createStringBinding("label.taxonomy"));
minimalOccurrencesL.textProperty().bind(I18N.createStringBinding("label.minimalOccurrences"));
minimalTaxonomyL.textProperty().bind(I18N.createStringBinding("label.minimalTaxonomy"));
solarFilters.textProperty().bind(I18N.createStringBinding("label.solarFilters"));
calculateForCB.itemsProperty().bind(I18N.createObjectBinding(N_GRAM_COMPUTE_FOR_LETTERS));
}
/** /**
* Toggles visibility for panes which hold fields for skipgram value (not applicable when calculating for letters) etc., * Toggles visibility for panes which hold fields for skipgram value (not applicable when calculating for letters) etc.,
* sets combobox values to what is applicable ... * sets combobox values to what is applicable ...
@ -533,11 +612,11 @@ public class CharacterAnalysisTab {
readXML(f.toString(), statistic); readXML(f.toString(), statistic);
i++; i++;
if (isCancelled()) { if (isCancelled()) {
updateMessage(CANCELING_NOTIFICATION); updateMessage(I18N.get("message.CANCELING_NOTIFICATION"));
break; break;
} }
this.updateProgress(i, corpusFiles.size()); this.updateProgress(i, corpusFiles.size());
this.updateMessage(String.format(ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y, i, corpusFiles.size(), f.getName())); this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName()));
} }
return null; return null;
@ -551,12 +630,12 @@ public class CharacterAnalysisTab {
try { try {
boolean successullySaved = statistic.saveResultToDisk(); boolean successullySaved = statistic.saveResultToDisk();
if (successullySaved) { if (successullySaved) {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED"));
} else { } else {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS"));
} }
} catch (UnsupportedEncodingException e1) { } catch (UnsupportedEncodingException e1) {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_SAVING_RESULTS_TO_CSV); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_SAVING_RESULTS_TO_CSV"));
logger.error("Error while saving", e1); logger.error("Error while saving", e1);
} }
@ -568,7 +647,7 @@ public class CharacterAnalysisTab {
}); });
task.setOnFailed(e -> { task.setOnFailed(e -> {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_EXECUTING); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_EXECUTING"));
logger.error("Error while executing", e); logger.error("Error while executing", e);
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
ngramProgressBar.setProgress(0.0); ngramProgressBar.setProgress(0.0);
@ -579,7 +658,7 @@ public class CharacterAnalysisTab {
}); });
task.setOnCancelled(e -> { task.setOnCancelled(e -> {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_CANCLED); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_CANCELED"));
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
ngramProgressBar.setProgress(0.0); ngramProgressBar.setProgress(0.0);
ngramProgressBar.setStyle(Settings.FX_ACCENT_OK); ngramProgressBar.setStyle(Settings.FX_ACCENT_OK);

@ -6,10 +6,7 @@ import static gui.Messages.*;
import static util.Util.*; import static util.Util.*;
import java.io.File; import java.io.File;
import java.util.Collection; import java.util.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
@ -57,6 +54,9 @@ public class CorpusTab {
@FXML @FXML
private Button chooseResultsLocationB; private Button chooseResultsLocationB;
@FXML
private Button changeLanguageB;
@FXML @FXML
private Label chooseCorpusL; private Label chooseCorpusL;
private String chooseCorpusLabelContent; private String chooseCorpusLabelContent;
@ -91,6 +91,9 @@ public class CorpusTab {
private WordLevelTab wlController; private WordLevelTab wlController;
private HostServices hostService; private HostServices hostService;
private String corpusLocation;
private String corpusFilesSize;
public void initialize() { public void initialize() {
// add CSS style // add CSS style
@ -99,16 +102,18 @@ public class CorpusTab {
stage = new Stage(); stage = new Stage();
manageTranslations();
// add listeners // add listeners
chooseCorpusLocationB.setOnAction(e -> chooseCorpusLocation()); chooseCorpusLocationB.setOnAction(e -> chooseCorpusLocation());
chooseCorpusLocationB.setTooltip(new Tooltip(TOOLTIP_chooseCorpusLocationB)); chooseCorpusLocationB.setTooltip(new Tooltip(I18N.get("message.TOOLTIP_chooseCorpusLocationB")));
helpH.setOnAction(e -> openHelpWebsite()); helpH.setOnAction(e -> openHelpWebsite());
readHeaderInfoChB.selectedProperty().addListener((observable, oldValue, newValue) -> { readHeaderInfoChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
readHeaderInfo = newValue; readHeaderInfo = newValue;
logger.info("read headers: ", readHeaderInfo); logger.info("read headers: ", readHeaderInfo);
}); });
readHeaderInfoChB.setTooltip(new Tooltip(TOOLTIP_readHeaderInfoChB)); readHeaderInfoChB.setTooltip(new Tooltip(I18N.get("message.TOOLTIP_readHeaderInfoChB")));
// gosUseOrthChB.selectedProperty().addListener((observable, oldValue, newValue) -> { // gosUseOrthChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
// gosUseOrth = newValue; // gosUseOrth = newValue;
@ -123,18 +128,52 @@ public class CorpusTab {
chooseResultsLocationB.setOnAction(e -> chooseResultsLocation(null)); chooseResultsLocationB.setOnAction(e -> chooseResultsLocation(null));
changeLanguageB.setOnAction(e -> {
if (I18N.getLocale() == new Locale.Builder().setLanguage("sl").setRegion("SI").build()){
I18N.setLocale(Locale.ENGLISH);
} else {
I18N.setLocale(new Locale.Builder().setLanguage("sl").setRegion("SI").build());
}
Messages.reload();
// StringBuilder sb = new StringBuilder();
// sb.append(corpusLocation)
// .append("\n")
// .append(String.format(I18N.get("message.NOTIFICATION_FOUND_X_FILES"), corpusFilesSize))
// .append("\n")
// .append(String.format(I18N.get("message.NOTIFICATION_CORPUS"), corpusType.toString()));
//
// chooseCorpusLabelContent = sb.toString();
// chooseCorpusL.textProperty().unbind();
// chooseCorpusL.setText(chooseCorpusLabelContent);
Messages.updateChooseCorpusL();
logger.info("change language");
});
// set labels and toggle visibility // set labels and toggle visibility
// toggleGosChBVisibility(); // toggleGosChBVisibility();
chooseCorpusLabelContent = Messages.LABEL_CORPUS_LOCATION_NOT_SET; // chooseCorpusLabelContent = Messages.LABEL_CORPUS_LOCATION_NOT_SET;
chooseCorpusL.setText(chooseCorpusLabelContent); // chooseCorpusL.setText(chooseCorpusLabelContent);
//
chooseResultsLabelContent = Messages.LABEL_RESULTS_LOCATION_NOT_SET; // chooseResultsLabelContent = Messages.LABEL_RESULTS_LOCATION_NOT_SET;
chooseResultsL.setText(chooseResultsLabelContent); // chooseResultsL.setText(chooseResultsLabelContent);
togglePiAndSetCorpusWrapper(false); togglePiAndSetCorpusWrapper(false);
} }
private void manageTranslations(){
chooseCorpusLocationB.textProperty().bind(I18N.createStringBinding("button.setCorpusLocation"));
readHeaderInfoChB.textProperty().bind(I18N.createStringBinding("checkBox.readHeaderInfo"));
chooseResultsLocationB.textProperty().bind(I18N.createStringBinding("button.chooseResultsLocation"));
helpH.textProperty().bind(I18N.createStringBinding("hyperlink.help"));
changeLanguageB.textProperty().bind(I18N.createStringBinding("button.language"));
chooseCorpusL.textProperty().bind(I18N.createStringBinding("message.LABEL_CORPUS_LOCATION_NOT_SET"));
chooseResultsL.textProperty().bind(I18N.createStringBinding("message.LABEL_RESULTS_LOCATION_NOT_SET"));
}
private void togglePiAndSetCorpusWrapper(boolean piIsActive) { private void togglePiAndSetCorpusWrapper(boolean piIsActive) {
locationScanPI.setVisible(piIsActive); locationScanPI.setVisible(piIsActive);
setCorpusWrapperP.setLayoutX(piIsActive ? 100.0 : 10.0); setCorpusWrapperP.setLayoutX(piIsActive ? 100.0 : 10.0);
@ -166,18 +205,23 @@ public class CorpusTab {
// scan for xml files // scan for xml files
Collection<File> corpusFiles = FileUtils.listFiles(selectedDirectory, FileFilterUtils.suffixFileFilter("xml", IOCase.INSENSITIVE), TrueFileFilter.INSTANCE); Collection<File> corpusFiles = FileUtils.listFiles(selectedDirectory, FileFilterUtils.suffixFileFilter("xml", IOCase.INSENSITIVE), TrueFileFilter.INSTANCE);
corpusLocation = selectedDirectory.getAbsolutePath();
corpusFilesSize = String.valueOf(corpusFiles.size());
Messages.setChooseCorpusProperties(corpusLocation, corpusFilesSize, corpusType != null ? corpusType.toString() : null);
// make sure there are corpus files in selected directory or notify the user about it // make sure there are corpus files in selected directory or notify the user about it
if (corpusFiles.size() == 0) { if (corpusFiles.size() == 0) {
logger.info("alert: ", WARNING_CORPUS_NOT_FOUND); logger.info("alert: ", I18N.get("message.WARNING_CORPUS_NOT_FOUND"));
showAlert(Alert.AlertType.ERROR, WARNING_CORPUS_NOT_FOUND, null); showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_CORPUS_NOT_FOUND"), null);
} else { } else {
String chooseCorpusLabelContentTmp = detectCorpusType(corpusFiles, selectedDirectory.getAbsolutePath()); String chooseCorpusLabelContentTmp = detectCorpusType(corpusFiles);
if (chooseCorpusLabelContentTmp == null) { if (chooseCorpusLabelContentTmp == null) {
logger.info("alert: ", WARNING_CORPUS_NOT_FOUND); logger.info("alert: ", I18N.get("message.WARNING_CORPUS_NOT_FOUND"));
showAlert(Alert.AlertType.ERROR, WARNING_CORPUS_NOT_FOUND, null); showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_CORPUS_NOT_FOUND"), null);
} else { } else {
initNewCorpus(selectedDirectory, corpusFiles); initNewCorpus(selectedDirectory, corpusFiles);
Messages.setChooseCorpusProperties(corpusLocation, corpusFilesSize, corpusType.toString());
corpus.setChosenCorpusLocation(selectedDirectory); corpus.setChosenCorpusLocation(selectedDirectory);
corpus.setDetectedCorpusFiles(corpusFiles); corpus.setDetectedCorpusFiles(corpusFiles);
@ -221,11 +265,12 @@ public class CorpusTab {
File chosenResultsLocationTmp = new File(resultsLocationPath); File chosenResultsLocationTmp = new File(resultsLocationPath);
if (!ValidationUtil.isValidDirectory(chosenResultsLocationTmp)) { if (!ValidationUtil.isValidDirectory(chosenResultsLocationTmp)) {
showAlert(Alert.AlertType.ERROR, WARNING_RESULTS_DIR_NOT_VALID); showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_RESULTS_DIR_NOT_VALID"));
logger.info("alert: ", WARNING_RESULTS_DIR_NOT_VALID); logger.info("alert: ", I18N.get("message.WARNING_RESULTS_DIR_NOT_VALID"));
} else { } else {
corpus.setChosenResultsLocation(chosenResultsLocationTmp); corpus.setChosenResultsLocation(chosenResultsLocationTmp);
chooseResultsLabelContent = corpus.getChosenResultsLocation().getAbsolutePath(); chooseResultsLabelContent = corpus.getChosenResultsLocation().getAbsolutePath();
chooseResultsL.textProperty().unbind();
chooseResultsL.setText(chooseResultsLabelContent); chooseResultsL.setText(chooseResultsLabelContent);
logger.info("results dir: " + chooseResultsLabelContent); logger.info("results dir: " + chooseResultsLabelContent);
} }
@ -241,14 +286,15 @@ public class CorpusTab {
String defaultResultsLocationPath = corpus.getChosenCorpusLocation().getAbsolutePath(); String defaultResultsLocationPath = corpus.getChosenCorpusLocation().getAbsolutePath();
logger.info("setting default results location to: ", defaultResultsLocationPath); logger.info("setting default results location to: ", defaultResultsLocationPath);
chooseCorpusL.setText(chooseCorpusLabelContent); Messages.setChooseCorpusL(chooseCorpusL, chooseCorpusLabelContent);
} }
private void readHeaderInfo() { private void readHeaderInfo() {
CorpusType corpusType = corpus.getCorpusType(); CorpusType corpusType = corpus.getCorpusType();
Collection<File> corpusFiles = corpus.getDetectedCorpusFiles(); Collection<File> corpusFiles = corpus.getDetectedCorpusFiles();
togglePiAndSetCorpusWrapper(true); togglePiAndSetCorpusWrapper(true);
chooseCorpusL.setText(LABEL_SCANNING_CORPUS); chooseCorpusL.textProperty().unbind();
chooseCorpusL.setText(I18N.get("message.LABEL_SCANNING_CORPUS"));
logger.info("reading header data for ", corpusType.toString()); logger.info("reading header data for ", corpusType.toString());
@ -270,6 +316,8 @@ public class CorpusTab {
i++; i++;
if (corpusIsSplit) { if (corpusIsSplit) {
// System.out.println(i);
// System.out.println(corpusFiles.size());
updateProgress(i, corpusFiles.size()); updateProgress(i, corpusFiles.size());
} }
} }
@ -287,12 +335,12 @@ public class CorpusTab {
if (ValidationUtil.isEmpty(readTaxonomy)) { if (ValidationUtil.isEmpty(readTaxonomy)) {
// if no taxonomy found alert the user and keep other tabs disabled // if no taxonomy found alert the user and keep other tabs disabled
logger.info("No taxonomy found in headers."); logger.info("No taxonomy found in headers.");
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_NO_TAXONOMY_FOUND); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_NO_TAXONOMY_FOUND"));
} else { } else {
// set taxonomy, update label // set taxonomy, update label
corpus.setTaxonomy(readTaxonomy); corpus.setTaxonomy(readTaxonomy);
corpus.setHeaderRead(true); corpus.setHeaderRead(true);
chooseCorpusL.setText(chooseCorpusLabelContent); Messages.setChooseCorpusL(chooseCorpusL, chooseCorpusLabelContent);
setResults(); setResults();
setCorpusForAnalysis(); setCorpusForAnalysis();
} }
@ -353,14 +401,14 @@ public class CorpusTab {
if (ValidationUtil.isEmpty(values)) { if (ValidationUtil.isEmpty(values)) {
// if no taxonomy found alert the user and keep other tabs disabled // if no taxonomy found alert the user and keep other tabs disabled
logger.info("No solar filters found in headers."); logger.info("No solar filters found in headers.");
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_NO_SOLAR_FILTERS_FOUND); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_NO_SOLAR_FILTERS_FOUND"));
} else { } else {
HashMap<String, ObservableList<String>> filtersForComboBoxes = SolarFilters.getFiltersForComboBoxes(values); HashMap<String, ObservableList<String>> filtersForComboBoxes = SolarFilters.getFiltersForComboBoxes(values);
// set taxonomy, update label // set taxonomy, update label
corpus.setSolarFiltersForXML(values); corpus.setSolarFiltersForXML(values);
corpus.setSolarFilters(filtersForComboBoxes); corpus.setSolarFilters(filtersForComboBoxes);
corpus.setHeaderRead(true); corpus.setHeaderRead(true);
chooseCorpusL.setText(chooseCorpusLabelContent); Messages.setChooseCorpusL(chooseCorpusL, chooseCorpusLabelContent);
setResults(); setResults();
setCorpusForAnalysis(); setCorpusForAnalysis();
} }
@ -432,7 +480,7 @@ public class CorpusTab {
// gosUseOrthChB.setVisible(corpus != null && corpus.getCorpusType() != null && corpus.getCorpusType() == CorpusType.GOS); // gosUseOrthChB.setVisible(corpus != null && corpus.getCorpusType() != null && corpus.getCorpusType() == CorpusType.GOS);
// } // }
private String detectCorpusType(Collection<File> corpusFiles, String corpusLocation) { private String detectCorpusType(Collection<File> corpusFiles) {
// check that we recognize this corpus // check that we recognize this corpus
// read first file only, maybe later do all, if toll on resources is acceptable // read first file only, maybe later do all, if toll on resources is acceptable
File f = corpusFiles.iterator().next(); File f = corpusFiles.iterator().next();
@ -460,12 +508,14 @@ public class CorpusTab {
} else { } else {
corpus.setCorpusType(corpusType); corpus.setCorpusType(corpusType);
Messages.setChooseCorpusProperties(corpusLocation, corpusFilesSize, corpusType.toString());
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(corpusLocation) sb.append(corpusLocation)
.append("\n") .append("\n")
.append(String.format(NOTIFICATION_FOUND_X_FILES, corpusFiles.size())) .append(String.format(I18N.get("message.NOTIFICATION_FOUND_X_FILES"), corpusFiles.size()))
.append("\n") .append("\n")
.append(String.format("Korpus: %s", corpusType.toString())); .append(String.format(I18N.get("message.NOTIFICATION_CORPUS"), corpusType.toString()));
String result = sb.toString(); String result = sb.toString();

@ -2,6 +2,7 @@ package gui;
import java.io.IOException; import java.io.IOException;
import javafx.beans.binding.StringBinding;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -82,9 +83,25 @@ public class GUIController extends Application {
@Override @Override
public void start(Stage primaryStage) throws IOException { public void start(Stage primaryStage) throws IOException {
// File fileDir = new File("message_sl_unicode.properties");
//
// BufferedReader in = new BufferedReader(
// new InputStreamReader(
// new FileInputStream(fileDir), "UTF8"));
//
// String str;
//
// while ((str = in.readLine()) != null) {
// System.out.println(str);
// }
//
// in.close();
Parent root = FXMLLoader.load(getClass().getResource("/GUI.fxml")); Parent root = FXMLLoader.load(getClass().getResource("/GUI.fxml"));
// Parent root = FXMLLoader.load(ResourceLookup.resources.url("GUI.fxml")); // Parent root = FXMLLoader.load(ResourceLookup.resources.url("GUI.fxml"));
primaryStage.setTitle("GUI"); // primaryStage.setTitle("Luščilnik");
// StringBinding a = I18N.createStringBinding("window.title");
primaryStage.titleProperty().bind(I18N.createStringBinding("window.title"));
Scene scene = new Scene(root, 800, 600); Scene scene = new Scene(root, 800, 600);
// https://github.com/dicolar/jbootx // https://github.com/dicolar/jbootx
// scene.getStylesheets().add(GUIController.class.getResource("bootstrap3.css").toExternalForm()) // scene.getStylesheets().add(GUIController.class.getResource("bootstrap3.css").toExternalForm())
@ -103,6 +120,8 @@ public class GUIController extends Application {
gui.getStyleClass().add("root"); gui.getStyleClass().add("root");
corpus = new Corpus(); corpus = new Corpus();
manageTranslations();
ctController.setCorpus(corpus); ctController.setCorpus(corpus);
ctController.setFilterTab(filterTab); ctController.setFilterTab(filterTab);
ctController.setStringLevelTabNew2(StringLevelTabNew2); ctController.setStringLevelTabNew2(StringLevelTabNew2);
@ -146,6 +165,15 @@ public class GUIController extends Application {
tabPane.getTabs().removeAll(filterTab); tabPane.getTabs().removeAll(filterTab);
} }
private void manageTranslations(){
corpusTab.textProperty().bind(I18N.createStringBinding("tab.corpusTab"));
filterTab.textProperty().bind(I18N.createStringBinding("tab.filterTab"));
CharacterLevelTabNew.textProperty().bind(I18N.createStringBinding("tab.characterLevelTabNew"));
wordLevelTab.textProperty().bind(I18N.createStringBinding("tab.wordLevelTab"));
OneWordAnalysisTab.textProperty().bind(I18N.createStringBinding("tab.oneWordAnalysisTab"));
StringLevelTabNew2.textProperty().bind(I18N.createStringBinding("tab.stringLevelTabNew2"));
}
static void showAlert(Alert.AlertType alertType, String headerText, String contentText) { static void showAlert(Alert.AlertType alertType, String headerText, String contentText) {
Alert alert = new Alert(alertType); Alert alert = new Alert(alertType);
alert.setTitle(Messages.windowTitles.get(alertType)); alert.setTitle(Messages.windowTitles.get(alertType));

@ -0,0 +1,230 @@
package gui;
import com.sun.javafx.collections.ObservableListWrapper;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.ObjectBinding;
import javafx.beans.binding.StringBinding;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;
import java.io.UnsupportedEncodingException;
import java.text.MessageFormat;
import java.util.*;
import java.util.concurrent.Callable;
public final class I18N {
private static final ObjectProperty<Locale> locale;
static {
locale = new SimpleObjectProperty<>(getDefaultLocale());
locale.addListener((observable, oldValue, newValue) -> Locale.setDefault(newValue));
}
/**
* get the supported Locales.
*
* @return List of Locale objects.
*/
public static List<Locale> getSupportedLocales() {
return new ArrayList<>(Arrays.asList(new Locale.Builder().setLanguage("sl").setRegion("SI").build(), Locale.ENGLISH));
}
/**
* get the default locale. This is the systems default if contained in the supported locales, english otherwise.
*
* @return
*/
public static Locale getDefaultLocale() {
Locale sysDefault = Locale.getDefault();
return getSupportedLocales().contains(sysDefault) ? sysDefault : new Locale.Builder().setLanguage("sl").setRegion("SI").build();
}
public static Locale getLocale() {
return locale.get();
}
public static void setLocale(Locale locale) {
localeProperty().set(locale);
Locale.setDefault(locale);
}
public static ObjectProperty<Locale> localeProperty() {
return locale;
}
/**
* gets the string with the given key from the resource bundle for the current locale and uses it as first argument
* to MessageFormat.format, passing in the optional args and returning the result.
*
* @param key
* message key
* @param args
* optional arguments for the message
* @return localized formatted string
*/
public static String get(final String key, final Object... args) {
ResourceBundle bundle = ResourceBundle.getBundle("message", getLocale());
String val = bundle.getString(key);
try {
return MessageFormat.format(new String(val.getBytes("ISO-8859-1"), "UTF-8"), args);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return val;
// return MessageFormat.format(bundle.getString(key), args);
}
public static ObservableList<String> getObject(final ArrayList<String> keys, final Object... args) {
ResourceBundle bundle = ResourceBundle.getBundle("message", getLocale());
ArrayList<String> results = new ArrayList<>();
for(String key : keys){
String val = bundle.getString(key);
try {
results.add(MessageFormat.format(new String(val.getBytes("ISO-8859-1"), "UTF-8"), args));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return FXCollections.observableArrayList(results);
}
/**
* creates a String binding to a localized String for the given message bundle key
*
* @param key
* key
* @return String binding
*/
public static StringBinding createStringBinding(final String key, Object... args) {
return Bindings.createStringBinding(() -> get(key, args), locale);
}
// public static ObservableValue<ObservableList<String>> createListStringBinding(final String key, Object... args) {
// ObservableList<StringBinding> r = (ObservableList<StringBinding>) new ArrayList<StringBinding>();
// r.add(Bindings.createStringBinding(() -> get(key, args), locale));
// return r;
// }
/**
* creates a Object Binding to a localized Object that is computed by calling the given func
*
* @param func
* function called on every change
* @return StringBinding
*/
public static StringBinding createStringBinding(Callable<String> func) {
return Bindings.createStringBinding(func, locale);
}
/**
* creates a String binding to a localized String for the given message bundle key
*
* @param keys
* key
* @return ObjectBinding
*/
public static ObjectBinding createObjectBinding(final ArrayList<String> keys, Object... args) {
return Bindings.createObjectBinding(() -> getObject(keys, args), locale);
}
// public static ObservableValue<ObservableList<String>> createListStringBinding(final String key, Object... args) {
// ObservableList<StringBinding> r = (ObservableList<StringBinding>) new ArrayList<StringBinding>();
// r.add(Bindings.createStringBinding(() -> get(key, args), locale));
// return r;
// }
/**
* creates a String Binding to a localized String that is computed by calling the given func
*
* @param func
* function called on every change
* @return ObjectBinding
*/
public static ObjectBinding createObjectBinding(Callable<String> func) {
return Bindings.createObjectBinding(func, locale);
}
public static String getIndependent(final String key, Locale locale, final Object... args) {
ResourceBundle bundle = ResourceBundle.getBundle("message", locale);
String val = bundle.getString(key);
try {
return MessageFormat.format(new String(val.getBytes("ISO-8859-1"), "UTF-8"), args);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return val;
// return MessageFormat.format(bundle.getString(key), args);
}
public static String getTranslatedValue(String oldValue, ArrayList<String> nGramComputeForLetters) {
Locale loc;
if(getLocale().equals(Locale.ENGLISH)) {
loc = new Locale.Builder().setLanguage("sl").setRegion("SI").build();
} else {
loc = Locale.ENGLISH;
}
for (String el : nGramComputeForLetters){
if (oldValue.equals(getIndependent(el, loc))){
return get(el);
}
}
// in case translated language doesn't contain specified word, try original language
for (String el : nGramComputeForLetters){
if (oldValue.equals(get(el))){
return get(el);
}
}
return null;
}
/**
* Returns translated FXCollection
*
* @param words
* function called on every change
* @return ObjectBinding
*/
public static ObservableList<String> translatedObservableList(ArrayList<String> words){
ArrayList<String> translatedWords = new ArrayList<>();
for (String word : words){
translatedWords.add(get(word));
}
return FXCollections.observableArrayList(translatedWords);
}
/**
* DUPLICATE OF toString()
* searches for possible values in translations and returns key of the string
* == .toString()
*
* @param w, prefix
* function called on every change
* @return ObjectBinding
*/
public static String findI18NString(String w, String prefix){
ResourceBundle bundle = ResourceBundle.getBundle("message", getLocale());
for (String key : bundle.keySet()){
if(prefix.length() > key.length() || !key.substring(0, prefix.length()).equals(prefix)){
continue;
}
String val = bundle.getString(key);
try {
String newVal = new String(val.getBytes("ISO-8859-1"), "UTF-8");
if (newVal.equals(w)){
return key;
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return null;
}
}

@ -5,62 +5,65 @@ import static javafx.scene.control.Alert.AlertType.*;
import java.util.HashMap; import java.util.HashMap;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.Label;
public class Messages { public class Messages {
// warnings & errors // warnings & errors
public static final String WARNING_CORPUS_NOT_FOUND = "V izbranem direktoriju ni ustreznih korpusnih datotek."; public static String WARNING_CORPUS_NOT_FOUND = I18N.get("message.WARNING_CORPUS_NOT_FOUND");
public static final String WARNING_RESULTS_DIR_NOT_VALID = "Za dostop do izbranega direktorija nimate potrebnih pravic."; public static String WARNING_RESULTS_DIR_NOT_VALID = I18N.get("message.WARNING_RESULTS_DIR_NOT_VALID");
public static final String WARNING_DIFFERING_NGRAM_LEVEL_AND_FILTER_TOKENS = "Izbran nivo ngramov in vpisano št. besed v filtru se ne ujemata."; public static String WARNING_DIFFERING_NGRAM_LEVEL_AND_FILTER_TOKENS = I18N.get("message.WARNING_DIFFERING_NGRAM_LEVEL_AND_FILTER_TOKENS");
public static final String WARNING_DIFFERING_NGRAM_LEVEL_AND_FILTER_TOKENS_INFO = "Izberite drugo število ali popravite filter."; public static String WARNING_DIFFERING_NGRAM_LEVEL_AND_FILTER_TOKENS_INFO = I18N.get("message.WARNING_DIFFERING_NGRAM_LEVEL_AND_FILTER_TOKENS_INFO");
public static final String WARNING_WORD_OR_LEMMA = "Izberite, če želite statistiko izračunati za besede ali leme."; public static String WARNING_WORD_OR_LEMMA = I18N.get("message.WARNING_WORD_OR_LEMMA");
public static final String WARNING_ONLY_NUMBERS_ALLOWED = "Prosim vnesite veljavno število."; public static String WARNING_ONLY_NUMBERS_ALLOWED = I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED");
public static final String WARNING_NUMBER_TOO_BIG = "Vnešeno število je večje od števila taksonomij."; public static String WARNING_NUMBER_TOO_BIG = I18N.get("message.WARNING_NUMBER_TOO_BIG");
public static final String WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES = "Število za ngram (%d) in število msd oznak (%d) se morata ujemati."; public static String WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES = I18N.get("message.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES");
public static final String WARNING_MISSING_STRING_LENGTH = "Dolžina niza mora biti večja od 0. Vstavljena je privzeta vrednost (1)."; public static String WARNING_MISSING_STRING_LENGTH = I18N.get("message.WARNING_MISSING_STRING_LENGTH");
public static final String WARNING_NO_TAXONOMY_FOUND = "Iz korpusnih datotek ni bilo moč razbrati taksonomije. Prosim izberite drugo lokacijo ali korpus."; public static String WARNING_NO_TAXONOMY_FOUND = I18N.get("message.WARNING_NO_TAXONOMY_FOUND");
public static final String WARNING_NO_SOLAR_FILTERS_FOUND = "Iz korpusnih datotek ni bilo moč razbrati filtrov. Prosim izberite drugo lokacijo ali korpus."; public static String WARNING_NO_SOLAR_FILTERS_FOUND = I18N.get("message.WARNING_NO_SOLAR_FILTERS_FOUND");
public static final String ERROR_WHILE_EXECUTING = "Prišlo je do napake med izvajanjem."; public static String ERROR_WHILE_EXECUTING = I18N.get("message.ERROR_WHILE_EXECUTING");
public static final String ERROR_WHILE_SAVING_RESULTS_TO_CSV = "Prišlo je do napake med shranjevanje rezultatov."; public static String ERROR_WHILE_SAVING_RESULTS_TO_CSV = I18N.get("message.ERROR_WHILE_SAVING_RESULTS_TO_CSV");
public static final String ERROR_NOT_ENOUGH_MEMORY= "Na voljo imate premalo pomnilnika (RAM-a) za analizo takšne količine podatkov."; public static String ERROR_NOT_ENOUGH_MEMORY= I18N.get("message.ERROR_NOT_ENOUGH_MEMORY");
// missing // missing
public static final String MISSING_NGRAM_LEVEL = "N-gram nivo"; public static String MISSING_NGRAM_LEVEL = I18N.get("message.MISSING_NGRAM_LEVEL");
public static final String MISSING_CALCULATE_FOR = "Izračunaj za"; public static String MISSING_CALCULATE_FOR = I18N.get("message.MISSING_CALCULATE_FOR");
public static final String MISSING_SKIP = ""; public static String MISSING_SKIP = I18N.get("message.MISSING_SKIP");
public static final String MISSING_STRING_LENGTH = "Dolžina niza"; public static String MISSING_STRING_LENGTH = I18N.get("message.MISSING_STRING_LENGTH");
public static final String MISMATCHED_STRING_LENGTH_AND_MSD_REGEX = "Neujemajoča dolžina niza in regex filter"; public static String MISMATCHED_STRING_LENGTH_AND_MSD_REGEX = I18N.get("message.MISMATCHED_STRING_LENGTH_AND_MSD_REGEX");
// general notifications - static content/set only once // general notifications - static content/set only once
public static final String NOTIFICATION_FOUND_X_FILES = "Št. najdenih datotek: %d"; public static String NOTIFICATION_FOUND_X_FILES = I18N.get("message.NOTIFICATION_FOUND_X_FILES");
public static final String NOTIFICATION_ANALYSIS_COMPLETED = "Analiza je zaključena, rezultati so shranjeni."; public static String NOTIFICATION_ANALYSIS_COMPLETED = I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED");
public static final String NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS = "Analiza je zaključena, vendar ni bilo moč izračunati statistike, ki bi ustrezala vsem navedenim pogojem."; public static String NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS = I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS");
public static final String RESULTS_PATH_SET_TO_DEFAULT = "Lokacija za shranjevanje rezultatov je nastavljena na lokacijo korpusa."; public static String RESULTS_PATH_SET_TO_DEFAULT = I18N.get("message.RESULTS_PATH_SET_TO_DEFAULT");
public static final String NOTIFICATION_ANALYSIS_CANCLED = "Analiziranje je bilo prekinjeno."; public static String NOTIFICATION_ANALYSIS_CANCLED = I18N.get("message.NOTIFICATION_ANALYSIS_CANCELED");
// ongoing notifications - displayed while processing, dynamically changing // ongoing notifications - displayed while processing, dynamically changing
public static final String ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y = "Analiziram datoteko %d od %d (%s)"; public static String ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y = I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y");
public static final String CANCELING_NOTIFICATION = "Prekinjeno"; public static String CANCELING_NOTIFICATION = I18N.get("message.CANCELING_NOTIFICATION");
// Labels // Labels
public static final String LABEL_CORPUS_LOCATION_NOT_SET = "Lokacija korpusa ni nastavljena"; public static String LABEL_CORPUS_LOCATION_NOT_SET = I18N.get("message.LABEL_CORPUS_LOCATION_NOT_SET");
public static final String LABEL_RESULTS_LOCATION_NOT_SET = "Lokacija za shranjevanje rezultatov ni nastavljena"; public static String LABEL_RESULTS_LOCATION_NOT_SET = I18N.get("message.LABEL_RESULTS_LOCATION_NOT_SET");
public static final String LABEL_RESULTS_CORPUS_TYPE_NOT_SET = "Vrsta korpusa ni nastavljena"; public static String LABEL_RESULTS_CORPUS_TYPE_NOT_SET = I18N.get("message.LABEL_RESULTS_CORPUS_TYPE_NOT_SET");
public static final String LABEL_SCANNING_CORPUS = "Iskanje in analiza korpusnih datotek..."; public static String LABEL_SCANNING_CORPUS = I18N.get("message.LABEL_SCANNING_CORPUS");
public static final String LABEL_SCANNING_SINGLE_FILE_CORPUS = "Analiza vnosa "; public static String LABEL_SCANNING_SINGLE_FILE_CORPUS = I18N.get("message.LABEL_SCANNING_SINGLE_FILE_CORPUS");
public static final String COMPLETED = "končano"; public static String COMPLETED = I18N.get("message.COMPLETED");
public static final String TOOLTIP_chooseCorpusLocationB = "Izberite mapo v kateri se nahaja korpus. Program izbrano mapo preišče rekurzivno, zato bodite pozorni, da ne izberete mape z več korpusi ali z mnogo datotekami, ki niso del korpusa.";
public static final String TOOLTIP_readHeaderInfoChB = "Če izberete to opcijo, se bo iz headerjev korpusa prebrala razpoložljiva taksonomija oz. filtri (korpus Šolar). Ta operacija lahko traja dlje časa, sploh če je korpus združen v eni sami datoteki.";
public static final String TOOLTIP_readNotePunctuationsChB = "Ločila med povedmi se upoštevajo v vsakem primeru.";
public static final String TOOLTIP_readDisplayTaxonomyChB = "V izhodni datoteki bodo prikazane tudi statistike po taksonomijah.";
public static String TOOLTIP_chooseCorpusLocationB = I18N.get("message.TOOLTIP_chooseCorpusLocationB");
public static String TOOLTIP_readHeaderInfoChB = I18N.get("message.TOOLTIP_readHeaderInfoChB");
public static String TOOLTIP_readNotePunctuationsChB = I18N.get("message.TOOLTIP_readNotePunctuationsChB");
public static String TOOLTIP_readDisplayTaxonomyChB = I18N.get("message.TOOLTIP_readDisplayTaxonomyChB");
private static Label chooseCorpusL;
private static String chooseCorpusLabelContent;
private static String[] chooseCorpusLabelProperties;
// Not properly to be here. TODO move somewhere else in future // Not properly to be here. TODO move somewhere else in future
public static final String HELP_URL = "http://slovnica.ijs.si/"; public static String HELP_URL = "http://slovnica.ijs.si/";
// helper maps // helper maps
/** /**
@ -73,8 +76,46 @@ public class Messages {
static { static {
// automatically set window's title // automatically set window's title
windowTitles.put(ERROR, "Napaka"); windowTitles.put(ERROR, I18N.get("windowTitles.error"));
windowTitles.put(WARNING, "Opozorilo"); windowTitles.put(WARNING, I18N.get("windowTitles.warning"));
windowTitles.put(CONFIRMATION, "Potrdilo"); windowTitles.put(CONFIRMATION, I18N.get("windowTitles.confirmation"));
}
public static void reload(){
LABEL_CORPUS_LOCATION_NOT_SET = I18N.createStringBinding("message.LABEL_CORPUS_LOCATION_NOT_SET").get();
windowTitles = new HashMap<>();
windowTitles.put(ERROR, I18N.get("windowTitles.error"));
windowTitles.put(WARNING, I18N.get("windowTitles.warning"));
windowTitles.put(CONFIRMATION, I18N.get("windowTitles.confirmation"));
}
public static void setChooseCorpusL(Label chooseCorpus, String chooseCorpusLabel){
chooseCorpusL = chooseCorpus;
chooseCorpusLabelContent = chooseCorpusLabel;
chooseCorpusL.textProperty().unbind();
chooseCorpusL.setText(chooseCorpusLabelContent);
}
public static void setChooseCorpusProperties(String corpusLoc, String corpusFilesSi, String corpusName){
chooseCorpusLabelProperties = new String[3];
chooseCorpusLabelProperties[0] = corpusLoc;
chooseCorpusLabelProperties[1] = corpusFilesSi;
chooseCorpusLabelProperties[2] = corpusName;
}
public static void updateChooseCorpusL(){
if (chooseCorpusLabelProperties != null && chooseCorpusLabelProperties[0] != null && chooseCorpusLabelProperties[1] != null && chooseCorpusLabelProperties[2] != null) {
StringBuilder sb = new StringBuilder();
sb.append(chooseCorpusLabelProperties[0])
.append("\n")
.append(String.format(I18N.get("message.NOTIFICATION_FOUND_X_FILES"), chooseCorpusLabelProperties[1]))
.append("\n")
.append(String.format(I18N.get("message.NOTIFICATION_CORPUS"), chooseCorpusLabelProperties[2]));
chooseCorpusLabelContent = sb.toString();
chooseCorpusL.textProperty().unbind();
chooseCorpusL.setText(chooseCorpusLabelContent);
}
} }
} }

@ -2,6 +2,8 @@ package gui;
import data.*; import data.*;
import javafx.application.HostServices; import javafx.application.HostServices;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
@ -36,9 +38,37 @@ public class OneWordAnalysisTab {
@FXML @FXML
public Label selectedFiltersLabel; public Label selectedFiltersLabel;
@FXML @FXML
public Label solarFilters; public Label solarFilters;
@FXML
public Label calculateForL;
@FXML
public Label alsoVisualizeL;
@FXML
public Label displayTaxonomyL;
@FXML
public Label writeMsdAtTheEndL;
@FXML
public Label dataLimitL;
@FXML
public Label msdL;
@FXML
public Label taxonomyL;
@FXML
public Label minimalOccurrencesL;
@FXML
public Label minimalTaxonomyL;
@FXML @FXML
private TextField msdTF; private TextField msdTF;
private ArrayList<Pattern> msd; private ArrayList<Pattern> msd;
@ -75,6 +105,9 @@ public class OneWordAnalysisTab {
@FXML @FXML
private Button computeNgramsB; private Button computeNgramsB;
@FXML
private Button changeLanguageB;
@FXML @FXML
private Button cancel; private Button cancel;
@ -98,17 +131,49 @@ public class OneWordAnalysisTab {
private Filter filter; private Filter filter;
private boolean useDb; private boolean useDb;
private HostServices hostService; private HostServices hostService;
private ListChangeListener<String> taxonomyListener;
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka"); private ListChangeListener<String> alsoVisualizeListener;
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica"); private ChangeListener<String> calculateForListener;
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = FXCollections.observableArrayList("različnica");
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka", "normalizirana različnica"); // private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka");
private static final ObservableList<String> alsoVisualizeItemsLemma = FXCollections.observableArrayList("besedna vrsta", "oblikoskladenjska oznaka"); // private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica");
private static final ObservableList<String> alsoVisualizeItemsWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka"); // private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = FXCollections.observableArrayList("različnica");
private static final ObservableList<String> alsoVisualizeItemsWordGos = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka", "normalizirana različnica"); // private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka", "normalizirana različnica");
private static final ObservableList<String> alsoVisualizeItemsNormalizedWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka"); // private static final ObservableList<String> alsoVisualizeItemsLemma = FXCollections.observableArrayList("besedna vrsta", "oblikoskladenjska oznaka");
private static final ObservableList<String> alsoVisualizeItemsMsd = FXCollections.observableArrayList("besedna vrsta"); // private static final ObservableList<String> alsoVisualizeItemsWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
private static final ObservableList<String> alsoVisualizeItemsEmpty = FXCollections.observableArrayList(); // private static final ObservableList<String> alsoVisualizeItemsWordGos = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka", "normalizirana različnica");
// private static final ObservableList<String> alsoVisualizeItemsNormalizedWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
// private static final ObservableList<String> alsoVisualizeItemsMsd = FXCollections.observableArrayList("besedna vrsta");
// private static final ObservableList<String> alsoVisualizeItemsEmpty = FXCollections.observableArrayList();
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica");
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica");
private static final String [] N_GRAM_COMPUTE_FOR_WORDS_ARRAY = {"calculateFor.WORD", "calculateFor.LEMMA", "calculateFor.MORPHOSYNTACTIC_SPECS"};
private static final ArrayList<String> N_GRAM_COMPUTE_FOR_WORDS = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_WORDS_ARRAY));
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = FXCollections.observableArrayList("različnica");
private static final String [] N_GRAM_COMPUTE_FOR_WORDS_ORTH_ARRAY = {"calculateFor.WORD"};
private static final ArrayList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_WORDS_ORTH_ARRAY));
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = FXCollections.observableArrayList("lema", "različnica", "normalizirana različnica");
private static final String [] N_GRAM_COMPUTE_FOR_WORDS_GOS_ARRAY = {"calculateFor.WORD", "calculateFor.LEMMA", "calculateFor.MORPHOSYNTACTIC_SPECS", "calculateFor.NORMALIZED_WORD"};
private static final ArrayList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_WORDS_GOS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsLemma = FXCollections.observableArrayList("besedna vrsta", "oblikoskladenjska oznaka");
private static final String [] ALSO_VISUALIZE_ITEMS_LEMMA_ARRAY = {"calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_LEMMA = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_LEMMA_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
private static final String [] ALSO_VISUALIZE_ITEMS_WORDS_ARRAY = {"calculateFor.LEMMA", "calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_WORDS = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_WORDS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsWordGos = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka", "normalizirana različnica");
private static final String [] ALSO_VISUALIZE_ITEMS_WORDS_GOS_ARRAY = {"calculateFor.LEMMA", "calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS", "calculateFor.NORMALIZED_WORD"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_WORDS_GOS = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_WORDS_GOS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsNormalizedWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
private static final String [] ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS_ARRAY = {"calculateFor.LEMMA", "calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsMsd = FXCollections.observableArrayList("besedna vrsta");
private static final String [] ALSO_VISUALIZE_ITEMS_MSD_ARRAY = {"calculateFor.WORD_TYPE"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_MSD = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_MSD_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsEmpty = FXCollections.observableArrayList();
private static final String [] ALSO_VISUALIZE_ITEMS_EMPTY_ARRAY = {};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_EMPTY = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_EMPTY_ARRAY));
// TODO: pass observables for taxonomy based on header scan // TODO: pass observables for taxonomy based on header scan
// after header scan // after header scan
@ -120,51 +185,112 @@ public class OneWordAnalysisTab {
oneWordAnalysisTabPane.getStylesheets().add("style.css"); oneWordAnalysisTabPane.getStylesheets().add("style.css");
oneWordAnalysisTabPane.getStyleClass().add("root"); oneWordAnalysisTabPane.getStyleClass().add("root");
manageTranslations();
currentMode = MODE.WORD; currentMode = MODE.WORD;
toggleMode(currentMode); toggleMode(currentMode);
AtomicBoolean writeMsdAtTheEndEnableCalculateFor = new AtomicBoolean(false); AtomicBoolean writeMsdAtTheEndEnableCalculateFor = new AtomicBoolean(false);
if (calculateForListener != null){
calculateForCB.valueProperty().removeListener(calculateForListener);
}
// calculateForCB // calculateForCB
calculateForCB.valueProperty().addListener((observable, oldValue, newValue) -> { calculateForListener = new ChangeListener<String>() {
calculateFor = CalculateFor.factory(newValue); boolean ignoreCode = false;
@Override
alsoVisualizeCCB.getItems().removeAll(); public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if(newValue.equals("lema")){ if (ignoreCode) {
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsLemma); return;
} else if(newValue.equals("različnica")) { }
if (corpus.getCorpusType() == CorpusType.GOS) boolean languageChanged = newValue == null;
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsWordGos); ArrayList<Integer> checkedIndices = new ArrayList<>();
else checkedIndices.addAll(alsoVisualizeCCB.getCheckModel().getCheckedIndices());
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsWord); if (languageChanged) {
} else if(newValue.equals("normalizirana različnica")) { ignoreCode = true;
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsNormalizedWord); if (corpus.getCorpusType() == CorpusType.GOS) {
} else if(newValue.equals("oblikoskladenjska oznaka")) { newValue = I18N.getTranslatedValue(oldValue, N_GRAM_COMPUTE_FOR_WORDS_GOS);
writeMsdAtTheEndEnableCalculateFor.set(true); calculateForCB.getSelectionModel().select(newValue);
writeMsdAtTheEndChB.setDisable(false); } else {
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsMsd); newValue = I18N.getTranslatedValue(oldValue, N_GRAM_COMPUTE_FOR_WORDS);
}else { calculateForCB.getSelectionModel().select(newValue);
}
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsEmpty);
} // override if orth mode, allow only word
if (corpus.isGosOrthMode()) {
newValue = I18N.getTranslatedValue(oldValue, N_GRAM_COMPUTE_FOR_WORDS_ORTH);
calculateForCB.getSelectionModel().select(newValue);
}
ignoreCode = false;
}
calculateFor = CalculateFor.factory(newValue);
if (alsoVisualizeListener != null) {
alsoVisualizeCCB.getCheckModel().getCheckedItems().removeListener(alsoVisualizeListener);
}
if (!newValue.equals("oblikoskladenjska oznaka")){ alsoVisualizeCCB.getCheckModel().clearChecks();
writeMsdAtTheEnd = false; alsoVisualizeCCB.getItems().removeAll();
writeMsdAtTheEndChB.setSelected(false); if (newValue.equals(CalculateFor.LEMMA.toString())) {
writeMsdAtTheEndChB.setDisable(true); alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_LEMMA));
writeMsdAtTheEndEnableCalculateFor.set(false); } else if (newValue.equals(CalculateFor.WORD.toString())) {
if (corpus.getCorpusType() == CorpusType.GOS)
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_WORDS_GOS));
else
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_WORDS));
} else if (newValue.equals(CalculateFor.NORMALIZED_WORD.toString())) {
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS));
} else if (newValue.equals(CalculateFor.MORPHOSYNTACTIC_SPECS.toString())) {
writeMsdAtTheEndEnableCalculateFor.set(true);
writeMsdAtTheEndChB.setDisable(false);
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_MSD));
} else {
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_EMPTY));
}
if (!newValue.equals(CalculateFor.MORPHOSYNTACTIC_SPECS.toString())) {
writeMsdAtTheEnd = false;
writeMsdAtTheEndChB.setSelected(false);
writeMsdAtTheEndChB.setDisable(true);
writeMsdAtTheEndEnableCalculateFor.set(false);
}
alsoVisualizeListener = new ListChangeListener<String>() {
@Override
public void onChanged(Change<? extends String> c) {
alsoVisualize = new ArrayList<>();
ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems();
alsoVisualize.addAll(checkedItems);
if (checkedItems.contains(CalculateFor.MORPHOSYNTACTIC_SPECS.toString()) || writeMsdAtTheEndEnableCalculateFor.get()) {
writeMsdAtTheEndChB.setDisable(false);
} else {
writeMsdAtTheEnd = false;
writeMsdAtTheEndChB.setSelected(false);
writeMsdAtTheEndChB.setDisable(true);
}
logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ",")));
}
};
// alsoVisualizeCCB.getCheckModel().clearChecks();
// alsoVisualizeCCB.getItems().removeAll();
// alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_LEMMA));
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener(alsoVisualizeListener);
if (languageChanged) {
for (int i : checkedIndices) {
alsoVisualizeCCB.getCheckModel().check(i);
}
}
logger.info("calculateForCB:", calculateFor.toString());
} }
};
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) c -> { calculateForCB.valueProperty().addListener(calculateForListener);
alsoVisualize = new ArrayList<>();
ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems();
alsoVisualize.addAll(checkedItems);
logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ",")));
});
alsoVisualizeCCB.getCheckModel().clearChecks();
logger.info("calculateForCB:", calculateFor.toString());
});
calculateForCB.getSelectionModel().select(0); calculateForCB.getSelectionModel().select(0);
@ -180,7 +306,7 @@ public class OneWordAnalysisTab {
int nOfRequiredMsdTokens = 1; int nOfRequiredMsdTokens = 1;
if (msdTmp.size() != nOfRequiredMsdTokens) { if (msdTmp.size() != nOfRequiredMsdTokens) {
String msg = String.format(Messages.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES, nOfRequiredMsdTokens, msdTmp.size()); String msg = String.format(I18N.get("message.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES"), nOfRequiredMsdTokens, msdTmp.size());
logAlert(msg); logAlert(msg);
showAlert(Alert.AlertType.ERROR, msg); showAlert(Alert.AlertType.ERROR, msg);
} }
@ -202,30 +328,39 @@ public class OneWordAnalysisTab {
msdTF.setText(""); msdTF.setText("");
msd = new ArrayList<>(); msd = new ArrayList<>();
alsoVisualizeCCB.getItems().removeAll(); if (alsoVisualizeListener != null){
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsLemma); alsoVisualizeCCB.getCheckModel().getCheckedItems().removeListener(alsoVisualizeListener);
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) c -> { }
alsoVisualize = new ArrayList<>();
ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems(); alsoVisualizeListener = new ListChangeListener<String>() {
alsoVisualize.addAll(checkedItems); @Override
if (checkedItems.contains("oblikoskladenjska oznaka") || writeMsdAtTheEndEnableCalculateFor.get()){ public void onChanged(Change<? extends String> c) {
writeMsdAtTheEndChB.setDisable(false); alsoVisualize = new ArrayList<>();
} else { ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems();
writeMsdAtTheEnd = false; alsoVisualize.addAll(checkedItems);
writeMsdAtTheEndChB.setSelected(false); if (checkedItems.contains("oblikoskladenjska oznaka") || writeMsdAtTheEndEnableCalculateFor.get()) {
writeMsdAtTheEndChB.setDisable(true); writeMsdAtTheEndChB.setDisable(false);
} else {
writeMsdAtTheEnd = false;
writeMsdAtTheEndChB.setSelected(false);
writeMsdAtTheEndChB.setDisable(true);
}
logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ",")));
} }
logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ","))); };
});
alsoVisualizeCCB.getCheckModel().clearChecks(); alsoVisualizeCCB.getCheckModel().clearChecks();
alsoVisualizeCCB.getItems().removeAll();
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_LEMMA));
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener(alsoVisualizeListener);
// taxonomy // taxonomy
if (Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType())) { if (Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType())) {
taxonomyCCB.setDisable(false); if (taxonomyListener != null){
taxonomyCCB.getItems().removeAll(); taxonomyCCB.getCheckModel().getCheckedItems().removeListener(taxonomyListener);
taxonomyCCB.getItems().setAll(corpus.getTaxonomy()); }
ListChangeListener<String> listener = new ListChangeListener<String>() { taxonomyListener = new ListChangeListener<String>() {
public boolean changing = true; public boolean changing = true;
@Override @Override
@ -254,14 +389,12 @@ public class OneWordAnalysisTab {
} }
}; };
// taxonomyCCB.getCheckModel().getCheckedItems().removeListener(listener);
// System.out.println("THIS WORKS!!!!");
taxonomyCCB.getCheckModel().clearChecks(); taxonomyCCB.getCheckModel().clearChecks();
// System.out.println("YES???"); taxonomyCCB.setDisable(false);
taxonomyCCB.getCheckModel().getCheckedItems().addListener(listener); taxonomyCCB.getItems().removeAll();
// taxonomyCCB.setCheckModel(null); taxonomyCCB.getItems().setAll(corpus.getTaxonomy());
// taxonomyCCB.getCheckModel().clearChecks(); taxonomyCCB.getCheckModel().getCheckedItems().addListener(taxonomyListener);
} else { } else {
taxonomyCCB.setDisable(true); taxonomyCCB.setDisable(true);
} }
@ -283,7 +416,7 @@ public class OneWordAnalysisTab {
} }
logger.info("display taxonomy: ", displayTaxonomy); logger.info("display taxonomy: ", displayTaxonomy);
}); });
displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB)); displayTaxonomyChB.setTooltip(new Tooltip(I18N.get("message.TOOLTIP_readDisplayTaxonomyChB")));
} else { } else {
displayTaxonomyChB.setDisable(true); displayTaxonomyChB.setDisable(true);
} }
@ -312,8 +445,8 @@ public class OneWordAnalysisTab {
String value = minimalOccurrencesTF.getText(); String value = minimalOccurrencesTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("minimalOccurrencesTF: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("minimalOccurrencesTF: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} else { } else {
minimalOccurrences = Integer.parseInt(value); minimalOccurrences = Integer.parseInt(value);
} }
@ -330,8 +463,8 @@ public class OneWordAnalysisTab {
String value = minimalTaxonomyTF.getText(); String value = minimalTaxonomyTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("minimalTaxonomyTF: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("minimalTaxonomyTF: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} else { } else {
minimalTaxonomy = Integer.parseInt(value); minimalTaxonomy = Integer.parseInt(value);
} }
@ -342,6 +475,17 @@ public class OneWordAnalysisTab {
} }
}); });
changeLanguageB.setOnAction(e -> {
if (I18N.getLocale() == new Locale.Builder().setLanguage("sl").setRegion("SI").build()){
I18N.setLocale(Locale.ENGLISH);
} else {
I18N.setLocale(new Locale.Builder().setLanguage("sl").setRegion("SI").build());
}
Messages.reload();
Messages.updateChooseCorpusL();
logger.info("change language");
});
computeNgramsB.setOnAction(e -> { computeNgramsB.setOnAction(e -> {
compute(); compute();
logger.info("compute button"); logger.info("compute button");
@ -429,6 +573,25 @@ public class OneWordAnalysisTab {
// taxonomyCCB.getItems().addAll(taxonomyCCBValues); // taxonomyCCB.getItems().addAll(taxonomyCCBValues);
// //
// } // }
private void manageTranslations(){
helpH.textProperty().bind(I18N.createStringBinding("hyperlink.help"));
changeLanguageB.textProperty().bind(I18N.createStringBinding("button.language"));
computeNgramsB.textProperty().bind(I18N.createStringBinding("button.computeNgrams"));
cancel.textProperty().bind(I18N.createStringBinding("button.cancel"));
calculateForL.textProperty().bind(I18N.createStringBinding("label.calculateFor"));
alsoVisualizeL.textProperty().bind(I18N.createStringBinding("label.alsoVisualize"));
displayTaxonomyL.textProperty().bind(I18N.createStringBinding("label.displayTaxonomy"));
writeMsdAtTheEndL.textProperty().bind(I18N.createStringBinding("label.writeMsdAtTheEnd"));
dataLimitL.textProperty().bind(I18N.createStringBinding("label.dataLimit"));
msdL.textProperty().bind(I18N.createStringBinding("label.msd"));
taxonomyL.textProperty().bind(I18N.createStringBinding("label.taxonomy"));
minimalOccurrencesL.textProperty().bind(I18N.createStringBinding("label.minimalOccurrences"));
minimalTaxonomyL.textProperty().bind(I18N.createStringBinding("label.minimalTaxonomy"));
solarFilters.textProperty().bind(I18N.createStringBinding("label.solarFilters"));
}
/** /**
* Toggles visibility for panes which hold fields for skipgram value (not applicable when calculating for letters) etc., * Toggles visibility for panes which hold fields for skipgram value (not applicable when calculating for letters) etc.,
@ -444,25 +607,18 @@ public class OneWordAnalysisTab {
logger.info("mode: ", mode.toString()); logger.info("mode: ", mode.toString());
if (mode == MODE.WORD) { if (mode == MODE.WORD) {
if (corpus.getCorpusType() == CorpusType.GOS) if (corpus.getCorpusType() == CorpusType.GOS) {
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_GOS); calculateForCB.itemsProperty().unbind();
else calculateForCB.itemsProperty().bind(I18N.createObjectBinding(N_GRAM_COMPUTE_FOR_WORDS_GOS));
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS); } else {
} else if (mode == MODE.LETTER) { calculateForCB.itemsProperty().unbind();
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_LETTERS); calculateForCB.itemsProperty().bind(I18N.createObjectBinding(N_GRAM_COMPUTE_FOR_WORDS));
// if calculateFor was selected for something other than a word or a lemma -> reset
if (!(calculateFor == CalculateFor.WORD || calculateFor == CalculateFor.LEMMA)) {
// if the user selected something else before selecting ngram for letters, reset that choice
calculateFor = CalculateFor.WORD;
calculateForCB.getSelectionModel().select("različnica");
} }
} }
// override if orth mode, allow only word // override if orth mode, allow only word
if (corpus.isGosOrthMode()) { if (corpus.isGosOrthMode()) {
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_ORTH); calculateForCB.itemsProperty().unbind();
calculateForCB.itemsProperty().bind(I18N.createObjectBinding(N_GRAM_COMPUTE_FOR_WORDS_ORTH));
msdTF.setDisable(true); msdTF.setDisable(true);
} else { } else {
msdTF.setDisable(false); msdTF.setDisable(false);
@ -549,11 +705,11 @@ public class OneWordAnalysisTab {
readXML(f.toString(), statistic); readXML(f.toString(), statistic);
i++; i++;
if (isCancelled()) { if (isCancelled()) {
updateMessage(CANCELING_NOTIFICATION); updateMessage(I18N.get("message.CANCELING_NOTIFICATION"));
break; break;
} }
this.updateProgress(i, corpusFiles.size()); this.updateProgress(i, corpusFiles.size());
this.updateMessage(String.format(ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y, i, corpusFiles.size(), f.getName())); this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName()));
} }
return null; return null;
@ -567,12 +723,12 @@ public class OneWordAnalysisTab {
try { try {
boolean successullySaved = statistic.saveResultToDisk(); boolean successullySaved = statistic.saveResultToDisk();
if (successullySaved) { if (successullySaved) {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED"));
} else { } else {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS"));
} }
} catch (UnsupportedEncodingException e1) { } catch (UnsupportedEncodingException e1) {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_SAVING_RESULTS_TO_CSV); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_SAVING_RESULTS_TO_CSV"));
logger.error("Error while saving", e1); logger.error("Error while saving", e1);
} }
@ -584,7 +740,7 @@ public class OneWordAnalysisTab {
}); });
task.setOnFailed(e -> { task.setOnFailed(e -> {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_EXECUTING); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_EXECUTING"));
logger.error("Error while executing", e); logger.error("Error while executing", e);
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
ngramProgressBar.setProgress(0.0); ngramProgressBar.setProgress(0.0);
@ -595,7 +751,7 @@ public class OneWordAnalysisTab {
}); });
task.setOnCancelled(e -> { task.setOnCancelled(e -> {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_CANCLED); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_CANCELED"));
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
ngramProgressBar.setProgress(0.0); ngramProgressBar.setProgress(0.0);
ngramProgressBar.setStyle(Settings.FX_ACCENT_OK); ngramProgressBar.setStyle(Settings.FX_ACCENT_OK);

@ -13,6 +13,8 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javafx.application.HostServices; import javafx.application.HostServices;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.SerializationUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -38,9 +40,53 @@ public class StringAnalysisTabNew2 {
@FXML @FXML
public Label selectedFiltersLabel; public Label selectedFiltersLabel;
@FXML @FXML
public Label solarFilters; public Label solarFilters;
@FXML
public Label calculateForL;
@FXML
public Label alsoVisualizeL;
@FXML
public Label displayTaxonomyL;
@FXML
public Label dataLimitL;
@FXML
public Label msdL;
@FXML
public Label taxonomyL;
@FXML
public Label minimalOccurrencesL;
@FXML
public Label minimalTaxonomyL;
@FXML
public Label skipValueL;
@FXML
public Label slowSpeedWarning1L;
@FXML
public Label slowSpeedWarning2L;
@FXML
public Label ngramValueL;
@FXML
public Label notePunctuationsL;
@FXML
public Label collocabilityL;
@FXML @FXML
private TextField msdTF; private TextField msdTF;
private ArrayList<Pattern> msd; private ArrayList<Pattern> msd;
@ -103,6 +149,9 @@ public class StringAnalysisTabNew2 {
@FXML @FXML
private Button computeNgramsB; private Button computeNgramsB;
@FXML
private Button changeLanguageB;
@FXML @FXML
private Button cancel; private Button cancel;
@ -126,19 +175,50 @@ public class StringAnalysisTabNew2 {
private Filter filter; private Filter filter;
private boolean useDb; private boolean useDb;
private HostServices hostService; private HostServices hostService;
private ListChangeListener<String> taxonomyListener;
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka"); private ListChangeListener<String> alsoVisualizeListener;
private ListChangeListener<String> collocabilityListener;
private ChangeListener<String> calculateForListener;
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka");
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica");
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = FXCollections.observableArrayList("različnica");
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka", "normalizirana različnica"); // private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka", "normalizirana različnica");
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica"); // private static final ObservableList<String> alsoVisualizeItemsLemma = FXCollections.observableArrayList("besedna vrsta", "oblikoskladenjska oznaka");
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = FXCollections.observableArrayList("različnica"); // private static final ObservableList<String> alsoVisualizeItemsWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka", "normalizirana različnica"); // private static final ObservableList<String> alsoVisualizeItemsWordGos = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka", "normalizirana različnica");
private static final ObservableList<String> alsoVisualizeItemsLemma = FXCollections.observableArrayList("besedna vrsta", "oblikoskladenjska oznaka"); // private static final ObservableList<String> alsoVisualizeItemsNormalizedWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
private static final ObservableList<String> alsoVisualizeItemsWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka"); // private static final ObservableList<String> alsoVisualizeItemsMsd = FXCollections.observableArrayList("besedna vrsta");
private static final ObservableList<String> alsoVisualizeItemsWordGos = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka", "normalizirana različnica");
private static final ObservableList<String> alsoVisualizeItemsNormalizedWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
private static final ObservableList<String> alsoVisualizeItemsMsd = FXCollections.observableArrayList("besedna vrsta");
private static final ObservableList<String> COLLOCABILITY_ITEMS = FXCollections.observableArrayList("Dice", "t-score", "MI", "MI3", "logDice", "simple LL"); private static final ObservableList<String> COLLOCABILITY_ITEMS = FXCollections.observableArrayList("Dice", "t-score", "MI", "MI3", "logDice", "simple LL");
private static final ObservableList<String> alsoVisualizeItemsEmpty = FXCollections.observableArrayList(); // private static final ObservableList<String> alsoVisualizeItemsEmpty = FXCollections.observableArrayList();
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica");
private static final String [] N_GRAM_COMPUTE_FOR_WORDS_ARRAY = {"calculateFor.WORD", "calculateFor.LEMMA", "calculateFor.MORPHOSYNTACTIC_SPECS"};
private static final ArrayList<String> N_GRAM_COMPUTE_FOR_WORDS = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_WORDS_ARRAY));
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = FXCollections.observableArrayList("različnica");
private static final String [] N_GRAM_COMPUTE_FOR_WORDS_ORTH_ARRAY = {"calculateFor.WORD"};
private static final ArrayList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_WORDS_ORTH_ARRAY));
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = FXCollections.observableArrayList("lema", "različnica", "normalizirana različnica");
private static final String [] N_GRAM_COMPUTE_FOR_WORDS_GOS_ARRAY = {"calculateFor.WORD", "calculateFor.LEMMA", "calculateFor.MORPHOSYNTACTIC_SPECS", "calculateFor.NORMALIZED_WORD"};
private static final ArrayList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_WORDS_GOS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsLemma = FXCollections.observableArrayList("besedna vrsta", "oblikoskladenjska oznaka");
private static final String [] ALSO_VISUALIZE_ITEMS_LEMMA_ARRAY = {"calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_LEMMA = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_LEMMA_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
private static final String [] ALSO_VISUALIZE_ITEMS_WORDS_ARRAY = {"calculateFor.LEMMA", "calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_WORDS = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_WORDS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsWordGos = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka", "normalizirana različnica");
private static final String [] ALSO_VISUALIZE_ITEMS_WORDS_GOS_ARRAY = {"calculateFor.LEMMA", "calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS", "calculateFor.NORMALIZED_WORD"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_WORDS_GOS = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_WORDS_GOS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsNormalizedWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
private static final String [] ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS_ARRAY = {"calculateFor.LEMMA", "calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsMsd = FXCollections.observableArrayList("besedna vrsta");
private static final String [] ALSO_VISUALIZE_ITEMS_MSD_ARRAY = {"calculateFor.WORD_TYPE"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_MSD = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_MSD_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsEmpty = FXCollections.observableArrayList();
private static final String [] ALSO_VISUALIZE_ITEMS_EMPTY_ARRAY = {};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_EMPTY = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_EMPTY_ARRAY));
// TODO: pass observables for taxonomy based on header scan // TODO: pass observables for taxonomy based on header scan
@ -151,6 +231,8 @@ public class StringAnalysisTabNew2 {
stringAnalysisTabPaneNew2.getStylesheets().add("style.css"); stringAnalysisTabPaneNew2.getStylesheets().add("style.css");
stringAnalysisTabPaneNew2.getStyleClass().add("root"); stringAnalysisTabPaneNew2.getStyleClass().add("root");
manageTranslations();
currentMode = MODE.WORD; currentMode = MODE.WORD;
toggleMode(currentMode); toggleMode(currentMode);
@ -195,7 +277,7 @@ public class StringAnalysisTabNew2 {
notePunctuations = newValue; notePunctuations = newValue;
logger.info("note punctuations: ", notePunctuations); logger.info("note punctuations: ", notePunctuations);
}); });
notePunctuationsChB.setTooltip(new Tooltip(TOOLTIP_readNotePunctuationsChB)); notePunctuationsChB.setTooltip(new Tooltip(I18N.get("message.TOOLTIP_readNotePunctuationsChB")));
displayTaxonomy = false; displayTaxonomy = false;
displayTaxonomyChB.setSelected(false); displayTaxonomyChB.setSelected(false);
@ -215,57 +297,136 @@ public class StringAnalysisTabNew2 {
} }
logger.info("display taxonomy: ", displayTaxonomy); logger.info("display taxonomy: ", displayTaxonomy);
}); });
displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB)); displayTaxonomyChB.setTooltip(new Tooltip(I18N.get("message.TOOLTIP_readDisplayTaxonomyChB")));
} else { } else {
displayTaxonomyChB.setDisable(true); displayTaxonomyChB.setDisable(true);
} }
if (calculateForListener != null){
calculateForCB.valueProperty().removeListener(calculateForListener);
}
// calculateForCB // calculateForCB
calculateForCB.valueProperty().addListener((observable, oldValue, newValue) -> { calculateForListener = new ChangeListener<String>() {
calculateFor = CalculateFor.factory(newValue); boolean ignoreCode = false;
@Override
alsoVisualizeCCB.getItems().removeAll(); public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if(newValue.equals("lema")){ if (ignoreCode) {
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsLemma); return;
} else if(newValue.equals("različnica")) { }
if (corpus.getCorpusType() == CorpusType.GOS) boolean languageChanged = newValue == null;
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsWordGos); ArrayList<Integer> checkedIndices = new ArrayList<>();
else checkedIndices.addAll(alsoVisualizeCCB.getCheckModel().getCheckedIndices());
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsWord); if (languageChanged) {
} else if(newValue.equals("normalizirana različnica")) { ignoreCode = true;
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsNormalizedWord); if (corpus.getCorpusType() == CorpusType.GOS) {
}else if(newValue.equals("oblikoskladenjska oznaka")) { newValue = I18N.getTranslatedValue(oldValue, N_GRAM_COMPUTE_FOR_WORDS_GOS);
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsMsd); calculateForCB.getSelectionModel().select(newValue);
}else { } else {
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsEmpty); newValue = I18N.getTranslatedValue(oldValue, N_GRAM_COMPUTE_FOR_WORDS);
calculateForCB.getSelectionModel().select(newValue);
}
// override if orth mode, allow only word
if (corpus.isGosOrthMode()) {
newValue = I18N.getTranslatedValue(oldValue, N_GRAM_COMPUTE_FOR_WORDS_ORTH);
calculateForCB.getSelectionModel().select(newValue);
}
ignoreCode = false;
}
calculateFor = CalculateFor.factory(newValue);
if (alsoVisualizeListener != null) {
alsoVisualizeCCB.getCheckModel().getCheckedItems().removeListener(alsoVisualizeListener);
}
alsoVisualizeCCB.getCheckModel().clearChecks();
alsoVisualizeCCB.getItems().removeAll();
if (newValue.equals(CalculateFor.LEMMA.toString())) {
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_LEMMA));
} else if (newValue.equals(CalculateFor.WORD.toString())) {
if (corpus.getCorpusType() == CorpusType.GOS)
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_WORDS_GOS));
else
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_WORDS));
} else if (newValue.equals(CalculateFor.NORMALIZED_WORD.toString())) {
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS));
} else if (newValue.equals(CalculateFor.MORPHOSYNTACTIC_SPECS.toString())) {
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_MSD));
} else {
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_EMPTY));
}
// alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) c -> {
// alsoVisualize = new ArrayList<>();
// ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems();
// alsoVisualize.addAll(checkedItems);
// logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ",")));
// });
// alsoVisualizeCCB.getCheckModel().clearChecks();
alsoVisualizeListener = new ListChangeListener<String>() {
@Override
public void onChanged(Change<? extends String> c) {
alsoVisualize = new ArrayList<>();
ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems();
alsoVisualize.addAll(checkedItems);
logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ",")));
}
};
// alsoVisualizeCCB.getCheckModel().clearChecks();
// alsoVisualizeCCB.getItems().removeAll();
// alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_WORDS));
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener(alsoVisualizeListener);
if (languageChanged) {
for (int i : checkedIndices) {
alsoVisualizeCCB.getCheckModel().check(i);
}
}
logger.info("calculateForCB:", calculateFor.toString());
} }
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) c -> { };
alsoVisualize = new ArrayList<>();
ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems();
alsoVisualize.addAll(checkedItems);
logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ",")));
});
alsoVisualizeCCB.getCheckModel().clearChecks();
logger.info("calculateForCB:", calculateFor.toString()); calculateForCB.valueProperty().addListener(calculateForListener);
});
calculateForCB.getSelectionModel().select(0); calculateForCB.getSelectionModel().select(0);
// collocabilityCCB // collocabilityCCB
collocabilityCCB.getItems().removeAll(); if (collocabilityListener != null){
collocabilityCCB.getCheckModel().getCheckedItems().removeListener(collocabilityListener);
}
collocabilityCCB.getItems().setAll(FXCollections.observableArrayList(COLLOCABILITY_ITEMS)); collocabilityListener = new ListChangeListener<String>() {
collocabilityCCB.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) c -> { @Override
collocability = new ArrayList<>(); public void onChanged(Change<? extends String> c) {
ObservableList<Collocability> checkedItems = FXCollections.observableArrayList(); collocability = new ArrayList<>();
for (String el : collocabilityCCB.getCheckModel().getCheckedItems()) { ObservableList<Collocability> checkedItems = FXCollections.observableArrayList();
checkedItems.add(Collocability.factory(el)); for (String el : collocabilityCCB.getCheckModel().getCheckedItems()) {
checkedItems.add(Collocability.factory(el));
}
collocability.addAll(checkedItems);
logger.info(String.format("Selected collocabilities: %s", StringUtils.join(collocabilityCCB.getCheckModel().getCheckedItems(), ",")));
} }
collocability.addAll(checkedItems); };
logger.info(String.format("Selected collocabilities: %s", StringUtils.join(collocabilityCCB.getCheckModel().getCheckedItems(), ",")));
});
collocabilityCCB.getCheckModel().clearChecks(); collocabilityCCB.getCheckModel().clearChecks();
collocabilityCCB.getItems().removeAll();
collocabilityCCB.getItems().setAll(FXCollections.observableArrayList(COLLOCABILITY_ITEMS));
collocabilityCCB.getCheckModel().getCheckedItems().addListener(collocabilityListener);
// collocabilityCCB.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) c -> {
// collocability = new ArrayList<>();
// ObservableList<Collocability> checkedItems = FXCollections.observableArrayList();
// for (String el : collocabilityCCB.getCheckModel().getCheckedItems()) {
// checkedItems.add(Collocability.factory(el));
// }
// collocability.addAll(checkedItems);
// logger.info(String.format("Selected collocabilities: %s", StringUtils.join(collocabilityCCB.getCheckModel().getCheckedItems(), ",")));
// });
// msd // msd
msdTF.focusedProperty().addListener((observable, oldValue, newValue) -> { msdTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
@ -279,7 +440,7 @@ public class StringAnalysisTabNew2 {
int nOfRequiredMsdTokens = ngramValue == 0 ? 1 : ngramValue; int nOfRequiredMsdTokens = ngramValue == 0 ? 1 : ngramValue;
if (msdTmp.size() != nOfRequiredMsdTokens) { if (msdTmp.size() != nOfRequiredMsdTokens) {
String msg = String.format(Messages.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES, nOfRequiredMsdTokens, msdTmp.size()); String msg = String.format(I18N.get("message.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES"), nOfRequiredMsdTokens, msdTmp.size());
logAlert(msg); logAlert(msg);
showAlert(Alert.AlertType.ERROR, msg); showAlert(Alert.AlertType.ERROR, msg);
} }
@ -301,22 +462,32 @@ public class StringAnalysisTabNew2 {
msdTF.setText(""); msdTF.setText("");
msd = new ArrayList<>(); msd = new ArrayList<>();
alsoVisualizeCCB.getItems().removeAll(); if (alsoVisualizeListener != null){
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsLemma); alsoVisualizeCCB.getCheckModel().getCheckedItems().removeListener(alsoVisualizeListener);
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) c -> { }
alsoVisualize = new ArrayList<>();
ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems(); alsoVisualizeListener = new ListChangeListener<String>() {
alsoVisualize.addAll(checkedItems); @Override
logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ","))); public void onChanged(Change<? extends String> c) {
}); alsoVisualize = new ArrayList<>();
ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems();
alsoVisualize.addAll(checkedItems);
logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ",")));
}
};
alsoVisualizeCCB.getCheckModel().clearChecks(); alsoVisualizeCCB.getCheckModel().clearChecks();
alsoVisualizeCCB.getItems().removeAll();
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_LEMMA));
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener(alsoVisualizeListener);
// taxonomy // taxonomy
if (Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType())) { if (Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType())) {
taxonomyCCB.setDisable(false); if (taxonomyListener != null){
taxonomyCCB.getItems().removeAll(); taxonomyCCB.getCheckModel().getCheckedItems().removeListener(taxonomyListener);
taxonomyCCB.getItems().setAll(corpus.getTaxonomy()); }
taxonomyCCB.getCheckModel().getCheckedItems().addListener(new ListChangeListener<String>() {
taxonomyListener = new ListChangeListener<String>() {
boolean changing = true; boolean changing = true;
@Override @Override
@ -343,8 +514,13 @@ public class StringAnalysisTabNew2 {
logger.info(String.format("Selected taxonomy: %s", StringUtils.join(checkedItems, ","))); logger.info(String.format("Selected taxonomy: %s", StringUtils.join(checkedItems, ",")));
} }
} }
}); };
taxonomyCCB.getCheckModel().clearChecks(); taxonomyCCB.getCheckModel().clearChecks();
taxonomyCCB.setDisable(false);
taxonomyCCB.getItems().removeAll();
taxonomyCCB.getItems().setAll(corpus.getTaxonomy());
taxonomyCCB.getCheckModel().getCheckedItems().addListener(taxonomyListener);
} else { } else {
taxonomyCCB.setDisable(true); taxonomyCCB.setDisable(true);
} }
@ -373,14 +549,14 @@ public class StringAnalysisTabNew2 {
String value = stringLengthTF.getText(); String value = stringLengthTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("stringlengthTf: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("stringlengthTf: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} }
stringLength = Integer.parseInt(value); stringLength = Integer.parseInt(value);
} else { } else {
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_MISSING_STRING_LENGTH); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_MISSING_STRING_LENGTH"));
stringLengthTF.setText("1"); stringLengthTF.setText("1");
logAlert(WARNING_MISSING_STRING_LENGTH); logAlert(I18N.get("message.WARNING_MISSING_STRING_LENGTH"));
} }
} }
}); });
@ -391,8 +567,8 @@ public class StringAnalysisTabNew2 {
String value = minimalOccurrencesTF.getText(); String value = minimalOccurrencesTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("minimalOccurrencesTF: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("minimalOccurrencesTF: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} else { } else {
minimalOccurrences = Integer.parseInt(value); minimalOccurrences = Integer.parseInt(value);
} }
@ -409,8 +585,8 @@ public class StringAnalysisTabNew2 {
String value = minimalTaxonomyTF.getText(); String value = minimalTaxonomyTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("minimalTaxonomyTF: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("minimalTaxonomyTF: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} else { } else {
minimalTaxonomy = Integer.parseInt(value); minimalTaxonomy = Integer.parseInt(value);
} }
@ -421,6 +597,17 @@ public class StringAnalysisTabNew2 {
} }
}); });
changeLanguageB.setOnAction(e -> {
if (I18N.getLocale() == new Locale.Builder().setLanguage("sl").setRegion("SI").build()){
I18N.setLocale(Locale.ENGLISH);
} else {
I18N.setLocale(new Locale.Builder().setLanguage("sl").setRegion("SI").build());
}
Messages.reload();
Messages.updateChooseCorpusL();
logger.info("change language");
});
computeNgramsB.setOnAction(e -> { computeNgramsB.setOnAction(e -> {
compute(); compute();
logger.info("compute button"); logger.info("compute button");
@ -534,6 +721,32 @@ public class StringAnalysisTabNew2 {
// //
// } // }
private void manageTranslations(){
helpH.textProperty().bind(I18N.createStringBinding("hyperlink.help"));
changeLanguageB.textProperty().bind(I18N.createStringBinding("button.language"));
computeNgramsB.textProperty().bind(I18N.createStringBinding("button.computeNgrams"));
cancel.textProperty().bind(I18N.createStringBinding("button.cancel"));
calculateForL.textProperty().bind(I18N.createStringBinding("label.calculateFor"));
alsoVisualizeL.textProperty().bind(I18N.createStringBinding("label.alsoVisualize"));
displayTaxonomyL.textProperty().bind(I18N.createStringBinding("label.displayTaxonomy"));
// writeMsdAtTheEndL.textProperty().bind(I18N.createStringBinding("label.writeMsdAtTheEnd"));
skipValueL.textProperty().bind(I18N.createStringBinding("label.skipValue"));
slowSpeedWarning1L.textProperty().bind(I18N.createStringBinding("label.slowSpeedWarning"));
slowSpeedWarning2L.textProperty().bind(I18N.createStringBinding("label.slowSpeedWarning"));
ngramValueL.textProperty().bind(I18N.createStringBinding("label.ngramValue"));
notePunctuationsL.textProperty().bind(I18N.createStringBinding("label.notePunctuations"));
collocabilityL.textProperty().bind(I18N.createStringBinding("label.collocability"));
dataLimitL.textProperty().bind(I18N.createStringBinding("label.dataLimit"));
msdL.textProperty().bind(I18N.createStringBinding("label.msd"));
taxonomyL.textProperty().bind(I18N.createStringBinding("label.taxonomy"));
minimalOccurrencesL.textProperty().bind(I18N.createStringBinding("label.minimalOccurrences"));
minimalTaxonomyL.textProperty().bind(I18N.createStringBinding("label.minimalTaxonomy"));
solarFilters.textProperty().bind(I18N.createStringBinding("label.solarFilters"));
}
/** /**
* Toggles visibility for panes which hold fields for skipgram value (not applicable when calculating for letters) etc., * Toggles visibility for panes which hold fields for skipgram value (not applicable when calculating for letters) etc.,
* sets combobox values to what is applicable ... * sets combobox values to what is applicable ...
@ -553,36 +766,20 @@ public class StringAnalysisTabNew2 {
// if (corpus.getCorpusType() == CorpusType.GOS) // if (corpus.getCorpusType() == CorpusType.GOS)
// calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_GOS); // calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_GOS);
// else // else
if (corpus.getCorpusType() == CorpusType.GOS) if (corpus.getCorpusType() == CorpusType.GOS) {
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_GOS); calculateForCB.itemsProperty().unbind();
else calculateForCB.itemsProperty().bind(I18N.createObjectBinding(N_GRAM_COMPUTE_FOR_WORDS_GOS));
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS);
// calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS);
} else if (mode == MODE.LETTER) {
paneWords.setVisible(false);
paneLetters.setVisible(true);
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_LETTERS);
// populate with default cvv length value
if (stringLength == null) {
stringLengthTF.setText("1");
stringLength = 1;
} else { } else {
stringLengthTF.setText(String.valueOf(stringLength)); calculateForCB.itemsProperty().unbind();
calculateForCB.itemsProperty().bind(I18N.createObjectBinding(N_GRAM_COMPUTE_FOR_WORDS));
} }
// if calculateFor was selected for something other than a word or a lemma -> reset
if (!(calculateFor == CalculateFor.WORD || calculateFor == CalculateFor.LEMMA)) {
// if the user selected something else before selecting ngram for letters, reset that choice
calculateFor = CalculateFor.WORD;
calculateForCB.getSelectionModel().select("različnica");
}
} }
// override if orth mode, allow only word // override if orth mode, allow only word
if (corpus.isGosOrthMode()) { if (corpus.isGosOrthMode()) {
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_ORTH); calculateForCB.itemsProperty().unbind();
calculateForCB.itemsProperty().bind(I18N.createObjectBinding(N_GRAM_COMPUTE_FOR_WORDS_ORTH));
msdTF.setDisable(true); msdTF.setDisable(true);
} else { } else {
msdTF.setDisable(false); msdTF.setDisable(false);
@ -676,9 +873,9 @@ public class StringAnalysisTabNew2 {
i++; i++;
this.updateProgress(i, corpusFiles.size() * 2); this.updateProgress(i, corpusFiles.size() * 2);
if (statistic.getFilter().getCollocability().size() > 0) { if (statistic.getFilter().getCollocability().size() > 0) {
this.updateMessage(String.format(ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y, i, corpusFiles.size() * 2, f.getName())); this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size() * 2, f.getName()));
} else { } else {
this.updateMessage(String.format(ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y, i, corpusFiles.size(), f.getName())); this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName()));
} }
} }
@ -690,22 +887,21 @@ public class StringAnalysisTabNew2 {
progressLabel.textProperty().bind(task.messageProperty()); progressLabel.textProperty().bind(task.messageProperty());
task.setOnSucceeded(e -> { task.setOnSucceeded(e -> {
System.out.print("test");
try { try {
System.out.print(statistic); System.out.print(statistic);
// calculate_collocabilities(statistic, statisticsOneGrams); // calculate_collocabilities(statistic, statisticsOneGrams);
statistic.updateCalculateCollocabilities(statisticsOneGrams); statistic.updateCalculateCollocabilities(statisticsOneGrams);
boolean successullySaved = statistic.saveResultToDisk(); boolean successullySaved = statistic.saveResultToDisk();
if (successullySaved) { if (successullySaved) {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED"));
} else { } else {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS"));
} }
} catch (UnsupportedEncodingException e1) { } catch (UnsupportedEncodingException e1) {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_SAVING_RESULTS_TO_CSV); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_SAVING_RESULTS_TO_CSV"));
logger.error("Error while saving", e1); logger.error("Error while saving", e1);
} catch (OutOfMemoryError e1) { } catch (OutOfMemoryError e1) {
showAlert(Alert.AlertType.ERROR, ERROR_NOT_ENOUGH_MEMORY); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_NOT_ENOUGH_MEMORY"));
logger.error("Out of memory error", e1); logger.error("Out of memory error", e1);
} }
// try { // try {
@ -731,7 +927,7 @@ public class StringAnalysisTabNew2 {
}); });
task.setOnFailed(e -> { task.setOnFailed(e -> {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_EXECUTING); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_EXECUTING"));
logger.error("Error while executing", e); logger.error("Error while executing", e);
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
ngramProgressBar.setProgress(0.0); ngramProgressBar.setProgress(0.0);
@ -742,7 +938,7 @@ public class StringAnalysisTabNew2 {
}); });
task.setOnCancelled(e -> { task.setOnCancelled(e -> {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_CANCLED); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_CANCELED"));
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
ngramProgressBar.setProgress(0.0); ngramProgressBar.setProgress(0.0);
ngramProgressBar.setStyle(Settings.FX_ACCENT_OK); ngramProgressBar.setStyle(Settings.FX_ACCENT_OK);
@ -778,15 +974,15 @@ public class StringAnalysisTabNew2 {
readXML(f.toString(), statistic); readXML(f.toString(), statistic);
i++; i++;
if (isCancelled()) { if (isCancelled()) {
updateMessage(CANCELING_NOTIFICATION); updateMessage(I18N.get("message.CANCELING_NOTIFICATION"));
break; break;
} }
if (statistic.getFilter().getCollocability().size() > 0) { if (statistic.getFilter().getCollocability().size() > 0) {
this.updateProgress(i, corpusFiles.size() * 2); this.updateProgress(i, corpusFiles.size() * 2);
this.updateMessage(String.format(ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y, i, corpusFiles.size() * 2, f.getName())); this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size() * 2, f.getName()));
} else { } else {
this.updateProgress(i, corpusFiles.size()); this.updateProgress(i, corpusFiles.size());
this.updateMessage(String.format(ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y, i, corpusFiles.size(), f.getName())); this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName()));
} }
// this.updateMessage(String.format(ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y, i, corpusFiles.size() * 2, f.getName())); // this.updateMessage(String.format(ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y, i, corpusFiles.size() * 2, f.getName()));
} }
@ -816,15 +1012,15 @@ public class StringAnalysisTabNew2 {
// System.out.print(statistics); // System.out.print(statistics);
boolean successullySaved = statistic.saveResultToDisk(); boolean successullySaved = statistic.saveResultToDisk();
if (successullySaved) { if (successullySaved) {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED"));
} else { } else {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS"));
} }
} catch (UnsupportedEncodingException e1) { } catch (UnsupportedEncodingException e1) {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_SAVING_RESULTS_TO_CSV); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_SAVING_RESULTS_TO_CSV"));
logger.error("Error while saving", e1); logger.error("Error while saving", e1);
} catch (OutOfMemoryError e1) { } catch (OutOfMemoryError e1) {
showAlert(Alert.AlertType.ERROR, ERROR_NOT_ENOUGH_MEMORY); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_NOT_ENOUGH_MEMORY"));
logger.error("Out of memory error", e1); logger.error("Out of memory error", e1);
} }
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
@ -838,7 +1034,7 @@ public class StringAnalysisTabNew2 {
}); });
task.setOnFailed(e -> { task.setOnFailed(e -> {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_EXECUTING); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_EXECUTING"));
logger.error("Error while executing", e); logger.error("Error while executing", e);
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
ngramProgressBar.setProgress(0.0); ngramProgressBar.setProgress(0.0);
@ -849,7 +1045,7 @@ public class StringAnalysisTabNew2 {
}); });
task.setOnCancelled(e -> { task.setOnCancelled(e -> {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_CANCLED); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_CANCELED"));
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
ngramProgressBar.setProgress(0.0); ngramProgressBar.setProgress(0.0);
ngramProgressBar.setStyle(Settings.FX_ACCENT_OK); ngramProgressBar.setStyle(Settings.FX_ACCENT_OK);

@ -99,8 +99,8 @@ public class WordFormationTab {
String value = minimalOccurrencesTF.getText(); String value = minimalOccurrencesTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("minimalOccurrencesTF: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("minimalOccurrencesTF: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} else { } else {
minimalOccurrences = Integer.parseInt(value); minimalOccurrences = Integer.parseInt(value);
} }
@ -117,8 +117,8 @@ public class WordFormationTab {
String value = minimalTaxonomyTF.getText(); String value = minimalTaxonomyTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("minimalTaxonomyTF: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("minimalTaxonomyTF: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} else { } else {
minimalTaxonomy = Integer.parseInt(value); minimalTaxonomy = Integer.parseInt(value);
} }
@ -180,7 +180,7 @@ public class WordFormationTab {
readXML(f.toString(), statistic); readXML(f.toString(), statistic);
i++; i++;
this.updateProgress(i, corpusFiles.size()); this.updateProgress(i, corpusFiles.size());
this.updateMessage(String.format(ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y, i, corpusFiles.size(), f.getName())); this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName()));
} }
return null; return null;
@ -196,12 +196,12 @@ public class WordFormationTab {
boolean successullySaved = statistic.recalculateAndSaveResultToDisk(); boolean successullySaved = statistic.recalculateAndSaveResultToDisk();
if (successullySaved) { if (successullySaved) {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED"));
} else { } else {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS"));
} }
} catch (UnsupportedEncodingException e1) { } catch (UnsupportedEncodingException e1) {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_SAVING_RESULTS_TO_CSV); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_SAVING_RESULTS_TO_CSV"));
logger.error("Error while saving", e1); logger.error("Error while saving", e1);
} }
@ -212,7 +212,7 @@ public class WordFormationTab {
}); });
task.setOnFailed(e -> { task.setOnFailed(e -> {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_EXECUTING); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_EXECUTING"));
logger.error("Error while executing", e); logger.error("Error while executing", e);
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
ngramProgressBar.setProgress(0.0); ngramProgressBar.setProgress(0.0);

@ -2,6 +2,8 @@ package gui;
import data.*; import data.*;
import javafx.application.HostServices; import javafx.application.HostServices;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
@ -33,9 +35,52 @@ public class WordLevelTab {
@FXML @FXML
public Label selectedFiltersLabel; public Label selectedFiltersLabel;
@FXML @FXML
public Label solarFilters; public Label solarFilters;
@FXML
public Label calculateForL;
@FXML
public Label alsoVisualizeL;
@FXML
public Label displayTaxonomyL;
@FXML
public Label lengthSearchL;
@FXML
public Label prefixLengthL;
@FXML
public Label suffixLengthL;
@FXML
public Label listSearchL;
@FXML
public Label prefixListL;
@FXML
public Label suffixListL;
@FXML
public Label dataLimitL;
@FXML
public Label msdL;
@FXML
public Label taxonomyL;
@FXML
public Label minimalOccurrencesL;
@FXML
public Label minimalTaxonomyL;
@FXML @FXML
private TextField msdTF; private TextField msdTF;
private ArrayList<Pattern> msd; private ArrayList<Pattern> msd;
@ -88,6 +133,9 @@ public class WordLevelTab {
@FXML @FXML
private Button computeNgramsB; private Button computeNgramsB;
@FXML
private Button changeLanguageB;
@FXML @FXML
private Button cancel; private Button cancel;
@ -111,17 +159,38 @@ public class WordLevelTab {
private Filter filter; private Filter filter;
private boolean useDb; private boolean useDb;
private HostServices hostService; private HostServices hostService;
private ListChangeListener<String> taxonomyListener;
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica"); private ListChangeListener<String> alsoVisualizeListener;
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica"); private ChangeListener<String> calculateForListener;
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = FXCollections.observableArrayList("različnica");
private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = FXCollections.observableArrayList("lema", "različnica", "normalizirana različnica"); // private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica");
private static final ObservableList<String> alsoVisualizeItemsLemma = FXCollections.observableArrayList("besedna vrsta", "oblikoskladenjska oznaka"); // private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica");
private static final ObservableList<String> alsoVisualizeItemsWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka"); private static final String [] N_GRAM_COMPUTE_FOR_WORDS_ARRAY = {"calculateFor.WORD", "calculateFor.LEMMA"};
private static final ObservableList<String> alsoVisualizeItemsWordGos = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka", "normalizirana različnica"); private static final ArrayList<String> N_GRAM_COMPUTE_FOR_WORDS = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_WORDS_ARRAY));
private static final ObservableList<String> alsoVisualizeItemsNormalizedWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka"); // private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = FXCollections.observableArrayList("različnica");
private static final ObservableList<String> alsoVisualizeItemsMsd = FXCollections.observableArrayList("besedna vrsta"); private static final String [] N_GRAM_COMPUTE_FOR_WORDS_ORTH_ARRAY = {"calculateFor.WORD"};
private static final ObservableList<String> alsoVisualizeItemsEmpty = FXCollections.observableArrayList(); private static final ArrayList<String> N_GRAM_COMPUTE_FOR_WORDS_ORTH = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_WORDS_ORTH_ARRAY));
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = FXCollections.observableArrayList("lema", "različnica", "normalizirana različnica");
private static final String [] N_GRAM_COMPUTE_FOR_WORDS_GOS_ARRAY = {"calculateFor.WORD", "calculateFor.LEMMA", "calculateFor.NORMALIZED_WORD"};
private static final ArrayList<String> N_GRAM_COMPUTE_FOR_WORDS_GOS = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_WORDS_GOS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsLemma = FXCollections.observableArrayList("besedna vrsta", "oblikoskladenjska oznaka");
private static final String [] ALSO_VISUALIZE_ITEMS_LEMMA_ARRAY = {"calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_LEMMA = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_LEMMA_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
private static final String [] ALSO_VISUALIZE_ITEMS_WORDS_ARRAY = {"calculateFor.LEMMA", "calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_WORDS = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_WORDS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsWordGos = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka", "normalizirana različnica");
private static final String [] ALSO_VISUALIZE_ITEMS_WORDS_GOS_ARRAY = {"calculateFor.LEMMA", "calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS", "calculateFor.NORMALIZED_WORD"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_WORDS_GOS = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_WORDS_GOS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsNormalizedWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
private static final String [] ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS_ARRAY = {"calculateFor.LEMMA", "calculateFor.WORD_TYPE", "calculateFor.MORPHOSYNTACTIC_SPECS"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsMsd = FXCollections.observableArrayList("besedna vrsta");
private static final String [] ALSO_VISUALIZE_ITEMS_MSD_ARRAY = {"calculateFor.WORD_TYPE"};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_MSD = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_MSD_ARRAY));
// private static final ObservableList<String> alsoVisualizeItemsEmpty = FXCollections.observableArrayList();
private static final String [] ALSO_VISUALIZE_ITEMS_EMPTY_ARRAY = {};
private static final ArrayList<String> ALSO_VISUALIZE_ITEMS_EMPTY = new ArrayList<>(Arrays.asList(ALSO_VISUALIZE_ITEMS_EMPTY_ARRAY));
// TODO: pass observables for taxonomy based on header scan // TODO: pass observables for taxonomy based on header scan
// after header scan // after header scan
@ -133,33 +202,72 @@ public class WordLevelTab {
wordLevelAnalysisTabPane.getStylesheets().add("style.css"); wordLevelAnalysisTabPane.getStylesheets().add("style.css");
wordLevelAnalysisTabPane.getStyleClass().add("root"); wordLevelAnalysisTabPane.getStyleClass().add("root");
manageTranslations();
currentMode = MODE.WORD; currentMode = MODE.WORD;
toggleMode(currentMode); toggleMode(currentMode);
AtomicBoolean writeMsdAtTheEndEnableCalculateFor = new AtomicBoolean(false); AtomicBoolean writeMsdAtTheEndEnableCalculateFor = new AtomicBoolean(false);
if (calculateForListener != null){
calculateForCB.valueProperty().removeListener(calculateForListener);
}
// calculateForCB // calculateForCB
calculateForCB.valueProperty().addListener((observable, oldValue, newValue) -> {
calculateFor = CalculateFor.factory(newValue); calculateForListener = new ChangeListener<String>() {
boolean ignoreCode = false;
alsoVisualizeCCB.getItems().removeAll(); @Override
if(newValue.equals("lema")){ public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsLemma); if (ignoreCode){
} else if(newValue.equals("različnica")) { return;
if (corpus.getCorpusType() == CorpusType.GOS) }
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsWordGos); boolean languageChanged = newValue == null;
else ArrayList<Integer> checkedIndices = new ArrayList<>();
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsWord); checkedIndices.addAll(alsoVisualizeCCB.getCheckModel().getCheckedIndices());
} else if(newValue.equals("normalizirana različnica")) { if (languageChanged) {
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsNormalizedWord); ignoreCode = true;
} else if(newValue.equals("oblikoskladenjska oznaka")) { if (corpus.getCorpusType() == CorpusType.GOS) {
newValue = I18N.getTranslatedValue(oldValue, N_GRAM_COMPUTE_FOR_WORDS_GOS);
calculateForCB.getSelectionModel().select(newValue);
} else {
newValue = I18N.getTranslatedValue(oldValue, N_GRAM_COMPUTE_FOR_WORDS);
calculateForCB.getSelectionModel().select(newValue);
}
// override if orth mode, allow only word
if (corpus.isGosOrthMode()) {
newValue = I18N.getTranslatedValue(oldValue, N_GRAM_COMPUTE_FOR_WORDS_ORTH);
calculateForCB.getSelectionModel().select(newValue);
}
ignoreCode = false;
}
calculateFor = CalculateFor.factory(newValue);
if (alsoVisualizeListener != null) {
alsoVisualizeCCB.getCheckModel().getCheckedItems().removeListener(alsoVisualizeListener);
}
alsoVisualizeCCB.getCheckModel().clearChecks();
alsoVisualizeCCB.getItems().removeAll();
if (newValue.equals(CalculateFor.LEMMA.toString())) {
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_LEMMA));
} else if (newValue.equals(CalculateFor.WORD.toString())) {
if (corpus.getCorpusType() == CorpusType.GOS)
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_WORDS_GOS));
else
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_WORDS));
} else if (newValue.equals(CalculateFor.NORMALIZED_WORD.toString())) {
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_NORMALIZED_WORDS));
} else if (newValue.equals(CalculateFor.MORPHOSYNTACTIC_SPECS.toString())) {
// writeMsdAtTheEndEnableCalculateFor.set(true); // writeMsdAtTheEndEnableCalculateFor.set(true);
// writeMsdAtTheEndChB.setDisable(false); // writeMsdAtTheEndChB.setDisable(false);
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsMsd); alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_MSD));
}else { } else {
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsEmpty); alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_EMPTY));
} }
// if (!newValue.equals("oblikoskladenjska oznaka")){ // if (!newValue.equals("oblikoskladenjska oznaka")){
// writeMsdAtTheEnd = false; // writeMsdAtTheEnd = false;
@ -168,16 +276,33 @@ public class WordLevelTab {
// writeMsdAtTheEndEnableCalculateFor.set(false); // writeMsdAtTheEndEnableCalculateFor.set(false);
// } // }
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) c -> { alsoVisualizeListener = new ListChangeListener<String>() {
alsoVisualize = new ArrayList<>(); @Override
ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems(); public void onChanged(Change<? extends String> c) {
alsoVisualize.addAll(checkedItems); alsoVisualize = new ArrayList<>();
logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ","))); ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems();
}); alsoVisualize.addAll(checkedItems);
alsoVisualizeCCB.getCheckModel().clearChecks(); logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ",")));
}
};
logger.info("calculateForCB:", calculateFor.toString()); // alsoVisualizeCCB.getCheckModel().clearChecks();
}); // alsoVisualizeCCB.getItems().removeAll();
// alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_LEMMA));
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener(alsoVisualizeListener);
if (languageChanged) {
for (int i : checkedIndices) {
alsoVisualizeCCB.getCheckModel().check(i);
}
}
logger.info("calculateForCB:", calculateFor.toString());
}
};
calculateForCB.valueProperty().addListener(calculateForListener);
calculateForCB.getSelectionModel().select(0); calculateForCB.getSelectionModel().select(0);
@ -302,7 +427,7 @@ public class WordLevelTab {
int nOfRequiredMsdTokens = 1; int nOfRequiredMsdTokens = 1;
if (msdTmp.size() != nOfRequiredMsdTokens) { if (msdTmp.size() != nOfRequiredMsdTokens) {
String msg = String.format(Messages.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES, nOfRequiredMsdTokens, msdTmp.size()); String msg = String.format(I18N.get("message.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES"), nOfRequiredMsdTokens, msdTmp.size());
logAlert(msg); logAlert(msg);
showAlert(Alert.AlertType.ERROR, msg); showAlert(Alert.AlertType.ERROR, msg);
} }
@ -324,29 +449,34 @@ public class WordLevelTab {
msdTF.setText(""); msdTF.setText("");
msd = new ArrayList<>(); msd = new ArrayList<>();
alsoVisualizeCCB.getItems().removeAll(); if (alsoVisualizeListener != null){
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsLemma); alsoVisualizeCCB.getCheckModel().getCheckedItems().removeListener(alsoVisualizeListener);
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) c -> { }
alsoVisualize = new ArrayList<>();
ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems(); alsoVisualizeListener = new ListChangeListener<String>() {
alsoVisualize.addAll(checkedItems); @Override
// if (checkedItems.contains("oblikoskladenjska oznaka") || writeMsdAtTheEndEnableCalculateFor.get()){ public void onChanged(Change<? extends String> c) {
// writeMsdAtTheEndChB.setDisable(false); alsoVisualize = new ArrayList<>();
// } else { ObservableList<String> checkedItems = alsoVisualizeCCB.getCheckModel().getCheckedItems();
// writeMsdAtTheEnd = false; alsoVisualize.addAll(checkedItems);
// writeMsdAtTheEndChB.setSelected(false);
// writeMsdAtTheEndChB.setDisable(true); logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ",")));
// } }
logger.info(String.format("Selected also visualize items: %s", StringUtils.join(checkedItems, ","))); };
});
alsoVisualizeCCB.getCheckModel().clearChecks(); alsoVisualizeCCB.getCheckModel().clearChecks();
alsoVisualizeCCB.getItems().removeAll();
alsoVisualizeCCB.getItems().setAll(I18N.translatedObservableList(ALSO_VISUALIZE_ITEMS_LEMMA));
alsoVisualizeCCB.getCheckModel().getCheckedItems().addListener(alsoVisualizeListener);
// taxonomy // taxonomy
if (Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType())) { if (Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType())) {
taxonomyCCB.setDisable(false); if (taxonomyListener != null){
taxonomyCCB.getItems().removeAll(); taxonomyCCB.getCheckModel().getCheckedItems().removeListener(taxonomyListener);
taxonomyCCB.getItems().setAll(corpus.getTaxonomy()); }
taxonomyCCB.getCheckModel().getCheckedItems().addListener(new ListChangeListener<String>() {
taxonomyListener = new ListChangeListener<String>() {
boolean changing = true; boolean changing = true;
@Override @Override
@ -373,8 +503,14 @@ public class WordLevelTab {
logger.info(String.format("Selected taxonomy: %s", StringUtils.join(checkedItems, ","))); logger.info(String.format("Selected taxonomy: %s", StringUtils.join(checkedItems, ",")));
} }
} }
}); };
taxonomyCCB.getCheckModel().clearChecks(); taxonomyCCB.getCheckModel().clearChecks();
taxonomyCCB.setDisable(false);
taxonomyCCB.getItems().removeAll();
taxonomyCCB.getItems().setAll(corpus.getTaxonomy());
taxonomyCCB.getCheckModel().getCheckedItems().addListener(taxonomyListener);
} else { } else {
taxonomyCCB.setDisable(true); taxonomyCCB.setDisable(true);
} }
@ -396,7 +532,7 @@ public class WordLevelTab {
} }
logger.info("display taxonomy: ", displayTaxonomy); logger.info("display taxonomy: ", displayTaxonomy);
}); });
displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB)); displayTaxonomyChB.setTooltip(new Tooltip(I18N.get("message.TOOLTIP_readDisplayTaxonomyChB")));
} else { } else {
displayTaxonomyChB.setDisable(true); displayTaxonomyChB.setDisable(true);
} }
@ -425,8 +561,8 @@ public class WordLevelTab {
String value = minimalOccurrencesTF.getText(); String value = minimalOccurrencesTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("minimalOccurrencesTF: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("minimalOccurrencesTF: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} else { } else {
minimalOccurrences = Integer.parseInt(value); minimalOccurrences = Integer.parseInt(value);
} }
@ -443,8 +579,8 @@ public class WordLevelTab {
String value = minimalTaxonomyTF.getText(); String value = minimalTaxonomyTF.getText();
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
if (!ValidationUtil.isNumber(value)) { if (!ValidationUtil.isNumber(value)) {
logAlert("minimalTaxonomyTF: " + WARNING_ONLY_NUMBERS_ALLOWED); logAlert("minimalTaxonomyTF: " + I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED); GUIController.showAlert(Alert.AlertType.ERROR, I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED"));
} else { } else {
minimalTaxonomy = Integer.parseInt(value); minimalTaxonomy = Integer.parseInt(value);
} }
@ -455,6 +591,17 @@ public class WordLevelTab {
} }
}); });
changeLanguageB.setOnAction(e -> {
if (I18N.getLocale() == new Locale.Builder().setLanguage("sl").setRegion("SI").build()){
I18N.setLocale(Locale.ENGLISH);
} else {
I18N.setLocale(new Locale.Builder().setLanguage("sl").setRegion("SI").build());
}
Messages.reload();
Messages.updateChooseCorpusL();
logger.info("change language");
});
computeNgramsB.setDisable(true); computeNgramsB.setDisable(true);
computeNgramsB.setOnAction(e -> { computeNgramsB.setOnAction(e -> {
@ -545,6 +692,32 @@ public class WordLevelTab {
// //
// } // }
private void manageTranslations(){
helpH.textProperty().bind(I18N.createStringBinding("hyperlink.help"));
changeLanguageB.textProperty().bind(I18N.createStringBinding("button.language"));
computeNgramsB.textProperty().bind(I18N.createStringBinding("button.computeNgrams"));
cancel.textProperty().bind(I18N.createStringBinding("button.cancel"));
calculateForL.textProperty().bind(I18N.createStringBinding("label.calculateFor"));
alsoVisualizeL.textProperty().bind(I18N.createStringBinding("label.alsoVisualize"));
displayTaxonomyL.textProperty().bind(I18N.createStringBinding("label.displayTaxonomy"));
lengthSearchL.textProperty().bind(I18N.createStringBinding("label.lengthSearch"));
prefixLengthL.textProperty().bind(I18N.createStringBinding("label.prefixLength"));
suffixLengthL.textProperty().bind(I18N.createStringBinding("label.suffixLength"));
listSearchL.textProperty().bind(I18N.createStringBinding("label.listSearch"));
prefixListL.textProperty().bind(I18N.createStringBinding("label.prefixList"));
suffixListL.textProperty().bind(I18N.createStringBinding("label.suffixList"));
dataLimitL.textProperty().bind(I18N.createStringBinding("label.dataLimit"));
msdL.textProperty().bind(I18N.createStringBinding("label.msd"));
taxonomyL.textProperty().bind(I18N.createStringBinding("label.taxonomy"));
minimalOccurrencesL.textProperty().bind(I18N.createStringBinding("label.minimalOccurrences"));
minimalTaxonomyL.textProperty().bind(I18N.createStringBinding("label.minimalTaxonomy"));
solarFilters.textProperty().bind(I18N.createStringBinding("label.solarFilters"));
}
/** /**
* Toggles visibility for panes which hold fields for skipgram value (not applicable when calculating for letters) etc., * Toggles visibility for panes which hold fields for skipgram value (not applicable when calculating for letters) etc.,
* sets combobox values to what is applicable ... * sets combobox values to what is applicable ...
@ -559,25 +732,22 @@ public class WordLevelTab {
logger.info("mode: ", mode.toString()); logger.info("mode: ", mode.toString());
if (mode == MODE.WORD) { if (mode == MODE.WORD) {
if (corpus.getCorpusType() == CorpusType.GOS) if (corpus.getCorpusType() == CorpusType.GOS) {
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_GOS); calculateForCB.itemsProperty().unbind();
else calculateForCB.itemsProperty().bind(I18N.createObjectBinding(N_GRAM_COMPUTE_FOR_WORDS_GOS));
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS); // calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_GOS);
} else if (mode == MODE.LETTER) { } else {
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_LETTERS); calculateForCB.itemsProperty().unbind();
calculateForCB.itemsProperty().bind(I18N.createObjectBinding(N_GRAM_COMPUTE_FOR_WORDS));
// calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS);
// if calculateFor was selected for something other than a word or a lemma -> reset
if (!(calculateFor == CalculateFor.WORD || calculateFor == CalculateFor.LEMMA)) {
// if the user selected something else before selecting ngram for letters, reset that choice
calculateFor = CalculateFor.WORD;
calculateForCB.getSelectionModel().select("različnica");
} }
} }
// override if orth mode, allow only word // override if orth mode, allow only word
if (corpus.isGosOrthMode()) { if (corpus.isGosOrthMode()) {
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_ORTH); calculateForCB.itemsProperty().unbind();
calculateForCB.itemsProperty().bind(I18N.createObjectBinding(N_GRAM_COMPUTE_FOR_WORDS_ORTH));
// calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_ORTH);
msdTF.setDisable(true); msdTF.setDisable(true);
} else { } else {
msdTF.setDisable(false); msdTF.setDisable(false);
@ -668,11 +838,11 @@ public class WordLevelTab {
readXML(f.toString(), statistic); readXML(f.toString(), statistic);
i++; i++;
if (isCancelled()) { if (isCancelled()) {
updateMessage(CANCELING_NOTIFICATION); updateMessage(I18N.get("message.CANCELING_NOTIFICATION"));
break; break;
} }
this.updateProgress(i, corpusFiles.size()); this.updateProgress(i, corpusFiles.size());
this.updateMessage(String.format(ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y, i, corpusFiles.size(), f.getName())); this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName()));
} }
return null; return null;
@ -686,12 +856,12 @@ public class WordLevelTab {
try { try {
boolean successullySaved = statistic.saveResultToDisk(); boolean successullySaved = statistic.saveResultToDisk();
if (successullySaved) { if (successullySaved) {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED"));
} else { } else {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS"));
} }
} catch (UnsupportedEncodingException e1) { } catch (UnsupportedEncodingException e1) {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_SAVING_RESULTS_TO_CSV); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_SAVING_RESULTS_TO_CSV"));
logger.error("Error while saving", e1); logger.error("Error while saving", e1);
} }
@ -703,7 +873,7 @@ public class WordLevelTab {
}); });
task.setOnFailed(e -> { task.setOnFailed(e -> {
showAlert(Alert.AlertType.ERROR, ERROR_WHILE_EXECUTING); showAlert(Alert.AlertType.ERROR, I18N.get("message.ERROR_WHILE_EXECUTING"));
logger.error("Error while executing", e); logger.error("Error while executing", e);
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
ngramProgressBar.setProgress(0.0); ngramProgressBar.setProgress(0.0);
@ -714,7 +884,7 @@ public class WordLevelTab {
}); });
task.setOnCancelled(e -> { task.setOnCancelled(e -> {
showAlert(Alert.AlertType.INFORMATION, Messages.NOTIFICATION_ANALYSIS_CANCLED); showAlert(Alert.AlertType.INFORMATION, I18N.get("message.NOTIFICATION_ANALYSIS_CANCELED"));
ngramProgressBar.progressProperty().unbind(); ngramProgressBar.progressProperty().unbind();
ngramProgressBar.setProgress(0.0); ngramProgressBar.setProgress(0.0);
ngramProgressBar.setStyle(Settings.FX_ACCENT_OK); ngramProgressBar.setStyle(Settings.FX_ACCENT_OK);

@ -10,6 +10,7 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import data.*; import data.*;
import gui.I18N;
import gui.ValidationUtil; import gui.ValidationUtil;
import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter; import org.apache.commons.csv.CSVPrinter;
@ -90,23 +91,23 @@ public class Export {
//CSV file header //CSV file header
if (!ValidationUtil.isEmpty(filter.getSkipValue()) && filter.getSkipValue() > 0) { if (!ValidationUtil.isEmpty(filter.getSkipValue()) && filter.getSkipValue() > 0) {
FILE_HEADER_AL.add("Izpuščene besede"); FILE_HEADER_AL.add(I18N.get("exportTable.skippedWords"));
} }
FILE_HEADER_AL.add(filter.getCalculateFor().toHeaderString(filter.getNgramValue())); FILE_HEADER_AL.add(filter.getCalculateFor().toHeaderString(filter.getNgramValue()));
if (filter.getCalculateFor().equals(CalculateFor.LEMMA)) { if (filter.getCalculateFor().equals(CalculateFor.LEMMA)) {
if(filter.getNgramValue() == 0) { if(filter.getNgramValue() == 0) {
FILE_HEADER_AL.add("Črkovni niz (male črke)"); FILE_HEADER_AL.add(I18N.get("exportTable.lettersSmall"));
} else if(filter.getNgramValue() >= 1) { } else if(filter.getNgramValue() >= 1) {
FILE_HEADER_AL.add("Lema (male črke)"); FILE_HEADER_AL.add(I18N.get("exportTable.wordsSmall"));
} }
} }
if (filter.getSuffixLength() != null && filter.getSuffixList() != null && filter.getPrefixLength() != null && filter.getPrefixList() != null) { if (filter.getSuffixLength() != null && filter.getSuffixList() != null && filter.getPrefixLength() != null && filter.getPrefixList() != null) {
if (filter.getPrefixLength() > 0 || filter.getPrefixList().size() > 0) { if (filter.getPrefixLength() > 0 || filter.getPrefixList().size() > 0) {
FILE_HEADER_AL.add("Začetni del besede"); FILE_HEADER_AL.add(I18N.get("exportTable.wordBeginning"));
} }
FILE_HEADER_AL.add("Preostali del besede"); FILE_HEADER_AL.add(I18N.get("exportTable.wordRest"));
if (filter.getSuffixLength() > 0 || filter.getSuffixList().size() > 0) { if (filter.getSuffixLength() > 0 || filter.getSuffixList().size() > 0) {
FILE_HEADER_AL.add("Končni del besede"); FILE_HEADER_AL.add(I18N.get("exportTable.wordEnding"));
} }
} }
@ -117,14 +118,14 @@ public class Export {
for (CalculateFor otherKey : filter.getMultipleKeys()) { for (CalculateFor otherKey : filter.getMultipleKeys()) {
FILE_HEADER_AL.add(otherKey.toHeaderString(filter.getNgramValue())); FILE_HEADER_AL.add(otherKey.toHeaderString(filter.getNgramValue()));
if (otherKey.equals(CalculateFor.LEMMA)) if (otherKey.equals(CalculateFor.LEMMA))
FILE_HEADER_AL.add("Lema (male črke)"); FILE_HEADER_AL.add(I18N.get("exportTable.wordsSmall"));
} }
FILE_HEADER_AL.add(filter.getCalculateFor().totalAbsoluteFrequencyString(filter.getNgramValue())); FILE_HEADER_AL.add(filter.getCalculateFor().totalAbsoluteFrequencyString(filter.getNgramValue()));
FILE_HEADER_AL.add(filter.getCalculateFor().shareOfTotalString(filter.getNgramValue())); FILE_HEADER_AL.add(filter.getCalculateFor().shareOfTotalString(filter.getNgramValue()));
FILE_HEADER_AL.add("Skupna relativna pogostost (na milijon pojavitev)"); FILE_HEADER_AL.add(I18N.get("exportTable.totalRelativeFrequency"));
if (filter.getCollocability().size() > 0){ if (filter.getCollocability().size() > 0){
for (Collocability c : filter.getCollocability()) { for (Collocability c : filter.getCollocability()) {
@ -134,9 +135,9 @@ public class Export {
for (Taxonomy key : taxonomyResults.keySet()) { for (Taxonomy key : taxonomyResults.keySet()) {
if(!key.equals(Taxonomy.TOTAL) && num_taxonomy_frequencies.containsKey(key) && num_taxonomy_frequencies.get(key).longValue() > 0) { 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(I18N.get("exportTable.absoluteFrequency") + " [" + key.toString() + "]");
FILE_HEADER_AL.add("Delež [" + key.toString() + "]"); FILE_HEADER_AL.add(I18N.get("exportTable.percentage") + " [" + key.toString() + "]");
FILE_HEADER_AL.add("Relativna pogostost [" + key.toString() + "]"); FILE_HEADER_AL.add(I18N.get("exportTable.relativeFrequency") + " [" + key.toString() + "]");
} }
} }
@ -150,7 +151,7 @@ public class Export {
} }
} }
for(int i = 0; i < maxMsdLength; i++){ for(int i = 0; i < maxMsdLength; i++){
FILE_HEADER_AL.add("msd" + String.format("%02d", i + 1)); FILE_HEADER_AL.add(I18N.get("exportTable.msd") + String.format("%02d", i + 1));
} }
} }

@ -18,18 +18,18 @@
<?import java.lang.String?> <?import java.lang.String?>
<AnchorPane fx:id="characterAnalysisTab" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.CharacterAnalysisTab"> <AnchorPane fx:id="characterAnalysisTab" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.CharacterAnalysisTab">
<Pane> <Pane>
<Label layoutX="10.0" layoutY="20.0" prefHeight="25.0" text="Število črk" /> <Label fx:id="stringLengthL" layoutX="10.0" layoutY="20.0" prefHeight="25.0" text="Število črk" />
<TextField fx:id="stringLengthTF" layoutX="185.0" layoutY="20.0" prefWidth="180.0" /> <TextField fx:id="stringLengthTF" layoutX="185.0" layoutY="20.0" prefWidth="180.0" />
<Label layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Izračunaj za"/> <Label fx:id="calculateForL" layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Izračunaj za"/>
<ComboBox fx:id="calculateForCB" layoutX="185.0" layoutY="60.0" minWidth="180.0" prefWidth="150.0" promptText="izberi" <ComboBox fx:id="calculateForCB" layoutX="185.0" layoutY="60.0" minWidth="180.0" prefWidth="150.0"
visibleRowCount="5"> visibleRowCount="5">
<items> <!--<items>-->
<FXCollections fx:factory="observableArrayList"> <!--<FXCollections fx:factory="observableArrayList">-->
<String fx:value="lema"/> <!--<String fx:value="lema"/>-->
<String fx:value="različnica"/> <!--<String fx:value="različnica"/>-->
</FXCollections> <!--</FXCollections>-->
</items> <!--</items>-->
</ComboBox> </ComboBox>
<!--<HBox layoutX="10.0" layoutY="60.0">--> <!--<HBox layoutX="10.0" layoutY="60.0">-->
@ -42,7 +42,7 @@
<!--</children>--> <!--</children>-->
<!--</HBox>--> <!--</HBox>-->
<Label layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Izpiši taksonomije" /> <Label fx:id="displayTaxonomyL" layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Izpiši taksonomije" />
<CheckBox fx:id="displayTaxonomyChB" layoutX="263.0" layoutY="105.0" selected="false" /> <CheckBox fx:id="displayTaxonomyChB" layoutX="263.0" layoutY="105.0" selected="false" />
<!--<Label layoutX="10.0" layoutY="160.0" prefHeight="25.0" text="Omejitev podatkov" />--> <!--<Label layoutX="10.0" layoutY="160.0" prefHeight="25.0" text="Omejitev podatkov" />-->
@ -68,17 +68,17 @@
<Pane layoutX="400.0" prefHeight="480.0" prefWidth="380.0"> <Pane layoutX="400.0" prefHeight="480.0" prefWidth="380.0">
<!-- MSD and Taxonomy separated --> <!-- MSD and Taxonomy separated -->
<Label layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Omejitev podatkov" /> <Label fx:id="dataLimitL" layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Omejitev podatkov" />
<Label layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Oznaka MSD"/> <Label fx:id="msdL" layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Oznaka MSD"/>
<TextField fx:id="msdTF" layoutX="185.0" layoutY="100.0" prefWidth="180.0"/> <TextField fx:id="msdTF" layoutX="185.0" layoutY="100.0" prefWidth="180.0"/>
<Label layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Taksonomija"/> <Label fx:id="taxonomyL" layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Taksonomija"/>
<CheckComboBox fx:id="taxonomyCCB" layoutX="185.0" layoutY="140.0" prefHeight="25.0" prefWidth="180.0"/> <CheckComboBox fx:id="taxonomyCCB" layoutX="185.0" layoutY="140.0" prefHeight="25.0" prefWidth="180.0"/>
<Label layoutX="10.0" layoutY="180.0" prefHeight="25.0" text="Min. št. pojavitev" /> <Label fx:id="minimalOccurrencesL" layoutX="10.0" layoutY="180.0" prefHeight="25.0" text="Min. št. pojavitev" />
<TextField fx:id="minimalOccurrencesTF" layoutX="185.0" layoutY="180.0" prefWidth="180.0" /> <TextField fx:id="minimalOccurrencesTF" layoutX="185.0" layoutY="180.0" prefWidth="180.0" />
<Label layoutX="10.0" layoutY="220.0" prefHeight="25.0" text="Min. št. taksonomij" /> <Label fx:id="minimalTaxonomyL" layoutX="10.0" layoutY="220.0" prefHeight="25.0" text="Min. št. taksonomij" />
<TextField fx:id="minimalTaxonomyTF" layoutX="185.0" layoutY="220.0" prefWidth="180.0" /> <TextField fx:id="minimalTaxonomyTF" layoutX="185.0" layoutY="220.0" prefWidth="180.0" />
@ -90,6 +90,7 @@
<!--<Label fx:id="selectedFiltersLabel" alignment="TOP_LEFT" layoutX="510.0" layoutY="45.0" prefHeight="540.0" prefWidth="275.0" text=" " wrapText="true" />--> <!--<Label fx:id="selectedFiltersLabel" alignment="TOP_LEFT" layoutX="510.0" layoutY="45.0" prefHeight="540.0" prefWidth="275.0" text=" " wrapText="true" />-->
<Hyperlink fx:id="helpH" alignment="TOP_LEFT" layoutX="710.0" layoutY="16.0" text="Pomoč" /> <Hyperlink fx:id="helpH" alignment="TOP_LEFT" layoutX="710.0" layoutY="16.0" text="Pomoč" />
<Button fx:id="changeLanguageB" layoutX="710.0" layoutY="40.0" mnemonicParsing="false"/>
<Button fx:id="cancel" layoutX="540.0" layoutY="482.0" mnemonicParsing="false" <Button fx:id="cancel" layoutX="540.0" layoutY="482.0" mnemonicParsing="false"
prefHeight="25.0" prefWidth="250.0" text="Prekini"/> prefHeight="25.0" prefWidth="250.0" text="Prekini"/>

@ -12,10 +12,8 @@
fx:controller="gui.CorpusTab"> fx:controller="gui.CorpusTab">
<children> <children>
<Pane/> <Pane/>
<Button fx:id="chooseCorpusLocationB" layoutX="10.0" layoutY="20.0" mnemonicParsing="false" <Button fx:id="chooseCorpusLocationB" layoutX="10.0" layoutY="20.0" mnemonicParsing="false"/>
text="Nastavi lokacijo korpusa"/> <CheckBox fx:id="readHeaderInfoChB" layoutX="185.0" layoutY="24.0" mnemonicParsing="false"/>
<CheckBox fx:id="readHeaderInfoChB" layoutX="185.0" layoutY="24.0" mnemonicParsing="false"
text="Preberi info iz headerjev"/>
<Pane fx:id="setCorpusWrapperP" layoutX="10.0" layoutY="60.0" prefHeight="118.0" prefWidth="683.0"> <Pane fx:id="setCorpusWrapperP" layoutX="10.0" layoutY="60.0" prefHeight="118.0" prefWidth="683.0">
<children> <children>
<Label fx:id="chooseCorpusL" prefHeight="70.0" prefWidth="704.0" text="Label"/> <Label fx:id="chooseCorpusL" prefHeight="70.0" prefWidth="704.0" text="Label"/>
@ -23,10 +21,10 @@
</children> </children>
</Pane> </Pane>
<ProgressIndicator fx:id="locationScanPI" layoutX="10.0" layoutY="60.0" prefHeight="50.0" progress="0.0"/> <ProgressIndicator fx:id="locationScanPI" layoutX="10.0" layoutY="60.0" prefHeight="50.0" progress="0.0"/>
<Button fx:id="chooseResultsLocationB" layoutX="10.0" layoutY="180.0" mnemonicParsing="false" <Button fx:id="chooseResultsLocationB" layoutX="10.0" layoutY="180.0" mnemonicParsing="false"/>
text="Nastavi lokacijo rezultatov"/>
<Label fx:id="chooseResultsL" layoutX="10.0" layoutY="220.0" text="Label"/> <Label fx:id="chooseResultsL" layoutX="10.0" layoutY="220.0" text="Label"/>
<Hyperlink fx:id="helpH" alignment="TOP_LEFT" layoutX="710.0" layoutY="20.0" text="Pomoč"/> <Hyperlink fx:id="helpH" alignment="TOP_LEFT" layoutX="710.0" layoutY="20.0"/>
<Button fx:id="changeLanguageB" layoutX="710.0" layoutY="40.0" mnemonicParsing="false"/>
</children> </children>
</AnchorPane> </AnchorPane>

@ -16,7 +16,7 @@
<AnchorPane fx:id="oneWordAnalysisTabPane" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.111" <AnchorPane fx:id="oneWordAnalysisTabPane" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.111"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.OneWordAnalysisTab"> xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.OneWordAnalysisTab">
<Pane> <Pane>
<Label layoutX="10.0" layoutY="20.0" prefHeight="25.0" text="Izračunaj za"/> <Label fx:id="calculateForL" layoutX="10.0" layoutY="20.0" prefHeight="25.0" text="Izračunaj za"/>
<ComboBox fx:id="calculateForCB" layoutX="185.0" layoutY="20.0" minWidth="180.0" prefWidth="150.0" promptText="izberi" <ComboBox fx:id="calculateForCB" layoutX="185.0" layoutY="20.0" minWidth="180.0" prefWidth="150.0" promptText="izberi"
visibleRowCount="5"> visibleRowCount="5">
<items> <items>
@ -30,14 +30,14 @@
</items> </items>
</ComboBox> </ComboBox>
<Label layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Upoštevaj tudi" /> <Label fx:id="alsoVisualizeL" layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Upoštevaj tudi" />
<CheckComboBox fx:id="alsoVisualizeCCB" layoutX="185.0" layoutY="60.0" prefHeight="25.0" prefWidth="180.0"/> <CheckComboBox fx:id="alsoVisualizeCCB" layoutX="185.0" layoutY="60.0" prefHeight="25.0" prefWidth="180.0"/>
<Label layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Izpiši taksonomije" /> <Label fx:id="displayTaxonomyL" layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Izpiši taksonomije" />
<CheckBox fx:id="displayTaxonomyChB" layoutX="263.0" layoutY="105.0" selected="false" /> <CheckBox fx:id="displayTaxonomyChB" layoutX="263.0" layoutY="105.0" selected="false" />
<Label layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Izpiši razbit MSD" /> <Label fx:id="writeMsdAtTheEndL" layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Izpiši razbit MSD" />
<CheckBox fx:id="writeMsdAtTheEndChB" layoutX="263.0" layoutY="145.0" selected="false" /> <CheckBox fx:id="writeMsdAtTheEndChB" layoutX="263.0" layoutY="145.0" selected="false" />
<!-- MSD and Taxonomy separated --> <!-- MSD and Taxonomy separated -->
@ -60,17 +60,17 @@
<Pane layoutX="400.0" prefHeight="480.0" prefWidth="380.0"> <Pane layoutX="400.0" prefHeight="480.0" prefWidth="380.0">
<!-- MSD and Taxonomy separated --> <!-- MSD and Taxonomy separated -->
<Label layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Omejitev podatkov" /> <Label fx:id="dataLimitL" layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Omejitev podatkov" />
<Label layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Oznaka MSD"/> <Label fx:id="msdL" layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Oznaka MSD"/>
<TextField fx:id="msdTF" layoutX="185.0" layoutY="100.0" prefWidth="180.0"/> <TextField fx:id="msdTF" layoutX="185.0" layoutY="100.0" prefWidth="180.0"/>
<Label layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Taksonomija"/> <Label fx:id="taxonomyL" layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Taksonomija"/>
<CheckComboBox fx:id="taxonomyCCB" layoutX="185.0" layoutY="140.0" prefHeight="25.0" prefWidth="180.0"/> <CheckComboBox fx:id="taxonomyCCB" layoutX="185.0" layoutY="140.0" prefHeight="25.0" prefWidth="180.0"/>
<Label layoutX="10.0" layoutY="180.0" prefHeight="25.0" text="Min. št. pojavitev" /> <Label fx:id="minimalOccurrencesL" layoutX="10.0" layoutY="180.0" prefHeight="25.0" text="Min. št. pojavitev" />
<TextField fx:id="minimalOccurrencesTF" layoutX="185.0" layoutY="180.0" prefWidth="180.0" /> <TextField fx:id="minimalOccurrencesTF" layoutX="185.0" layoutY="180.0" prefWidth="180.0" />
<Label layoutX="10.0" layoutY="220.0" prefHeight="25.0" text="Min. št. taksonomij" /> <Label fx:id="minimalTaxonomyL" layoutX="10.0" layoutY="220.0" prefHeight="25.0" text="Min. št. taksonomij" />
<TextField fx:id="minimalTaxonomyTF" layoutX="185.0" layoutY="220.0" prefWidth="180.0" /> <TextField fx:id="minimalTaxonomyTF" layoutX="185.0" layoutY="220.0" prefWidth="180.0" />
@ -84,6 +84,7 @@
<!--</Pane>--> <!--</Pane>-->
<Hyperlink fx:id="helpH" alignment="TOP_LEFT" layoutX="710.0" layoutY="16.0" text="Pomoč" /> <Hyperlink fx:id="helpH" alignment="TOP_LEFT" layoutX="710.0" layoutY="16.0" text="Pomoč" />
<Button fx:id="changeLanguageB" layoutX="710.0" layoutY="40.0" mnemonicParsing="false"/>
<Button fx:id="cancel" layoutX="540.0" layoutY="482.0" mnemonicParsing="false" <Button fx:id="cancel" layoutX="540.0" layoutY="482.0" mnemonicParsing="false"
prefHeight="25.0" prefWidth="250.0" text="Prekini"/> prefHeight="25.0" prefWidth="250.0" text="Prekini"/>

@ -20,7 +20,7 @@
<Pane fx:id="paneWords"> <Pane fx:id="paneWords">
<children> <children>
<Label layoutX="10.0" layoutY="180.0" prefHeight="25.0" text="Preskok besed" /> <Label fx:id="skipValueL" layoutX="10.0" layoutY="180.0" prefHeight="25.0" text="Preskok besed" />
<ComboBox fx:id="skipValueCB" layoutX="185.0" layoutY="180.0" prefWidth="180.0" promptText="izberi" visibleRowCount="5"> <ComboBox fx:id="skipValueCB" layoutX="185.0" layoutY="180.0" prefWidth="180.0" promptText="izberi" visibleRowCount="5">
<items> <items>
<FXCollections fx:factory="observableArrayList"> <FXCollections fx:factory="observableArrayList">
@ -38,10 +38,10 @@
</children> </children>
</Pane> </Pane>
<Label layoutX="10.0" layoutY="210.0" prefHeight="10.0" text="* IZBIRA PREDHODNEGA FILTRA LAHKO MOČNO UPOČASNI DELOVANJE" styleClass="test"/> <Label fx:id="slowSpeedWarning1L" layoutX="10.0" layoutY="210.0" prefHeight="10.0" text="* IZBIRA PREDHODNEGA FILTRA LAHKO MOČNO UPOČASNI DELOVANJE" styleClass="test"/>
<!-- for some reason following two ComboBoxes have to be below paneWords --> <!-- for some reason following two ComboBoxes have to be below paneWords -->
<Label layoutX="10.0" layoutY="20.0" prefHeight="25.0" text="Izračunaj za" /> <Label fx:id="calculateForL" layoutX="10.0" layoutY="20.0" prefHeight="25.0" text="Izračunaj za" />
<ComboBox fx:id="calculateForCB" layoutX="185.0" layoutY="20.0" minWidth="180.0" prefWidth="180.0" promptText="izberi" visibleRowCount="5"> <ComboBox fx:id="calculateForCB" layoutX="185.0" layoutY="20.0" minWidth="180.0" prefWidth="180.0" promptText="izberi" visibleRowCount="5">
<items> <items>
<FXCollections fx:factory="observableArrayList"> <FXCollections fx:factory="observableArrayList">
@ -54,15 +54,15 @@
</items> </items>
</ComboBox> </ComboBox>
<Label layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Upoštevaj tudi" /> <Label fx:id="alsoVisualizeL" layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Upoštevaj tudi" />
<CheckComboBox fx:id="alsoVisualizeCCB" layoutX="185.0" layoutY="60.0" prefHeight="25.0" prefWidth="180.0"/> <CheckComboBox fx:id="alsoVisualizeCCB" layoutX="185.0" layoutY="60.0" prefHeight="25.0" prefWidth="180.0"/>
<Label layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Izpiši taksonomije" /> <Label fx:id="displayTaxonomyL" layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Izpiši taksonomije" />
<CheckBox fx:id="displayTaxonomyChB" layoutX="263.0" layoutY="105.0" selected="false" /> <CheckBox fx:id="displayTaxonomyChB" layoutX="263.0" layoutY="105.0" selected="false" />
<Label layoutX="10.0" layoutY="130.0" prefHeight="10.0" text="* IZBIRA PREDHODNEGA FILTRA LAHKO MOČNO UPOČASNI DELOVANJE" styleClass="test"/> <Label fx:id="slowSpeedWarning2L" layoutX="10.0" layoutY="130.0" prefHeight="10.0" text="* IZBIRA PREDHODNEGA FILTRA LAHKO MOČNO UPOČASNI DELOVANJE" styleClass="test"/>
<Label layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="N-gram nivo" /> <Label fx:id="ngramValueL" layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="N-gram nivo" />
<ComboBox fx:id="ngramValueCB" layoutX="185.0" layoutY="140.0" prefHeight="25.0" prefWidth="180.0" promptText="izberi" visibleRowCount="5"> <ComboBox fx:id="ngramValueCB" layoutX="185.0" layoutY="140.0" prefHeight="25.0" prefWidth="180.0" promptText="izberi" visibleRowCount="5">
<items> <items>
<FXCollections fx:factory="observableArrayList"> <FXCollections fx:factory="observableArrayList">
@ -75,10 +75,10 @@
</ComboBox> </ComboBox>
<Label layoutX="10.0" layoutY="220.0" prefHeight="25.0" text="Upoštevaj ločila" /> <Label fx:id="notePunctuationsL" layoutX="10.0" layoutY="220.0" prefHeight="25.0" text="Upoštevaj ločila" />
<CheckBox fx:id="notePunctuationsChB" layoutX="263.0" layoutY="225.0" selected="false" /> <CheckBox fx:id="notePunctuationsChB" layoutX="263.0" layoutY="225.0" selected="false" />
<Label layoutX="10.0" layoutY="260.0" prefHeight="25.0" text="Kolokabilnost" /> <Label fx:id="collocabilityL" layoutX="10.0" layoutY="260.0" prefHeight="25.0" text="Kolokabilnost" />
<CheckComboBox fx:id="collocabilityCCB" layoutX="185.0" layoutY="260.0" prefHeight="25.0" prefWidth="180.0"/> <CheckComboBox fx:id="collocabilityCCB" layoutX="185.0" layoutY="260.0" prefHeight="25.0" prefWidth="180.0"/>
<!-- MSD and Taxonomy separated --> <!-- MSD and Taxonomy separated -->
@ -108,17 +108,17 @@
<Pane layoutX="400.0" prefHeight="480.0" prefWidth="380.0"> <Pane layoutX="400.0" prefHeight="480.0" prefWidth="380.0">
<!-- MSD and Taxonomy separated --> <!-- MSD and Taxonomy separated -->
<Label layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Omejitev podatkov" /> <Label fx:id="dataLimitL" layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Omejitev podatkov" />
<Label layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Oznaka MSD"/> <Label fx:id="msdL" layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Oznaka MSD"/>
<TextField fx:id="msdTF" layoutX="185.0" layoutY="100.0" prefWidth="180.0"/> <TextField fx:id="msdTF" layoutX="185.0" layoutY="100.0" prefWidth="180.0"/>
<Label layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Taksonomija"/> <Label fx:id="taxonomyL" layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Taksonomija"/>
<CheckComboBox fx:id="taxonomyCCB" layoutX="185.0" layoutY="140.0" prefHeight="25.0" prefWidth="180.0"/> <CheckComboBox fx:id="taxonomyCCB" layoutX="185.0" layoutY="140.0" prefHeight="25.0" prefWidth="180.0"/>
<Label layoutX="10.0" layoutY="180.0" prefHeight="25.0" text="Min. št. pojavitev" /> <Label fx:id="minimalOccurrencesL" layoutX="10.0" layoutY="180.0" prefHeight="25.0" text="Min. št. pojavitev" />
<TextField fx:id="minimalOccurrencesTF" layoutX="185.0" layoutY="180.0" prefWidth="180.0" /> <TextField fx:id="minimalOccurrencesTF" layoutX="185.0" layoutY="180.0" prefWidth="180.0" />
<Label layoutX="10.0" layoutY="220.0" prefHeight="25.0" text="Min. št. taksonomij" /> <Label fx:id="minimalTaxonomyL" layoutX="10.0" layoutY="220.0" prefHeight="25.0" text="Min. št. taksonomij" />
<TextField fx:id="minimalTaxonomyTF" layoutX="185.0" layoutY="220.0" prefWidth="180.0" /> <TextField fx:id="minimalTaxonomyTF" layoutX="185.0" layoutY="220.0" prefWidth="180.0" />
@ -128,7 +128,7 @@
<Pane fx:id="paneLetters"> <Pane fx:id="paneLetters">
<children> <children>
<CheckBox fx:id="calculatecvvCB" layoutX="10.0" layoutY="440.0" mnemonicParsing="false" prefHeight="25.0" text="Izračunaj za kombinacije samoglasnikov in soglasnikov" /> <CheckBox fx:id="calculatecvvCB" layoutX="10.0" layoutY="440.0" mnemonicParsing="false" prefHeight="25.0" text="Izračunaj za kombinacije samoglasnikov in soglasnikov" />
<Label layoutX="10.0" layoutY="400.0" prefHeight="25.0" text="Dolžina niza" /> <Label fx:id="stringLengthL" layoutX="10.0" layoutY="400.0" prefHeight="25.0" text="Dolžina niza" />
<TextField fx:id="stringLengthTF" layoutX="185.0" layoutY="400.0" prefWidth="180.0" /> <TextField fx:id="stringLengthTF" layoutX="185.0" layoutY="400.0" prefWidth="180.0" />
</children> </children>
</Pane> </Pane>
@ -153,11 +153,11 @@
<!--</Pane>--> <!--</Pane>-->
<!--</Pane>--> <!--</Pane>-->
<Hyperlink fx:id="helpH" alignment="TOP_LEFT" layoutX="710.0" layoutY="16.0" text="Pomoč" /> <Hyperlink fx:id="helpH" alignment="TOP_LEFT" layoutX="710.0" layoutY="16.0" text="Pomoč" />
<Button fx:id="changeLanguageB" layoutX="710.0" layoutY="40.0" mnemonicParsing="false"/>
<Button fx:id="cancel" layoutX="540.0" layoutY="482.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="250.0" text="Prekini" /> <Button fx:id="cancel" layoutX="540.0" layoutY="482.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="250.0" text="Prekini" />
<ProgressBar fx:id="ngramProgressBar" layoutX="10.0" layoutY="517.0" prefHeight="16.0" prefWidth="780.0" progress="0.0" /> <ProgressBar fx:id="ngramProgressBar" layoutX="10.0" layoutY="517.0" prefHeight="16.0" prefWidth="780.0" progress="0.0" />
<Label fx:id="progressLabel" layoutX="10.0" layoutY="541.0" prefHeight="25.0" prefWidth="780.0" /> <Label fx:id="progressLabel" layoutX="10.0" layoutY="541.0" prefHeight="25.0" prefWidth="780.0" />
</AnchorPane> </AnchorPane>

@ -15,101 +15,102 @@
<AnchorPane fx:id="wordLevelAnalysisTabPane" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.111" <AnchorPane fx:id="wordLevelAnalysisTabPane" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.111"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.WordLevelTab"> xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.WordLevelTab">
<Pane> <Pane>
<Label layoutX="10.0" layoutY="20.0" prefHeight="25.0" text="Izračunaj za"/> <Label fx:id="calculateForL" layoutX="10.0" layoutY="20.0" prefHeight="25.0" text="Izračunaj za"/>
<ComboBox fx:id="calculateForCB" layoutX="185.0" layoutY="20.0" minWidth="180.0" prefWidth="150.0" promptText="izberi" <ComboBox fx:id="calculateForCB" layoutX="185.0" layoutY="20.0" minWidth="180.0" prefWidth="150.0" promptText="izberi"
visibleRowCount="5"> visibleRowCount="5">
<items> <items>
<FXCollections fx:factory="observableArrayList"> <FXCollections fx:factory="observableArrayList">
<String fx:value="lema"/> <String fx:value="lema"/>
<String fx:value="različnica"/> <String fx:value="različnica"/>
<String fx:value="oblikoskladenjska oznaka"/> <String fx:value="oblikoskladenjska oznaka"/>
<String fx:value="oblikoskladenjska lastnost"/> <String fx:value="oblikoskladenjska lastnost"/>
<String fx:value="besedna vrsta"/> <String fx:value="besedna vrsta"/>
</FXCollections> </FXCollections>
</items> </items>
</ComboBox> </ComboBox>
<Label layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Upoštevaj tudi" /> <Label fx:id="alsoVisualizeL" layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Upoštevaj tudi" />
<CheckComboBox fx:id="alsoVisualizeCCB" layoutX="185.0" layoutY="60.0" prefHeight="25.0" prefWidth="180.0"/> <CheckComboBox fx:id="alsoVisualizeCCB" layoutX="185.0" layoutY="60.0" prefHeight="25.0" prefWidth="180.0"/>
<Label layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Izpiši taksonomije" /> <Label fx:id="displayTaxonomyL" layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Izpiši taksonomije" />
<CheckBox fx:id="displayTaxonomyChB" layoutX="263.0" layoutY="105.0" selected="false" /> <CheckBox fx:id="displayTaxonomyChB" layoutX="263.0" layoutY="105.0" selected="false" />
<!--<Label layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Izpiši razbit MSD" />--> <!--<Label layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Izpiši razbit MSD" />-->
<!--<CheckBox fx:id="writeMsdAtTheEndChB" layoutX="263.0" layoutY="145.0" selected="false" />--> <!--<CheckBox fx:id="writeMsdAtTheEndChB" layoutX="263.0" layoutY="145.0" selected="false" />-->
<!-- MSD and Taxonomy separated --> <!-- MSD and Taxonomy separated -->
<Label layoutX="10.0" layoutY="160.0" prefHeight="25.0" text="Iskanje besednih delov preko podane dolžine" /> <Label fx:id="lengthSearchL" layoutX="10.0" layoutY="160.0" prefHeight="25.0" text="Iskanje besednih delov preko podane dolžine" />
<Label layoutX="10.0" layoutY="200.0" prefHeight="25.0" text="Predpona je dolga"/> <Label fx:id="prefixLengthL" layoutX="10.0" layoutY="200.0" prefHeight="25.0" text="Predpona je dolga"/>
<ComboBox fx:id="prefixLengthCB" layoutX="185.0" layoutY="200.0" prefWidth="180.0" promptText="izberi" visibleRowCount="5"> <ComboBox fx:id="prefixLengthCB" layoutX="185.0" layoutY="200.0" prefWidth="180.0" promptText="izberi" visibleRowCount="5">
<items> <items>
<FXCollections fx:factory="observableArrayList"> <FXCollections fx:factory="observableArrayList">
<String fx:value="0" /> <String fx:value="0" />
<String fx:value="1" /> <String fx:value="1" />
<String fx:value="2" /> <String fx:value="2" />
<String fx:value="3" /> <String fx:value="3" />
<String fx:value="4" /> <String fx:value="4" />
<String fx:value="5" /> <String fx:value="5" />
</FXCollections> </FXCollections>
</items> </items>
</ComboBox> </ComboBox>
<Label layoutX="10.0" layoutY="240.0" prefHeight="25.0" text="Pripona je dolga"/> <Label fx:id="suffixLengthL" layoutX="10.0" layoutY="240.0" prefHeight="25.0" text="Pripona je dolga"/>
<ComboBox fx:id="suffixLengthCB" layoutX="185.0" layoutY="240.0" prefWidth="180.0" promptText="izberi" visibleRowCount="5"> <ComboBox fx:id="suffixLengthCB" layoutX="185.0" layoutY="240.0" prefWidth="180.0" promptText="izberi" visibleRowCount="5">
<items> <items>
<FXCollections fx:factory="observableArrayList"> <FXCollections fx:factory="observableArrayList">
<String fx:value="0" /> <String fx:value="0" />
<String fx:value="1" /> <String fx:value="1" />
<String fx:value="2" /> <String fx:value="2" />
<String fx:value="3" /> <String fx:value="3" />
<String fx:value="4" /> <String fx:value="4" />
<String fx:value="5" /> <String fx:value="5" />
</FXCollections> </FXCollections>
</items> </items>
</ComboBox> </ComboBox>
<Label layoutX="10.0" layoutY="300.0" prefHeight="25.0" text="Iskanje besednih delov preko podanih predpon in pripon" /> <Label fx:id="listSearchL" layoutX="10.0" layoutY="300.0" prefHeight="25.0" text="Iskanje besednih delov preko podanih predpon in pripon" />
<Label layoutX="10.0" layoutY="340.0" prefHeight="25.0" text="Seznam predpon"/> <Label fx:id="prefixListL" layoutX="10.0" layoutY="340.0" prefHeight="25.0" text="Seznam predpon"/>
<TextField fx:id="prefixListTF" layoutX="185.0" layoutY="340.0" prefWidth="180.0" /> <TextField fx:id="prefixListTF" layoutX="185.0" layoutY="340.0" prefWidth="180.0" />
<Label layoutX="10.0" layoutY="380.0" prefHeight="25.0" text="Seznam pripon"/> <Label fx:id="suffixListL" layoutX="10.0" layoutY="380.0" prefHeight="25.0" text="Seznam pripon"/>
<TextField fx:id="suffixListTF" layoutX="185.0" layoutY="380.0" prefWidth="180.0" /> <TextField fx:id="suffixListTF" layoutX="185.0" layoutY="380.0" prefWidth="180.0" />
<Button fx:id="computeNgramsB" layoutX="10.0" layoutY="440.0" mnemonicParsing="false" <Button fx:id="computeNgramsB" layoutX="10.0" layoutY="440.0" mnemonicParsing="false"
prefHeight="25.0" prefWidth="250.0" text="Izračunaj"/> prefHeight="25.0" prefWidth="250.0" text="Izračunaj"/>
</Pane> </Pane>
<Pane layoutX="400.0" prefHeight="480.0" prefWidth="380.0"> <Pane layoutX="400.0" prefHeight="480.0" prefWidth="380.0">
<!-- MSD and Taxonomy separated --> <!-- MSD and Taxonomy separated -->
<Label layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Omejitev podatkov" /> <Label fx:id="dataLimitL" layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Omejitev podatkov" />
<Label layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Oznaka MSD"/> <Label fx:id="msdL" layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Oznaka MSD"/>
<TextField fx:id="msdTF" layoutX="185.0" layoutY="100.0" prefWidth="180.0"/> <TextField fx:id="msdTF" layoutX="185.0" layoutY="100.0" prefWidth="180.0"/>
<Label layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Taksonomija"/> <Label fx:id="taxonomyL" layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="Taksonomija"/>
<CheckComboBox fx:id="taxonomyCCB" layoutX="185.0" layoutY="140.0" prefHeight="25.0" prefWidth="180.0"/> <CheckComboBox fx:id="taxonomyCCB" layoutX="185.0" layoutY="140.0" prefHeight="25.0" prefWidth="180.0"/>
<Label layoutX="10.0" layoutY="180.0" prefHeight="25.0" text="Min. št. pojavitev" /> <Label fx:id="minimalOccurrencesL" layoutX="10.0" layoutY="180.0" prefHeight="25.0" text="Min. št. pojavitev" />
<TextField fx:id="minimalOccurrencesTF" layoutX="185.0" layoutY="180.0" prefWidth="180.0" /> <TextField fx:id="minimalOccurrencesTF" layoutX="185.0" layoutY="180.0" prefWidth="180.0" />
<Label layoutX="10.0" layoutY="220.0" prefHeight="25.0" text="Min. št. taksonomij" /> <Label fx:id="minimalTaxonomyL" layoutX="10.0" layoutY="220.0" prefHeight="25.0" text="Min. št. taksonomij" />
<TextField fx:id="minimalTaxonomyTF" layoutX="185.0" layoutY="220.0" prefWidth="180.0" /> <TextField fx:id="minimalTaxonomyTF" layoutX="185.0" layoutY="220.0" prefWidth="180.0" />
<Label fx:id="solarFilters" layoutX="10.0" layoutY="280.0" text="Izbrani filtri:" /> <Label fx:id="solarFilters" layoutX="10.0" layoutY="280.0" text="Izbrani filtri:" />
<Label fx:id="selectedFiltersLabel" alignment="TOP_LEFT" layoutX="10.0" layoutY="320.0" prefHeight="340.0" prefWidth="275.0" text=" " wrapText="true" /> <Label fx:id="selectedFiltersLabel" alignment="TOP_LEFT" layoutX="10.0" layoutY="320.0" prefHeight="340.0" prefWidth="275.0" text=" " wrapText="true" />
</Pane> </Pane>
<Hyperlink fx:id="helpH" alignment="TOP_LEFT" layoutX="710.0" layoutY="16.0" text="Pomoč" /> <Hyperlink fx:id="helpH" alignment="TOP_LEFT" layoutX="710.0" layoutY="16.0" text="Pomoč" />
<Button fx:id="changeLanguageB" layoutX="710.0" layoutY="40.0" mnemonicParsing="false"/>
<Button fx:id="cancel" layoutX="540.0" layoutY="482.0" mnemonicParsing="false"
prefHeight="25.0" prefWidth="250.0" text="Prekini"/> <Button fx:id="cancel" layoutX="540.0" layoutY="482.0" mnemonicParsing="false"
prefHeight="25.0" prefWidth="250.0" text="Prekini"/>
<ProgressBar fx:id="ngramProgressBar" layoutX="10.0" layoutY="517.0" prefHeight="16.0" prefWidth="780.0" progress="0.0"/>
<Label fx:id="progressLabel" layoutX="10.0" layoutY="541.0" prefHeight="25.0" prefWidth="780.0"/> <ProgressBar fx:id="ngramProgressBar" layoutX="10.0" layoutY="517.0" prefHeight="16.0" prefWidth="780.0" progress="0.0"/>
<Label fx:id="progressLabel" layoutX="10.0" layoutY="541.0" prefHeight="25.0" prefWidth="780.0"/>
</AnchorPane> </AnchorPane>

@ -0,0 +1,192 @@
# general
window.title=Corpus analyzer
hyperlink.help=Help
button.language=SL
button.computeNgrams=Calculate
button.cancel=Cancel
# template
tab.corpusTab=Corpus
tab.filterTab=Filter
tab.characterLevelTabNew=Characters
tab.wordLevelTab=Word parts
tab.oneWordAnalysisTab=Words
tab.stringLevelTabNew2=Word sets
# corpus tab
button.setCorpusLocation=Set corpus location
checkBox.readHeaderInfo=Read info from headers
button.chooseResultsLocation=Choose result location
# character analysis tab
label.stringLength=Number of letters
label.calculateFor=Calculate for
label.displayTaxonomy=Display taxonomies
label.dataLimit=Data limitations
label.msd=MSD
label.taxonomy=Taxonomy
label.minimalOccurrences=Min. n. occurrences
label.minimalTaxonomy=Min. n. taxonomies
label.solarFilters=Selected filters:
string.lemma=lemma
string.word=word
# word level tab
label.alsoVisualize=Also filter
label.lengthSearch=Search for word parts through specified length
label.prefixLength=Prefix length
label.suffixLength=Suffix length
label.listSearch=Search for word parts through specified prefixes and suffixes
label.prefixList=Prefix list
label.suffixList=Suffix list
label.writeMsdAtTheEnd=Write MSD at the end
# calculate for
calculateFor.WORD=word
calculateFor.NORMALIZED_WORD=normalized word
calculateFor.LEMMA=lemma
calculateFor.MORPHOSYNTACTIC_SPECS=msd
calculateFor.MORPHOSYNTACTIC_PROPERTY=oblikoskladenjska lastnost
calculateFor.WORD_TYPE=word type
calculateFor.DIST_WORDS=word
calculateFor.DIST_LEMMAS=lemma
# n-grams
label.skipValue=Skip value
label.slowSpeedWarning=* USAGE OF PREVIOUS FILTER MAY DECREASE ANALYZING SPEED
label.ngramValue=N-gram level
label.notePunctuations=Note punctuations
label.collocability=Collocability
# messages
message.WARNING_CORPUS_NOT_FOUND=In selected directory there are no suitable corpus files.
message.WARNING_RESULTS_DIR_NOT_VALID=You don't have correct permissions to access chosen directory.
message.WARNING_DIFFERING_NGRAM_LEVEL_AND_FILTER_TOKENS=Selected ngram level and number of entered words do not match.
message.WARNING_DIFFERING_NGRAM_LEVEL_AND_FILTER_TOKENS_INFO=Choose other number or modify filter.
message.WARNING_WORD_OR_LEMMA=Choose, if you want to calculate statistics for words or lemmas.
message.WARNING_ONLY_NUMBERS_ALLOWED=Please enter valid number.
message.WARNING_NUMBER_TOO_BIG=Entered number is bigger than the number of taxonomies.
message.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES=Number for n-gram (%d) and number of msds included (%d) must match.
message.WARNING_MISSING_STRING_LENGTH=String length must be higher than 0. Length is set up at default value (1).
message.WARNING_NO_TAXONOMY_FOUND=We were unable to read taxonomy from corpus files. Please select other location or different corpus.
message.WARNING_NO_SOLAR_FILTERS_FOUND=We weren't able to read filters from corpus files. Please select other location or different corpus.
message.ERROR_WHILE_EXECUTING=Error in program execution.
message.ERROR_WHILE_SAVING_RESULTS_TO_CSV=Error while saving results.
message.ERROR_NOT_ENOUGH_MEMORY=You do not have sufficient RAM for analyzing such amount of data. You can try changing filters.
message.MISSING_NGRAM_LEVEL=N-gram level
message.MISSING_CALCULATE_FOR=Calculate for
message.MISSING_SKIP=""
message.MISSING_STRING_LENGTH=String length
message.MISMATCHED_STRING_LENGTH_AND_MSD_REGEX=String length and regex filter do not match.
message.NOTIFICATION_FOUND_X_FILES=Num. of found files: %s
message.NOTIFICATION_CORPUS=Corpus: %s
message.NOTIFICATION_ANALYSIS_COMPLETED=Analysis completed. Results are saved successfully.
message.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS=Analysis completed, however no statistics created that would match filters.
message.RESULTS_PATH_SET_TO_DEFAULT=Save location is set on corpus location.
message.NOTIFICATION_ANALYSIS_CANCELED=Analysis was cancled.
message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y=Analyzing file %d of %d (%s)
message.CANCELING_NOTIFICATION=Canceled
message.LABEL_CORPUS_LOCATION_NOT_SET=Corpus location is not set
message.LABEL_RESULTS_LOCATION_NOT_SET=Result location is not set
message.LABEL_RESULTS_CORPUS_TYPE_NOT_SET=Corpus type is not set.
message.LABEL_SCANNING_CORPUS=Search and analysis of corpus files...
message.LABEL_SCANNING_SINGLE_FILE_CORPUS=Input analysis
message.COMPLETED=Completed
message.TOOLTIP_chooseCorpusLocationB=Select folder which contains corpus. The folder should only contain one corpus and should not contain too many files that are not part of corpus.
message.TOOLTIP_readHeaderInfoChB=If you select this option taxonomy will be read separately. This might take a while.
message.TOOLTIP_readNotePunctuationsChB=Punctuations in sentences are included in analysis
message.TOOLTIP_readDisplayTaxonomyChB=Output file will include statistics over taxonomies as well.
windowTitles.error=Error
windowTitles.warning=Warning
windowTitles.confirmation=Confirmation
# export header translations
exportHeader.corpus=Corpus:
exportHeader.date=Date:
exportHeader.executionTime=Execution time:
exportHeader.analysis=Analysis:
exportHeader.analysis.letters=letters
exportHeader.analysis.wordParts=word parts
exportHeader.analysis.words=words
exportHeader.analysis.wordSets=Word sets
exportHeader.numberLetters=Number of letters:
exportHeader.calculateFor=Calculate for:
exportHeader.alsoFilter=Also filter:
exportHeader.displayTaxonomies=Display taxonomies:
exportHeader.ngramLevel=N-gram level:
exportHeader.skipValue=Skip value:
exportHeader.notePunctuations=Note punctuations:
exportHeader.collocability=Collocability:
exportHeader.writeMSDAtTheEnd=Write MSD at the end:
exportHeader.prefixLength=Prefix length:
exportHeader.suffixLength=Suffix length:
exportHeader.prefixList=Prefix list:
exportHeader.suffixList=Suffix list:
exportHeader.msd=MSD:
exportHeader.taxonomy=Taxonomy:
exportHeader.minOccurrences=Min. n. occurrences:
exportHeader.minTaxonomies=Min. n. taxonomies:
exportHeader.additionalFilters=Additional filters:
exportHeader.yes=yes
exportHeader.no=no
# export table header translations
exportTable.skippedWords=Skipped words
exportTable.lettersSmall=Letters (small letters)
exportTable.wordsSmall=Lemma (small letters)
exportTable.wordBeginning=Word beginning
exportTable.wordEnding=Word ending
exportTable.wordRest=The rest of the word
exportTable.totalRelativeFrequency=Total relative frequency (over one million occurrences)
exportTable.absoluteFrequency=Absolute frequency
exportTable.percentage=Share
exportTable.relativeFrequency=Relative frequency
exportTable.msd=msd
# parts
exportTable.part.word=words:
exportTable.part.normalizedWord=normalized words:
exportTable.part.lemma=lemmas:
exportTable.part.msd=msd:
exportTable.part.msdProperty=msd property:
exportTable.part.wordType=word type:
exportTable.part.letterSet=letter set
exportTable.part.word2=word
exportTable.part.normalizedWord2=normalized word
exportTable.part.lemma2=lemma
exportTable.part.msd2=msd
exportTable.part.msdProperty2=msd property
exportTable.part.wordType2=word type
exportTable.part.letterSet2=Share of total sum of all letter sets
exportTable.part.letterSet3=Letter set
exportTable.part.word3=Word
exportTable.part.normalizedWord3=Normalized word
exportTable.part.lemma3=Lemma
exportTable.part.msd3=Msd
exportTable.part.msdProperty3=Msd property
exportTable.part.wordType3=Word type
exportTable.part.set=set
exportTable.part.share=Absolute share of
exportTable.part.absoluteFrequency=Absolute frequency of
exportTable.part.totalFound=Total sum of all
exportTable.part.totalFoundLetters=Total sum of all found letters of
exportTable.part.totalSumString=Total sum of
exportTable.part.totalSumLetters=Total sum of all letters of
# generated files names
exportFileName.letters=letters
exportFileName.wordParts=word-parts
exportFileName.words=words
exportFileName.wordSets=word-sets
exportFileName.gram=-gram
exportFileName.skip=-skip

@ -0,0 +1,192 @@
# general
window.title=Luščilnik
hyperlink.help=Pomoč
button.language=EN
button.computeNgrams=Izračunaj
button.cancel=Prekini
# template
tab.corpusTab=Korpus
tab.filterTab=Filter
tab.characterLevelTabNew=Črke
tab.wordLevelTab=Besedni deli
tab.oneWordAnalysisTab=Besede
tab.stringLevelTabNew2=Besedni nizi
# corpus tab
button.setCorpusLocation=Nastavi lokacijo korpusa
checkBox.readHeaderInfo=Preberi info iz headerjev
button.chooseResultsLocation=Nastavi lokacijo rezultatov
# character analysis tab
label.stringLength=Število črk
label.calculateFor=Izračunaj za
label.displayTaxonomy=Izpiši taksonomije
label.dataLimit=Omejitev podatkov
label.msd=Oznaka MSD
label.taxonomy=Taksonomija
label.minimalOccurrences=Min. št. pojavitev
label.minimalTaxonomy=Min. št. taksonomij
label.solarFilters=Izbrani filtri:
string.lemma=lema
string.word=različnica
label.writeMsdAtTheEnd=Izpiši razbit MSD
# word level tab
label.alsoVisualize=Upoštevaj tudi
label.lengthSearch=Iskanje besednih delov preko podane dolžine
label.prefixLength=Predpona je dolga
label.suffixLength=Pripona je dolga
label.listSearch=Iskanje besednih delov preko podanih predpon in pripon
label.prefixList=Seznam predpon
label.suffixList=Seznam pripon
# calculate for
calculateFor.WORD=različnica
calculateFor.NORMALIZED_WORD=normalizirana različnica
calculateFor.LEMMA=lema
calculateFor.MORPHOSYNTACTIC_SPECS=oblikoskladenjska oznaka
calculateFor.MORPHOSYNTACTIC_PROPERTY=oblikoskladenjska lastnost
calculateFor.WORD_TYPE=besedna vrsta
calculateFor.DIST_WORDS=različnica
calculateFor.DIST_LEMMAS=lema
# n-grams
label.skipValue=Preskok besed
label.slowSpeedWarning=* IZBIRA PREDHODNEGA FILTRA LAHKO MOČNO UPOČASNI DELOVANJE
label.ngramValue=N-gram nivo
label.notePunctuations=Upoštevaj ločila
label.collocability=Kolokabilnost
# messages
message.WARNING_CORPUS_NOT_FOUND=V izbranem direktoriju ni ustreznih korpusnih datotek.
message.WARNING_RESULTS_DIR_NOT_VALID=Za dostop do izbranega direktorija nimate potrebnih pravic.
message.WARNING_DIFFERING_NGRAM_LEVEL_AND_FILTER_TOKENS=Izbran nivo ngramov in vpisano št. besed v filtru se ne ujemata.
message.WARNING_DIFFERING_NGRAM_LEVEL_AND_FILTER_TOKENS_INFO=Izberite drugo število ali popravite filter.
message.WARNING_WORD_OR_LEMMA=Izberite, če želite statistiko izračunati za besede ali leme.
message.WARNING_ONLY_NUMBERS_ALLOWED=Prosim vnesite veljavno število.
message.WARNING_NUMBER_TOO_BIG=Vnešeno število je večje od števila taksonomij.
message.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES=Število za ngram (%d) in število msd oznak (%d) se morata ujemati.
message.WARNING_MISSING_STRING_LENGTH=Dolžina niza mora biti večja od 0. Vstavljena je privzeta vrednost (1).
message.WARNING_NO_TAXONOMY_FOUND=Iz korpusnih datotek ni bilo moč razbrati taksonomije. Prosim izberite drugo lokacijo ali korpus.
message.WARNING_NO_SOLAR_FILTERS_FOUND=Iz korpusnih datotek ni bilo moč razbrati filtrov. Prosim izberite drugo lokacijo ali korpus.
message.ERROR_WHILE_EXECUTING=Prišlo je do napake med izvajanjem.
message.ERROR_WHILE_SAVING_RESULTS_TO_CSV=Prišlo je do napake med shranjevanje rezultatov.
message.ERROR_NOT_ENOUGH_MEMORY=Na voljo imate premalo pomnilnika (RAM-a) za analizo takšne količine podatkov.
message.MISSING_NGRAM_LEVEL=N-gram nivo
message.MISSING_CALCULATE_FOR=Izračunaj za
message.MISSING_SKIP=""
message.MISSING_STRING_LENGTH=Dolžina niza
message.MISMATCHED_STRING_LENGTH_AND_MSD_REGEX=Neujemajoča dolžina niza in regex filter
message.NOTIFICATION_FOUND_X_FILES=Št. najdenih datotek: %s
message.NOTIFICATION_CORPUS=Korpus: %s
message.NOTIFICATION_ANALYSIS_COMPLETED=Analiza je zaključena, rezultati so shranjeni.
message.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS=Analiza je zaključena, vendar ni bilo moč izračunati statistike, ki bi ustrezala vsem navedenim pogojem.
message.RESULTS_PATH_SET_TO_DEFAULT=Lokacija za shranjevanje rezultatov je nastavljena na lokacijo korpusa.
message.NOTIFICATION_ANALYSIS_CANCELED=Analiziranje je bilo prekinjeno.
message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y=Analiziram datoteko %d od %d (%s)
message.CANCELING_NOTIFICATION=Prekinjeno
message.LABEL_CORPUS_LOCATION_NOT_SET=Lokacija korpusa ni nastavljena
message.LABEL_RESULTS_LOCATION_NOT_SET=Lokacija za shranjevanje rezultatov ni nastavljena
message.LABEL_RESULTS_CORPUS_TYPE_NOT_SET=Vrsta korpusa ni nastavljena
message.LABEL_SCANNING_CORPUS=Iskanje in analiza korpusnih datotek...
message.LABEL_SCANNING_SINGLE_FILE_CORPUS=Analiza vnosa
message.COMPLETED=končano
message.TOOLTIP_chooseCorpusLocationB=Izberite mapo v kateri se nahaja korpus. Program izbrano mapo preišče rekurzivno, zato bodite pozorni, da ne izberete mape z več korpusi ali z mnogo datotekami, ki niso del korpusa.
message.TOOLTIP_readHeaderInfoChB=Če izberete to opcijo, se bo iz headerjev korpusa prebrala razpoložljiva taksonomija oz. filtri (korpus Šolar). Ta operacija lahko traja dlje časa, sploh če je korpus združen v eni sami datoteki.
message.TOOLTIP_readNotePunctuationsChB=Ločila med povedmi se upoštevajo v vsakem primeru.
message.TOOLTIP_readDisplayTaxonomyChB=V izhodni datoteki bodo prikazane tudi statistike po taksonomijah.
windowTitles.error=Napaka
windowTitles.warning=Opozorilo
windowTitles.confirmation=Potrdilo
# export header translations
exportHeader.corpus=Korpus:
exportHeader.date=Datum:
exportHeader.executionTime=Čas izvajanja:
exportHeader.analysis=Analiza:
exportHeader.analysis.letters=črke
exportHeader.analysis.wordParts=besedni deli
exportHeader.analysis.words=besede
exportHeader.analysis.wordSets=Besedni nizi
exportHeader.numberLetters=Število črk:
exportHeader.calculateFor=Izračunaj za:
exportHeader.alsoFilter=Upoštevaj tudi:
exportHeader.displayTaxonomies=Izpiši taksonomije:
exportHeader.ngramLevel=N-gram nivo:
exportHeader.skipValue=Preskok besed:
exportHeader.notePunctuations=Upoštevaj ločila:
exportHeader.collocability=Kolokabilnost:
exportHeader.writeMSDAtTheEnd=Izpiši razbit MSD:
exportHeader.prefixLength=Dolžina predpone:
exportHeader.suffixLength=Dolžina pripone:
exportHeader.prefixList=Seznam predpon:
exportHeader.suffixList=Seznam pripon:
exportHeader.msd=Oznaka MSD:
exportHeader.taxonomy=Taksonomija:
exportHeader.minOccurrences=Min. št. pojavitev:
exportHeader.minTaxonomies=Min. št. taksonomij:
exportHeader.additionalFilters=Dodatni filtri:
exportHeader.yes=da
exportHeader.no=ne
# export table header translations
exportTable.skippedWords=Izpuščene besede
exportTable.lettersSmall=Črkovni niz (male črke)
exportTable.wordsSmall=Lema (male črke)
exportTable.wordBeginning=Začetni del besede
exportTable.wordEnding=Končni del besede
exportTable.wordRest=Preostali del besede
exportTable.totalRelativeFrequency=Skupna relativna pogostost (na milijon pojavitev)
exportTable.absoluteFrequency=Absolutna pogostost
exportTable.percentage=Delež
exportTable.relativeFrequency=Relativna pogostost
exportTable.msd=msd
# parts
exportTable.part.word=različnic:
exportTable.part.normalizedWord=normaliziranih različnic:
exportTable.part.lemma=lem:
exportTable.part.msd=oblikoskladenjskih oznak:
exportTable.part.msdProperty=oblikoskladenjskih lastnosti:
exportTable.part.wordType=besednih vrst:
exportTable.part.letterSet=črkovnega niza
exportTable.part.word2=različnice
exportTable.part.normalizedWord2=normalizirane različnice
exportTable.part.lemma2=leme
exportTable.part.msd2=oblikoskladenjske oznake
exportTable.part.msdProperty2=oblikoskladenjske lastnosti
exportTable.part.wordType2=besedne vrste
exportTable.part.letterSet2=Delež glede na skupno vsoto vseh najdenih črkovnih nizov
exportTable.part.letterSet3=Črkovni niz
exportTable.part.word3=Različnica
exportTable.part.normalizedWord3=Normalizirana različnica
exportTable.part.lemma3=Lema
exportTable.part.msd3=Oblikoskladenjska oznaka
exportTable.part.msdProperty3=Oblikoskladenjska lastnost
exportTable.part.wordType3=Besedna vrsta
exportTable.part.set=niza
exportTable.part.share=Delež glede na vse najdene
exportTable.part.absoluteFrequency=Skupna absolutna pogostost
exportTable.part.totalFound=Skupna vsota vseh najdenih
exportTable.part.totalFoundLetters=Skupna vsota vseh najdenih črkovnih nizov
exportTable.part.totalSumString=Skupna vsota vseh
exportTable.part.totalSumLetters=Skupna vsota vseh črkovnih nizov
# generated files names
exportFileName.letters=crke
exportFileName.wordParts=besedni-deli
exportFileName.words=besede
exportFileName.wordSets=besedni-nizi
exportFileName.gram=-gram
exportFileName.skip=-preskok

@ -7,3 +7,11 @@
-fx-font-weight: bold; -fx-font-weight: bold;
-fx-text-fill: red; -fx-text-fill: red;
} }
.progress-indicator .percentage {
-fx-fill:null;
}
.progress-indicator {
-fx-padding: 0 0 -16 0;
}
Loading…
Cancel
Save