Added functionality for n-grams (comma separation), minimal occurances etc.
This commit is contained in:
@@ -293,13 +293,17 @@ public class XML_processing {
|
||||
|
||||
// "word" node value
|
||||
if (in_word) {
|
||||
stavek.add(new Word(characters.getData(), lemma, msd));
|
||||
stavek.add(new Word(characters.getData(), lemma, msd, null));
|
||||
in_word = false;
|
||||
} else if(inPunctuation){
|
||||
String punctuation = ",";
|
||||
stavek.get(stavek.size()-1).setWord(stavek.get(stavek.size()-1).getWord() + punctuation);
|
||||
stavek.get(stavek.size()-1).setLemma(stavek.get(stavek.size()-1).getLemma() + punctuation);
|
||||
stavek.get(stavek.size()-1).setMsd(stavek.get(stavek.size()-1).getMsd() + punctuation);
|
||||
|
||||
if (stavek.size() > 0){
|
||||
stavek.get(stavek.size()-1).setWord(stavek.get(stavek.size()-1).getWord() + punctuation);
|
||||
stavek.get(stavek.size()-1).setLemma(stavek.get(stavek.size()-1).getLemma() + punctuation);
|
||||
stavek.get(stavek.size()-1).setMsd(stavek.get(stavek.size()-1).getMsd() + punctuation);
|
||||
}
|
||||
|
||||
inPunctuation = false;
|
||||
}
|
||||
break;
|
||||
@@ -652,6 +656,7 @@ public class XML_processing {
|
||||
boolean inOrthDiv = false;
|
||||
boolean computeForOrth = stats.getCorpus().isGosOrthMode();
|
||||
ArrayList<String> currentFiletaxonomy = new ArrayList<>();
|
||||
ArrayList<String> currentFiletaxonomyLong = new ArrayList<>();
|
||||
String lemma = "";
|
||||
String msd = "";
|
||||
|
||||
@@ -718,7 +723,10 @@ public class XML_processing {
|
||||
|
||||
if (tax != null) {
|
||||
// keep only taxonomy properties
|
||||
currentFiletaxonomy.add(String.valueOf(tax.getValue()));
|
||||
String currentFiletaxonomyElement = String.valueOf(tax.getValue());
|
||||
currentFiletaxonomy.add(currentFiletaxonomyElement);
|
||||
Tax taxonomy = new Tax();
|
||||
currentFiletaxonomyLong.add(taxonomy.getLongTaxonomyName(currentFiletaxonomyElement));
|
||||
}
|
||||
} else if (qName.equalsIgnoreCase("div")) {
|
||||
gosType = String.valueOf(startElement.getAttributeByName(QName.valueOf("type")).getValue());
|
||||
@@ -730,9 +738,9 @@ public class XML_processing {
|
||||
if (inWord) {
|
||||
Characters characters = event.asCharacters();
|
||||
if (gosType.equals("norm") && msd != null) {
|
||||
sentence.add(new Word(characters.getData(), lemma, msd));
|
||||
sentence.add(new Word(characters.getData(), lemma, msd, currentFiletaxonomyLong));
|
||||
} else {
|
||||
sentence.add(new Word(characters.getData()));
|
||||
sentence.add(new Word(characters.getData(), lemma, msd, currentFiletaxonomyLong));
|
||||
}
|
||||
|
||||
inWord = false;
|
||||
|
||||
@@ -26,7 +26,9 @@ public class Filter {
|
||||
HAS_MSD,
|
||||
SOLAR_FILTERS,
|
||||
MULTIPLE_KEYS,
|
||||
NOTE_PUNCTUATIONS
|
||||
NOTE_PUNCTUATIONS,
|
||||
MINIMAL_OCCURRENCES,
|
||||
MINIMAL_TAXONOMY
|
||||
}
|
||||
|
||||
public Filter() {
|
||||
@@ -170,4 +172,21 @@ public class Filter {
|
||||
public boolean getNotePunctuations() {
|
||||
return filter.containsKey(NOTE_PUNCTUATIONS) && (boolean) filter.get(NOTE_PUNCTUATIONS);
|
||||
}
|
||||
|
||||
public void setMinimalOccurrences(Integer minOccurrences) {
|
||||
filter.put(MINIMAL_OCCURRENCES, minOccurrences);
|
||||
}
|
||||
|
||||
public Integer getMinimalOccurrences() {
|
||||
return (Integer) filter.get(MINIMAL_OCCURRENCES);
|
||||
}
|
||||
|
||||
|
||||
public void setMinimalTaxonomy(Integer minTaxonomy) {
|
||||
filter.put(MINIMAL_TAXONOMY, minTaxonomy);
|
||||
}
|
||||
|
||||
public Integer getMinimalTaxonomy() {
|
||||
return (Integer) filter.get(MINIMAL_TAXONOMY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,15 +48,16 @@ public class StatisticsNew {
|
||||
this.taxonomyResult.put("Total", new ConcurrentHashMap<>());
|
||||
|
||||
// create table for counting word occurances per taxonomies
|
||||
|
||||
if (this.filter.getTaxonomy().isEmpty()) {
|
||||
for (int i = 0; i < this.corpus.getTaxonomy().size(); i++) {
|
||||
this.taxonomyResult.put(this.corpus.getTaxonomy().get(i), new ConcurrentHashMap<>());
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < this.filter.getTaxonomy().size(); i++) {
|
||||
Tax taxonomy = new Tax();
|
||||
this.taxonomyResult.put(taxonomy.getLongTaxonomyName(this.filter.getTaxonomy().get(i)), new ConcurrentHashMap<>());
|
||||
if (this.corpus.getTaxonomy() != null) {
|
||||
if (this.filter.getTaxonomy().isEmpty()) {
|
||||
for (int i = 0; i < this.corpus.getTaxonomy().size(); i++) {
|
||||
this.taxonomyResult.put(this.corpus.getTaxonomy().get(i), new ConcurrentHashMap<>());
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < this.filter.getTaxonomy().size(); i++) {
|
||||
Tax taxonomy = new Tax();
|
||||
this.taxonomyResult.put(taxonomy.getLongTaxonomyName(this.filter.getTaxonomy().get(i)), new ConcurrentHashMap<>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,11 +210,45 @@ public class StatisticsNew {
|
||||
analysisProducedResults = true;
|
||||
}
|
||||
|
||||
removeMinimalOccurrences(taxonomyResult.get("Total"), filter.getMinimalOccurrences());
|
||||
removeMinimalTaxonomy(taxonomyResult, filter.getMinimalTaxonomy());
|
||||
stats.add(ImmutablePair.of(resultTitle, getSortedResult(taxonomyResult.get("Total"), Util.getValidInt(limit))));
|
||||
Export.SetToCSV(stats, corpus.getChosenResultsLocation(), headerInfoBlock(), taxonomyResult);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes lines, where number of different taxonomies is lower than specified number (minimalTaxonomy)
|
||||
*/
|
||||
private void removeMinimalTaxonomy(Map<String, Map<MultipleHMKeys, AtomicLong>> taxonomyResult, Integer minimalTaxonomy) {
|
||||
if (minimalTaxonomy == 1)
|
||||
return;
|
||||
int occurances;
|
||||
for (MultipleHMKeys key : taxonomyResult.get("Total").keySet()){
|
||||
occurances = 0;
|
||||
for (String columnNameKey : taxonomyResult.keySet()){
|
||||
if(!columnNameKey.equals("Total") && taxonomyResult.get(columnNameKey).get(key).intValue() >= 1)
|
||||
occurances++;
|
||||
}
|
||||
if(occurances < minimalTaxonomy){
|
||||
taxonomyResult.get("Total").remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes lines where total number of occurrences is lower than specified number (minimalOccurrences)
|
||||
*/
|
||||
private void removeMinimalOccurrences(Map<MultipleHMKeys, AtomicLong> taxonomyResultTotal, Integer minimalOccurrences) {
|
||||
if (minimalOccurrences == 0)
|
||||
return;
|
||||
for (MultipleHMKeys key : taxonomyResultTotal.keySet()){
|
||||
if(taxonomyResultTotal.get(key).intValue() < minimalOccurrences){
|
||||
taxonomyResultTotal.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean saveResultNestedToDisk(int... limit) throws UnsupportedEncodingException {
|
||||
resultTitle = generateResultTitle();
|
||||
|
||||
@@ -285,7 +320,8 @@ public class StatisticsNew {
|
||||
public void updateTaxonomyResults(MultipleHMKeys o, List<String> taxonomy) {
|
||||
for (String key : taxonomyResult.keySet()) {
|
||||
// first word should have the same taxonomy as others
|
||||
if (taxonomy.contains(key) || key.equals("Total")) {
|
||||
if (key.equals("Total") || taxonomy.contains(key)) {
|
||||
// if (key.equals("Total") || taxonomy != null && taxonomy.contains(key)) {
|
||||
// if taxonomy not in map and in this word
|
||||
AtomicLong r = taxonomyResult.get(key).putIfAbsent(o, new AtomicLong(1));
|
||||
|
||||
@@ -389,13 +425,13 @@ public class StatisticsNew {
|
||||
if (filter.getAl() == AnalysisLevel.STRING_LEVEL) {
|
||||
Integer ngramLevel = filter.getNgramValue();
|
||||
if (ngramLevel == 0)
|
||||
info.put("Analiza:", "Črke");
|
||||
info.put("Analiza", "Črke");
|
||||
else if (ngramLevel == 1)
|
||||
info.put("Analiza", "Besede");
|
||||
else
|
||||
info.put("Analiza:", filter.getAl().toString());
|
||||
info.put("Analiza", filter.getAl().toString());
|
||||
} else {
|
||||
info.put("Analiza:", filter.getAl().toString());
|
||||
info.put("Analiza", filter.getAl().toString());
|
||||
}
|
||||
|
||||
if (filter.getAl() == AnalysisLevel.STRING_LEVEL) {
|
||||
|
||||
@@ -16,6 +16,7 @@ public class Word implements Serializable {
|
||||
private String word;
|
||||
private String lemma;
|
||||
private String msd;
|
||||
// private String msd;
|
||||
private List<String> taxonomy;
|
||||
private final HashSet<Character> VOWELS = new HashSet<>(Arrays.asList('a', 'e', 'i', 'o', 'u'));
|
||||
|
||||
|
||||
@@ -51,6 +51,14 @@ public class CharacterAnalysisTab {
|
||||
private TextField stringLengthTF;
|
||||
private Integer stringLength;
|
||||
|
||||
@FXML
|
||||
private TextField minimalOccurrencesTF;
|
||||
private Integer minimalOccurrences;
|
||||
|
||||
@FXML
|
||||
private TextField minimalTaxonomyTF;
|
||||
private Integer minimalTaxonomy;
|
||||
|
||||
@FXML
|
||||
private ToggleGroup calculateForRB;
|
||||
private CalculateFor calculateFor;
|
||||
@@ -189,6 +197,49 @@ public class CharacterAnalysisTab {
|
||||
}
|
||||
});
|
||||
|
||||
// set default values
|
||||
minimalOccurrencesTF.setText("1");
|
||||
minimalOccurrences = 1;
|
||||
|
||||
minimalTaxonomyTF.setText("1");
|
||||
minimalTaxonomy = 1;
|
||||
|
||||
minimalOccurrencesTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
// focus lost
|
||||
String value = minimalOccurrencesTF.getText();
|
||||
if (!ValidationUtil.isEmpty(value)) {
|
||||
if (!ValidationUtil.isNumber(value)) {
|
||||
logAlert("minimalOccurrencesTF: " + WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
} else {
|
||||
minimalOccurrences = Integer.parseInt(value);
|
||||
}
|
||||
} else {
|
||||
minimalOccurrencesTF.setText("1");
|
||||
minimalOccurrences = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
minimalTaxonomyTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
// focus lost
|
||||
String value = minimalTaxonomyTF.getText();
|
||||
if (!ValidationUtil.isEmpty(value)) {
|
||||
if (!ValidationUtil.isNumber(value)) {
|
||||
logAlert("minimalTaxonomyTF: " + WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
} else {
|
||||
minimalTaxonomy = Integer.parseInt(value);
|
||||
}
|
||||
} else {
|
||||
minimalTaxonomyTF.setText("1");
|
||||
minimalTaxonomy = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
computeNgramsB.setOnAction(e -> {
|
||||
compute();
|
||||
logger.info("compute button");
|
||||
@@ -344,6 +395,8 @@ public class CharacterAnalysisTab {
|
||||
filter.setIsCvv(calculateCvv);
|
||||
filter.setSolarFilters(solarFiltersMap);
|
||||
filter.setStringLength(stringLength);
|
||||
filter.setMinimalOccurrences(minimalOccurrences);
|
||||
filter.setMinimalTaxonomy(minimalTaxonomy);
|
||||
|
||||
String message = Validation.validateForStringLevel(filter);
|
||||
if (message == null) {
|
||||
|
||||
@@ -105,7 +105,7 @@ public class CorpusTab {
|
||||
gosUseOrthChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
gosUseOrth = newValue;
|
||||
corpus.setGosOrthMode(gosUseOrth);
|
||||
wordFormationTab.setDisable(gosUseOrth);
|
||||
// wordFormationTab.setDisable(gosUseOrth);
|
||||
satNew2Controller.toggleMode(null);
|
||||
oneWordTabController.toggleMode(null);
|
||||
catController.toggleMode(null);
|
||||
|
||||
@@ -80,6 +80,7 @@ public class GUIController extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
Parent root = FXMLLoader.load(getClass().getResource("/GUI.fxml"));
|
||||
// Parent root = FXMLLoader.load(ResourceLookup.resources.url("GUI.fxml"));
|
||||
primaryStage.setTitle("GUI");
|
||||
Scene scene = new Scene(root, 800, 600);
|
||||
// https://github.com/dicolar/jbootx
|
||||
|
||||
@@ -15,6 +15,7 @@ public class Messages {
|
||||
public static final String WARNING_DIFFERING_NGRAM_LEVEL_AND_FILTER_TOKENS_INFO = "Izberite drugo število ali popravite filter.";
|
||||
public static final String WARNING_WORD_OR_LEMMA = "Izberite, če želite statistiko izračunati za besede ali leme.";
|
||||
public static final String WARNING_ONLY_NUMBERS_ALLOWED = "Prosim vnesite veljavno število.";
|
||||
public static final String WARNING_NUMBER_TOO_BIG = "Vnešeno število je večje od števila taksonomij.";
|
||||
public static final String WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES = "Število za ngram (%d) in število msd oznak (%d) se morata ujemati.";
|
||||
public static final String WARNING_MISSING_STRING_LENGTH = "Dolžina niza mora biti večja od 0. Vstavljena je privzeta vrednost (1).";
|
||||
public static final String WARNING_NO_TAXONOMY_FOUND = "Iz korpusnih datotek ni bilo moč razbrati taksonomije. Prosim izberite drugo lokacijo ali korpus.";
|
||||
|
||||
@@ -49,6 +49,13 @@ public class OneWordAnalysisTab {
|
||||
private ComboBox<String> calculateForCB;
|
||||
private CalculateFor calculateFor;
|
||||
|
||||
@FXML
|
||||
private TextField minimalOccurrencesTF;
|
||||
private Integer minimalOccurrences;
|
||||
|
||||
@FXML
|
||||
private TextField minimalTaxonomyTF;
|
||||
private Integer minimalTaxonomy;
|
||||
|
||||
@FXML
|
||||
private Button computeNgramsB;
|
||||
@@ -191,6 +198,49 @@ public class OneWordAnalysisTab {
|
||||
taxonomyCCB.setDisable(true);
|
||||
}
|
||||
|
||||
// set default values
|
||||
minimalOccurrencesTF.setText("1");
|
||||
minimalOccurrences = 1;
|
||||
|
||||
minimalTaxonomyTF.setText("1");
|
||||
minimalTaxonomy = 1;
|
||||
|
||||
minimalOccurrencesTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
// focus lost
|
||||
String value = minimalOccurrencesTF.getText();
|
||||
if (!ValidationUtil.isEmpty(value)) {
|
||||
if (!ValidationUtil.isNumber(value)) {
|
||||
logAlert("minimalOccurrencesTF: " + WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
} else {
|
||||
minimalOccurrences = Integer.parseInt(value);
|
||||
}
|
||||
} else {
|
||||
minimalOccurrencesTF.setText("1");
|
||||
minimalOccurrences = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
minimalTaxonomyTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
// focus lost
|
||||
String value = minimalTaxonomyTF.getText();
|
||||
if (!ValidationUtil.isEmpty(value)) {
|
||||
if (!ValidationUtil.isNumber(value)) {
|
||||
logAlert("minimalTaxonomyTF: " + WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
} else {
|
||||
minimalTaxonomy = Integer.parseInt(value);
|
||||
}
|
||||
} else {
|
||||
minimalTaxonomyTF.setText("1");
|
||||
minimalTaxonomy = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
computeNgramsB.setOnAction(e -> {
|
||||
compute();
|
||||
logger.info("compute button");
|
||||
@@ -313,6 +363,7 @@ public class OneWordAnalysisTab {
|
||||
} else {
|
||||
msdTF.setDisable(false);
|
||||
}
|
||||
calculateFor = CalculateFor.factory(calculateForCB.getItems().get(0));
|
||||
}
|
||||
|
||||
private void compute() {
|
||||
@@ -327,6 +378,8 @@ public class OneWordAnalysisTab {
|
||||
filter.setSolarFilters(solarFiltersMap);
|
||||
filter.setStringLength(1);
|
||||
filter.setMultipleKeys(alsoVisualize);
|
||||
filter.setMinimalOccurrences(minimalOccurrences);
|
||||
filter.setMinimalTaxonomy(minimalTaxonomy);
|
||||
|
||||
String message = Validation.validateForStringLevel(filter);
|
||||
if (message == null) {
|
||||
|
||||
@@ -66,6 +66,14 @@ public class StringAnalysisTabNew2 {
|
||||
private CheckBox notePunctuationsChB;
|
||||
private boolean notePunctuations;
|
||||
|
||||
@FXML
|
||||
private TextField minimalOccurrencesTF;
|
||||
private Integer minimalOccurrences;
|
||||
|
||||
@FXML
|
||||
private TextField minimalTaxonomyTF;
|
||||
private Integer minimalTaxonomy;
|
||||
|
||||
@FXML
|
||||
private Pane paneWords;
|
||||
|
||||
@@ -139,6 +147,13 @@ public class StringAnalysisTabNew2 {
|
||||
ngramValueCB.getSelectionModel().select(0); // selected index
|
||||
ngramValue = 2; // actual value at that index
|
||||
|
||||
// set default values
|
||||
minimalOccurrencesTF.setText("1");
|
||||
minimalOccurrences = 1;
|
||||
|
||||
minimalTaxonomyTF.setText("1");
|
||||
minimalTaxonomy = 1;
|
||||
|
||||
notePunctuations = true;
|
||||
// set
|
||||
notePunctuationsChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
@@ -240,6 +255,42 @@ public class StringAnalysisTabNew2 {
|
||||
}
|
||||
});
|
||||
|
||||
minimalOccurrencesTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
// focus lost
|
||||
String value = minimalOccurrencesTF.getText();
|
||||
if (!ValidationUtil.isEmpty(value)) {
|
||||
if (!ValidationUtil.isNumber(value)) {
|
||||
logAlert("minimalOccurrencesTF: " + WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
} else {
|
||||
minimalOccurrences = Integer.parseInt(value);
|
||||
}
|
||||
} else {
|
||||
minimalOccurrencesTF.setText("1");
|
||||
minimalOccurrences = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
minimalTaxonomyTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
// focus lost
|
||||
String value = minimalTaxonomyTF.getText();
|
||||
if (!ValidationUtil.isEmpty(value)) {
|
||||
if (!ValidationUtil.isNumber(value)) {
|
||||
logAlert("minimalTaxonomyTF: " + WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
} else {
|
||||
minimalTaxonomy = Integer.parseInt(value);
|
||||
}
|
||||
} else {
|
||||
minimalTaxonomyTF.setText("1");
|
||||
minimalTaxonomy = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
computeNgramsB.setOnAction(e -> {
|
||||
compute();
|
||||
logger.info("compute button");
|
||||
@@ -411,6 +462,8 @@ public class StringAnalysisTabNew2 {
|
||||
filter.setIsCvv(calculateCvv);
|
||||
filter.setSolarFilters(solarFiltersMap);
|
||||
filter.setNotePunctuations(notePunctuations);
|
||||
filter.setMinimalOccurrences(minimalOccurrences);
|
||||
filter.setMinimalTaxonomy(minimalTaxonomy);
|
||||
|
||||
if (ngramValue != null && ngramValue == 0) {
|
||||
filter.setStringLength(stringLength);
|
||||
|
||||
@@ -40,6 +40,14 @@ public class WordFormationTab {
|
||||
private CheckComboBox<String> taxonomyCCB;
|
||||
private ArrayList<String> taxonomy;
|
||||
|
||||
@FXML
|
||||
private TextField minimalOccurrencesTF;
|
||||
private Integer minimalOccurrences;
|
||||
|
||||
@FXML
|
||||
private TextField minimalTaxonomyTF;
|
||||
private Integer minimalTaxonomy;
|
||||
|
||||
@FXML
|
||||
private Button computeB;
|
||||
|
||||
@@ -77,6 +85,49 @@ public class WordFormationTab {
|
||||
taxonomyCCB.setDisable(true);
|
||||
}
|
||||
|
||||
// set default values
|
||||
minimalOccurrencesTF.setText("1");
|
||||
minimalOccurrences = 1;
|
||||
|
||||
minimalTaxonomyTF.setText("1");
|
||||
minimalTaxonomy = 1;
|
||||
|
||||
minimalOccurrencesTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
// focus lost
|
||||
String value = minimalOccurrencesTF.getText();
|
||||
if (!ValidationUtil.isEmpty(value)) {
|
||||
if (!ValidationUtil.isNumber(value)) {
|
||||
logAlert("minimalOccurrencesTF: " + WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
} else {
|
||||
minimalOccurrences = Integer.parseInt(value);
|
||||
}
|
||||
} else {
|
||||
minimalOccurrencesTF.setText("1");
|
||||
minimalOccurrences = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
minimalTaxonomyTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
// focus lost
|
||||
String value = minimalTaxonomyTF.getText();
|
||||
if (!ValidationUtil.isEmpty(value)) {
|
||||
if (!ValidationUtil.isNumber(value)) {
|
||||
logAlert("minimalTaxonomyTF: " + WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
} else {
|
||||
minimalTaxonomy = Integer.parseInt(value);
|
||||
}
|
||||
} else {
|
||||
minimalTaxonomyTF.setText("1");
|
||||
minimalTaxonomy = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
computeB.setOnAction(e -> {
|
||||
compute();
|
||||
logger.info("compute button");
|
||||
@@ -95,6 +146,8 @@ public class WordFormationTab {
|
||||
filter.setMsd(new ArrayList<>());
|
||||
filter.setIsCvv(false);
|
||||
filter.setSolarFilters(solarFiltersMap);
|
||||
filter.setMinimalOccurrences(minimalOccurrences);
|
||||
filter.setMinimalTaxonomy(minimalTaxonomy);
|
||||
|
||||
String message = Validation.validateForStringLevel(filter);
|
||||
if (message == null) {
|
||||
|
||||
@@ -40,6 +40,14 @@ public class WordLevelTab {
|
||||
private CheckComboBox<String> taxonomyCCB;
|
||||
private ArrayList<String> taxonomy;
|
||||
|
||||
@FXML
|
||||
private TextField minimalOccurrencesTF;
|
||||
private Integer minimalOccurrences;
|
||||
|
||||
@FXML
|
||||
private TextField minimalTaxonomyTF;
|
||||
private Integer minimalTaxonomy;
|
||||
|
||||
@FXML
|
||||
private Button computeB;
|
||||
|
||||
@@ -77,6 +85,49 @@ public class WordLevelTab {
|
||||
taxonomyCCB.setDisable(true);
|
||||
}
|
||||
|
||||
// set default values
|
||||
minimalOccurrencesTF.setText("1");
|
||||
minimalOccurrences = 1;
|
||||
|
||||
minimalTaxonomyTF.setText("1");
|
||||
minimalTaxonomy = 1;
|
||||
|
||||
minimalOccurrencesTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
// focus lost
|
||||
String value = minimalOccurrencesTF.getText();
|
||||
if (!ValidationUtil.isEmpty(value)) {
|
||||
if (!ValidationUtil.isNumber(value)) {
|
||||
logAlert("minimalOccurrencesTF: " + WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
} else {
|
||||
minimalOccurrences = Integer.parseInt(value);
|
||||
}
|
||||
} else {
|
||||
minimalOccurrencesTF.setText("1");
|
||||
minimalOccurrences = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
minimalTaxonomyTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
// focus lost
|
||||
String value = minimalTaxonomyTF.getText();
|
||||
if (!ValidationUtil.isEmpty(value)) {
|
||||
if (!ValidationUtil.isNumber(value)) {
|
||||
logAlert("minimalTaxonomyTF: " + WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
GUIController.showAlert(Alert.AlertType.ERROR, WARNING_ONLY_NUMBERS_ALLOWED);
|
||||
} else {
|
||||
minimalTaxonomy = Integer.parseInt(value);
|
||||
}
|
||||
} else {
|
||||
minimalTaxonomyTF.setText("1");
|
||||
minimalTaxonomy = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
computeB.setOnAction(e -> {
|
||||
compute();
|
||||
logger.info("compute button");
|
||||
@@ -98,6 +149,8 @@ public class WordLevelTab {
|
||||
filter.setMsd(new ArrayList<>());
|
||||
filter.setIsCvv(false);
|
||||
filter.setSolarFilters(solarFiltersMap);
|
||||
filter.setMinimalOccurrences(minimalOccurrences);
|
||||
filter.setMinimalTaxonomy(minimalTaxonomy);
|
||||
|
||||
String message = Validation.validateForStringLevel(filter);
|
||||
if (message == null) {
|
||||
|
||||
@@ -86,16 +86,28 @@ public class Export {
|
||||
|
||||
|
||||
//CSV file header
|
||||
if (headerInfoBlock.containsKey("Analiza") && headerInfoBlock.get("Analiza").equals("Besede")) {
|
||||
if (headerInfoBlock.containsKey("Analiza") && (headerInfoBlock.get("Analiza").equals("Besede") || headerInfoBlock.get("Analiza").equals("Besedni nizi"))) {
|
||||
if (headerInfoBlock.containsKey("Izračunaj za:") && headerInfoBlock.get("Izračunaj za:").equals("različnica")) {
|
||||
headerInfoBlock.put("Skupna vsota vseh različnic:", String.valueOf(num_frequencies));
|
||||
FILE_HEADER_AL.add("Različnica");
|
||||
if (headerInfoBlock.get("Analiza").equals("Besede")){
|
||||
FILE_HEADER_AL.add("Različnica");
|
||||
} else if (headerInfoBlock.get("Analiza").equals("Besedni nizi")) {
|
||||
FILE_HEADER_AL.add("Različnice");
|
||||
}
|
||||
} else if (headerInfoBlock.containsKey("Izračunaj za:") && headerInfoBlock.get("Izračunaj za:").equals("lema")) {
|
||||
headerInfoBlock.put("Skupna vsota vseh lem:", String.valueOf(num_frequencies));
|
||||
FILE_HEADER_AL.add("Lema");
|
||||
if (headerInfoBlock.get("Analiza").equals("Besede")){
|
||||
FILE_HEADER_AL.add("Lema");
|
||||
} else if (headerInfoBlock.get("Analiza").equals("Besedni nizi")) {
|
||||
FILE_HEADER_AL.add("Leme");
|
||||
}
|
||||
} else if (headerInfoBlock.containsKey("Izračunaj za:") && headerInfoBlock.get("Izračunaj za:").equals("oblikoskladenjska oznaka")) {
|
||||
headerInfoBlock.put("Skupna vsota vseh oblikoskladenjskih oznak:", String.valueOf(num_frequencies));
|
||||
FILE_HEADER_AL.add("Oblikoskladenjska oznaka");
|
||||
if (headerInfoBlock.get("Analiza").equals("Besede")){
|
||||
FILE_HEADER_AL.add("Oblikoskladenjska oznaka");
|
||||
} else if (headerInfoBlock.get("Analiza").equals("Besedni nizi")) {
|
||||
FILE_HEADER_AL.add("Oblikoskladenjska oznake");
|
||||
}
|
||||
} else {
|
||||
headerInfoBlock.put("Skupna vsota vseh različnic:", String.valueOf(num_frequencies));
|
||||
FILE_HEADER_AL.add("Lema");
|
||||
|
||||
Reference in New Issue
Block a user