Added some style modifications.

master
Luka 6 years ago
parent cbfe3e6025
commit a7f3bdb925

@ -637,7 +637,7 @@ public class XML_processing {
// parser reached end of the current sentence // parser reached end of the current sentence
if (endElement.getName().getLocalPart().equals(sentenceDelimiter)) { if (endElement.getName().getLocalPart().equals(sentenceDelimiter)) {
// count all UniGramOccurrences in sentence for statistics // count all UniGramOccurrences in sentence for statistics
stats.updateUniGramOccurrences(sentence.size()); stats.updateUniGramOccurrences(sentence.size(), currentFiletaxonomyLong);
// add sentence to corpus if it passes filters // add sentence to corpus if it passes filters
sentence = runFilters(sentence, stats.getFilter()); sentence = runFilters(sentence, stats.getFilter());

@ -43,7 +43,7 @@ public class StatisticsNew {
private LocalDateTime timeBeginning; private LocalDateTime timeBeginning;
private LocalDateTime timeEnding; private LocalDateTime timeEnding;
private Map<Collocability, Map<MultipleHMKeys, Double>> collocability; private Map<Collocability, Map<MultipleHMKeys, Double>> collocability;
private AtomicLong uniGramOccurrences; private Map<String, AtomicLong> uniGramTaxonomyOccurrences;
public StatisticsNew(Corpus corpus, Filter filter, boolean useDB) { public StatisticsNew(Corpus corpus, Filter filter, boolean useDB) {
this.corpus = corpus; this.corpus = corpus;
@ -51,7 +51,8 @@ public class StatisticsNew {
this.taxonomyResult = new ConcurrentHashMap<>(); this.taxonomyResult = new ConcurrentHashMap<>();
this.taxonomyResult.put("Total", new ConcurrentHashMap<>()); this.taxonomyResult.put("Total", new ConcurrentHashMap<>());
this.collocability = new ConcurrentHashMap<>(); this.collocability = new ConcurrentHashMap<>();
this.uniGramOccurrences = new AtomicLong(0L); this.uniGramTaxonomyOccurrences = new ConcurrentHashMap<>();
this.uniGramTaxonomyOccurrences.put("Total", new AtomicLong(0L));
// create table for counting word occurrences per taxonomies // create table for counting word occurrences per taxonomies
@ -342,12 +343,20 @@ public class StatisticsNew {
return Util.sortByValue(Util.atomicInt2StringAndInt(map), limit); return Util.sortByValue(Util.atomicInt2StringAndInt(map), limit);
} }
public void updateUniGramOccurrences(int amount){ public void updateUniGramOccurrences(int amount, ArrayList<String> taxonomy){
uniGramOccurrences.set(uniGramOccurrences.get() + amount); uniGramTaxonomyOccurrences.get("Total").set(uniGramTaxonomyOccurrences.get("Total").longValue() + amount);
for (String t : taxonomy){
if (uniGramTaxonomyOccurrences.get(t) != null){
uniGramTaxonomyOccurrences.get(t).set(uniGramTaxonomyOccurrences.get(t).longValue() + amount);
} else {
uniGramTaxonomyOccurrences.put(t, new AtomicLong(amount));
}
}
} }
public long getUniGramOccurrences(){ public Map<String, AtomicLong> getUniGramOccurrences(){
return uniGramOccurrences.longValue(); // return uniGramTaxonomyOccurrences.get("Total").longValue();
return uniGramTaxonomyOccurrences;
} }
public void updateTaxonomyResults(MultipleHMKeys o, List<String> taxonomy) { public void updateTaxonomyResults(MultipleHMKeys o, List<String> taxonomy) {
@ -456,16 +465,21 @@ public class StatisticsNew {
info.put("Korpus:", corpus.getCorpusType().toString()); info.put("Korpus:", corpus.getCorpusType().toString());
setTimeEnding(); setTimeEnding();
info.put("Datum:", timeEnding.format(DateTimeFormatter.ofPattern("dd.MM.yyyy hh:mm"))); info.put("Datum:", timeEnding.format(DateTimeFormatter.ofPattern("dd.MM.yyyy hh:mm")));
// time elapsed
long seconds = ChronoUnit.MILLIS.between(timeBeginning, timeEnding) / 1000;
info.put("Čas izvajanja:", 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("Analiza:", "črke");
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("Analiza:", "besedni deli");
} else { } else {
info.put("Analiza:", "Besede"); info.put("Analiza:", "besede");
} }
} else } else
info.put("Analiza:", filter.getAl().toString()); info.put("Analiza:", filter.getAl().toString());
@ -473,97 +487,102 @@ public class StatisticsNew {
info.put("Analiza:", filter.getAl().toString()); info.put("Analiza:", filter.getAl().toString());
} }
if (filter.getAl() == AnalysisLevel.STRING_LEVEL) { // if (filter.getAl() == AnalysisLevel.STRING_LEVEL) {
Integer ngramLevel = filter.getNgramValue(); Integer ngramLevel = filter.getNgramValue();
// n.gram nivo
if (ngramLevel > 1) {
info.put("n-gram nivo:", String.valueOf(ngramLevel));
}
// skip if (ngramLevel == 0){
if (ngramLevel > 1) info.put("Število črk:", filter.getStringLength().toString());
info.put("Skip:", isNotEmpty(filter.getSkipValue()) ? filter.getSkipValue().toString() : "0"); }
// calculate for // calculate for
info.put("Izračunaj za:", filter.getCalculateFor().toString()); info.put("Izračunaj za:", filter.getCalculateFor().toString());
// also write // also write
if (filter.getMultipleKeys().size() > 0){ if (filter.getMultipleKeys().size() > 0){
StringBuilder mk = new StringBuilder(); StringBuilder mk = new StringBuilder();
for (CalculateFor s : filter.getMultipleKeys()) { for (CalculateFor s : filter.getMultipleKeys()) {
mk.append(s.toString()).append("; "); mk.append(s.toString()).append("; ");
} }
info.put("Izpiši tudi: ", String.join("; ", mk.substring(0, mk.length() - 2))); info.put("Izpiši tudi: ", String.join("; ", mk.substring(0, mk.length() - 2)));
} } else {
info.put("Izpiši tudi: ", "");
}
// time elapsed // data limitations
// setTimeEnding(); if (filter.getDisplayTaxonomy()){
long seconds = ChronoUnit.MILLIS.between(timeBeginning, timeEnding) / 1000; info.put("Izpiši taksonomije: ", "da");
info.put("Čas izvajanja:", String.valueOf(seconds) + " s"); } else {
info.put("Izpiši taksonomije: ", "ne");
}
// data limitations // n.gram nivo
if (filter.getDisplayTaxonomy()){ if (ngramLevel > 1) {
info.put("Izpiši taksonomije: ", "Da"); info.put("N-gram nivo:", String.valueOf(ngramLevel));
} else { }
info.put("Izpiši taksonomije: ", "Ne");
}
// note punctuations - ngram > 1 // skip
if(ngramLevel > 1) { if (ngramLevel > 1)
if (filter.getNotePunctuations()) { info.put("Preskok besed:", isNotEmpty(filter.getSkipValue()) ? filter.getSkipValue().toString() : "0");
info.put("Upoštevaj ločila: ", "Da");
} else {
info.put("Upoštevaj ločila: ", "Ne");
}
}
// also write - n - gram > 1 // note punctuations - ngram > 1
if (ngramLevel > 1 && filter.getCollocability().size() > 0){ if(ngramLevel > 1) {
StringBuilder mk = new StringBuilder(); if (filter.getNotePunctuations()) {
for (Collocability s : filter.getCollocability()) { info.put("Upoštevaj ločila: ", "da");
mk.append(s.toString()).append("; "); } else {
} info.put("Upoštevaj ločila: ", "ne");
info.put("Kolokabilnost: ", String.join("; ", mk.substring(0, mk.length() - 2))); }
} }
// fragmented MSD - n-gram = 1
if (info.get("Analiza:").equals("Besede")){
if (filter.getWriteMsdAtTheEnd()){
info.put("Izpiši razbit MSD: ", "Da");
} else {
info.put("Izpiši razbit MSD: ", "Ne");
}
}
if (filter.getSuffixLength() != null || filter.getSuffixList() != null || filter.getPrefixLength() != null || filter.getPrefixList() != null) { // also write - n - gram > 1
if (filter.getPrefixLength() > 0 || filter.getSuffixLength() > 0) { if (ngramLevel > 1 && filter.getCollocability().size() > 0){
info.put("Dolžina predpone: ", String.valueOf(filter.getPrefixLength())); StringBuilder mk = new StringBuilder();
info.put("Dolžina pripone: ", String.valueOf(filter.getSuffixLength())); for (Collocability s : filter.getCollocability()) {
} else { mk.append(s.toString()).append("; ");
info.put("Seznam predpon: ", String.join("; ", filter.getPrefixList())); }
info.put("Seznam pripon: ", String.join("; ", filter.getSuffixList())); info.put("Kolokabilnost: ", String.join("; ", mk.substring(0, mk.length() - 2)));
} } else {
} info.put("Kolokabilnost: ", "");
}
// msd // fragmented MSD - n-gram = 1
if (!isEmpty(filter.getMsd())) { if (info.get("Analiza:").equals("besede")){
StringBuilder msdPattern = new StringBuilder(); if (filter.getWriteMsdAtTheEnd()){
for (Pattern pattern : filter.getMsd()) { info.put("Izpiši razbit MSD: ", "da");
msdPattern.append(pattern.toString()).append(" "); } else {
} info.put("Izpiši razbit MSD: ", "ne");
}
}
info.put("MSD:", msdPattern.toString()); if (filter.getSuffixLength() != null || filter.getSuffixList() != null || filter.getPrefixLength() != null || filter.getPrefixList() != null) {
if (filter.getPrefixLength() > 0 || filter.getSuffixLength() > 0) {
info.put("Dolžina predpone: ", String.valueOf(filter.getPrefixLength()));
info.put("Dolžina pripone: ", String.valueOf(filter.getSuffixLength()));
} else {
info.put("Seznam predpon: ", String.join("; ", filter.getPrefixList()));
info.put("Seznam pripon: ", String.join("; ", filter.getSuffixList()));
} }
}
// msd
if (!isEmpty(filter.getMsd())) {
StringBuilder msdPattern = new StringBuilder();
for (Pattern pattern : filter.getMsd()) {
msdPattern.append(pattern.toString()).append(" ");
}
info.put("Oznaka MSD:", msdPattern.toString());
} else {
info.put("Oznaka MSD:", "");
} }
// }
info.put("Taksonomija: ", "");
if (isNotEmpty(filter.getTaxonomy()) && Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType())) { if (isNotEmpty(filter.getTaxonomy()) && Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType())) {
ArrayList<String> tax = Tax.getTaxonomyForInfo(corpus.getCorpusType(), filter.getTaxonomy()); ArrayList<String> tax = Tax.getTaxonomyForInfo(corpus.getCorpusType(), filter.getTaxonomy());
info.put("Taksonomija: ", "");
String sep = ""; String sep = "";
for (String s : tax) { for (String s : tax) {
info.put(sep = sep + " ", s); info.put(sep = sep + " ", s);

@ -10,6 +10,7 @@ import javafx.collections.ObservableList;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane; import javafx.scene.layout.Pane;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -29,6 +30,9 @@ import static gui.Messages.*;
public class CharacterAnalysisTab { public class CharacterAnalysisTab {
public final static Logger logger = LogManager.getLogger(CharacterAnalysisTab.class); public final static Logger logger = LogManager.getLogger(CharacterAnalysisTab.class);
@FXML
public AnchorPane characterAnalysisTab;
@FXML @FXML
public Label selectedFiltersLabel; public Label selectedFiltersLabel;
@FXML @FXML
@ -116,6 +120,9 @@ public class CharacterAnalysisTab {
private CorpusType currentCorpusType; private CorpusType currentCorpusType;
public void init() { public void init() {
characterAnalysisTab.getStylesheets().add("style.css");
characterAnalysisTab.getStyleClass().add("root");
currentMode = MODE.LETTER; currentMode = MODE.LETTER;
toggleMode(currentMode); toggleMode(currentMode);
@ -191,6 +198,15 @@ public class CharacterAnalysisTab {
// set // set
displayTaxonomyChB.selectedProperty().addListener((observable, oldValue, newValue) -> { displayTaxonomyChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
displayTaxonomy = newValue; displayTaxonomy = newValue;
if(displayTaxonomy){
minimalTaxonomyTF.setDisable(false);
} else {
minimalTaxonomyTF.setDisable(true);
minimalTaxonomyTF.setText("1");
minimalTaxonomy = 1;
}
logger.info("display taxonomy: ", displayTaxonomy); logger.info("display taxonomy: ", displayTaxonomy);
}); });
displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB)); displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB));
@ -228,6 +244,8 @@ public class CharacterAnalysisTab {
minimalTaxonomyTF.setText("1"); minimalTaxonomyTF.setText("1");
minimalTaxonomy = 1; minimalTaxonomy = 1;
minimalTaxonomyTF.setDisable(true);
minimalOccurrencesTF.focusedProperty().addListener((observable, oldValue, newValue) -> { minimalOccurrencesTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue) { if (!newValue) {
// focus lost // focus lost

@ -11,6 +11,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import javafx.scene.layout.AnchorPane;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOCase; import org.apache.commons.io.IOCase;
import org.apache.commons.io.filefilter.FileFilterUtils; import org.apache.commons.io.filefilter.FileFilterUtils;
@ -38,6 +39,9 @@ public class CorpusTab {
private Stage stage; private Stage stage;
@FXML
private AnchorPane corpusTabPane;
@FXML @FXML
private Button chooseCorpusLocationB; private Button chooseCorpusLocationB;
private File chosenCorpusLocation; private File chosenCorpusLocation;
@ -89,6 +93,10 @@ public class CorpusTab {
public void initialize() { public void initialize() {
// add CSS style
corpusTabPane.getStylesheets().add("style.css");
corpusTabPane.getStyleClass().add("root");
stage = new Stage(); stage = new Stage();
// add listeners // add listeners

@ -52,6 +52,9 @@ public class FiltersForSolar {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void initialize() { public void initialize() {
solarFiltersTabPane.getStylesheets().add("style.css");
solarFiltersTabPane.getStyleClass().add("root");
selectedFilters = new HashMap<>(); selectedFilters = new HashMap<>();
solarRegijaCCB.getCheckModel().getCheckedItems().addListener((ListChangeListener) c -> { solarRegijaCCB.getCheckModel().getCheckedItems().addListener((ListChangeListener) c -> {

@ -2,6 +2,7 @@ package gui;
import java.io.IOException; import java.io.IOException;
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;
import org.kordamp.ikonli.fontawesome.FontAwesome; import org.kordamp.ikonli.fontawesome.FontAwesome;
@ -21,6 +22,8 @@ import javafx.stage.Stage;
public class GUIController extends Application { public class GUIController extends Application {
public final static Logger logger = LogManager.getLogger(GUIController.class); public final static Logger logger = LogManager.getLogger(GUIController.class);
@FXML
public AnchorPane gui;
@FXML @FXML
public Tab StringLevelTabNew2; public Tab StringLevelTabNew2;
@FXML @FXML
@ -95,6 +98,10 @@ public class GUIController extends Application {
} }
public void initialize() { public void initialize() {
// add CSS style
gui.getStylesheets().add("style.css");
gui.getStyleClass().add("root");
corpus = new Corpus(); corpus = new Corpus();
ctController.setCorpus(corpus); ctController.setCorpus(corpus);
ctController.setFilterTab(filterTab); ctController.setFilterTab(filterTab);

@ -7,7 +7,9 @@ import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.Scene;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.layout.AnchorPane;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -27,6 +29,10 @@ import static gui.Messages.*;
public class OneWordAnalysisTab { public class OneWordAnalysisTab {
public final static Logger logger = LogManager.getLogger(OneWordAnalysisTab.class); public final static Logger logger = LogManager.getLogger(OneWordAnalysisTab.class);
@FXML
private AnchorPane oneWordAnalysisTabPane;
// private ArrayList<String> alsoVisualize;
@FXML @FXML
public Label selectedFiltersLabel; public Label selectedFiltersLabel;
@FXML @FXML
@ -109,6 +115,10 @@ public class OneWordAnalysisTab {
private CorpusType currentCorpusType; private CorpusType currentCorpusType;
public void init() { public void init() {
// add CSS style
oneWordAnalysisTabPane.getStylesheets().add("style.css");
oneWordAnalysisTabPane.getStyleClass().add("root");
currentMode = MODE.WORD; currentMode = MODE.WORD;
toggleMode(currentMode); toggleMode(currentMode);
@ -227,6 +237,14 @@ public class OneWordAnalysisTab {
// set // set
displayTaxonomyChB.selectedProperty().addListener((observable, oldValue, newValue) -> { displayTaxonomyChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
displayTaxonomy = newValue; displayTaxonomy = newValue;
if(displayTaxonomy){
minimalTaxonomyTF.setDisable(false);
} else {
minimalTaxonomyTF.setDisable(true);
minimalTaxonomyTF.setText("1");
minimalTaxonomy = 1;
}
logger.info("display taxonomy: ", displayTaxonomy); logger.info("display taxonomy: ", displayTaxonomy);
}); });
displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB)); displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB));
@ -247,6 +265,8 @@ public class OneWordAnalysisTab {
minimalTaxonomyTF.setText("1"); minimalTaxonomyTF.setText("1");
minimalTaxonomy = 1; minimalTaxonomy = 1;
minimalTaxonomyTF.setDisable(true);
minimalOccurrencesTF.focusedProperty().addListener((observable, oldValue, newValue) -> { minimalOccurrencesTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue) { if (!newValue) {
// focus lost // focus lost

@ -13,6 +13,7 @@ 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.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;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -32,6 +33,9 @@ import javafx.scene.layout.Pane;
public class StringAnalysisTabNew2 { public class StringAnalysisTabNew2 {
public final static Logger logger = LogManager.getLogger(StringAnalysisTabNew2.class); public final static Logger logger = LogManager.getLogger(StringAnalysisTabNew2.class);
@FXML
public AnchorPane stringAnalysisTabPaneNew2;
@FXML @FXML
public Label selectedFiltersLabel; public Label selectedFiltersLabel;
@FXML @FXML
@ -143,6 +147,10 @@ public class StringAnalysisTabNew2 {
private CorpusType currentCorpusType; private CorpusType currentCorpusType;
public void init() { public void init() {
// add CSS style
stringAnalysisTabPaneNew2.getStylesheets().add("style.css");
stringAnalysisTabPaneNew2.getStyleClass().add("root");
currentMode = MODE.WORD; currentMode = MODE.WORD;
toggleMode(currentMode); toggleMode(currentMode);
@ -179,6 +187,8 @@ public class StringAnalysisTabNew2 {
minimalTaxonomyTF.setText("1"); minimalTaxonomyTF.setText("1");
minimalTaxonomy = 1; minimalTaxonomy = 1;
minimalTaxonomyTF.setDisable(true);
notePunctuations = false; notePunctuations = false;
// set // set
notePunctuationsChB.selectedProperty().addListener((observable, oldValue, newValue) -> { notePunctuationsChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
@ -191,6 +201,14 @@ public class StringAnalysisTabNew2 {
// set // set
displayTaxonomyChB.selectedProperty().addListener((observable, oldValue, newValue) -> { displayTaxonomyChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
displayTaxonomy = newValue; displayTaxonomy = newValue;
if(displayTaxonomy){
minimalTaxonomyTF.setDisable(false);
} else {
minimalTaxonomyTF.setDisable(true);
minimalTaxonomyTF.setText("1");
minimalTaxonomy = 1;
}
logger.info("display taxonomy: ", displayTaxonomy); logger.info("display taxonomy: ", displayTaxonomy);
}); });
displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB)); displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB));

@ -8,6 +8,7 @@ import javafx.collections.ObservableList;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.layout.AnchorPane;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -27,6 +28,9 @@ import static gui.Messages.*;
public class WordLevelTab { public class WordLevelTab {
public final static Logger logger = LogManager.getLogger(OneWordAnalysisTab.class); public final static Logger logger = LogManager.getLogger(OneWordAnalysisTab.class);
@FXML
public AnchorPane wordLevelAnalysisTabPane;
@FXML @FXML
public Label selectedFiltersLabel; public Label selectedFiltersLabel;
@FXML @FXML
@ -125,6 +129,10 @@ public class WordLevelTab {
private CorpusType currentCorpusType; private CorpusType currentCorpusType;
public void init() { public void init() {
// add CSS style
wordLevelAnalysisTabPane.getStylesheets().add("style.css");
wordLevelAnalysisTabPane.getStyleClass().add("root");
currentMode = MODE.WORD; currentMode = MODE.WORD;
toggleMode(currentMode); toggleMode(currentMode);
@ -216,6 +224,7 @@ public class WordLevelTab {
logger.info("Prefix length " + suffixLength); logger.info("Prefix length " + suffixLength);
}); });
prefixListTF.setText("");
prefixList = new ArrayList<>(); prefixList = new ArrayList<>();
prefixListTF.textProperty().addListener((observable, oldValue, newValue) -> { prefixListTF.textProperty().addListener((observable, oldValue, newValue) -> {
@ -248,6 +257,7 @@ public class WordLevelTab {
} }
}); });
suffixListTF.setText("");
suffixList = new ArrayList<>(); suffixList = new ArrayList<>();
suffixListTF.textProperty().addListener((observable, oldValue, newValue) -> { suffixListTF.textProperty().addListener((observable, oldValue, newValue) -> {
@ -350,6 +360,14 @@ public class WordLevelTab {
// set // set
displayTaxonomyChB.selectedProperty().addListener((observable, oldValue, newValue) -> { displayTaxonomyChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
displayTaxonomy = newValue; displayTaxonomy = newValue;
if(displayTaxonomy){
minimalTaxonomyTF.setDisable(false);
} else {
minimalTaxonomyTF.setDisable(true);
minimalTaxonomyTF.setText("1");
minimalTaxonomy = 1;
}
logger.info("display taxonomy: ", displayTaxonomy); logger.info("display taxonomy: ", displayTaxonomy);
}); });
displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB)); displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB));
@ -370,6 +388,8 @@ public class WordLevelTab {
minimalTaxonomyTF.setText("1"); minimalTaxonomyTF.setText("1");
minimalTaxonomy = 1; minimalTaxonomy = 1;
minimalTaxonomyTF.setDisable(true);
minimalOccurrencesTF.focusedProperty().addListener((observable, oldValue, newValue) -> { minimalOccurrencesTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue) { if (!newValue) {
// focus lost // focus lost

@ -76,15 +76,16 @@ public class Export {
num_frequencies = Util.mapSumFrequencies(map); num_frequencies = Util.mapSumFrequencies(map);
} }
Map<String, Long> num_taxonomy_frequencies = new ConcurrentHashMap<>(); // Map<String, Long> num_taxonomy_frequencies = new ConcurrentHashMap<>();
for (String taxonomyKey : taxonomyResults.keySet()) { // for (String taxonomyKey : taxonomyResults.keySet()) {
num_taxonomy_frequencies.put(taxonomyKey, (long) 0); // num_taxonomy_frequencies.put(taxonomyKey, (long) 0);
for (AtomicLong value : taxonomyResults.get(taxonomyKey).values()){ // for (AtomicLong value : taxonomyResults.get(taxonomyKey).values()){
long val = num_taxonomy_frequencies.get(taxonomyKey); // long val = num_taxonomy_frequencies.get(taxonomyKey);
val += value.get(); // val += value.get();
num_taxonomy_frequencies.put(taxonomyKey, val); // num_taxonomy_frequencies.put(taxonomyKey, val);
} // }
} // }
Map<String, AtomicLong> num_taxonomy_frequencies = statistics.getUniGramOccurrences();
//CSV file header //CSV file header
@ -105,7 +106,7 @@ public class Export {
} }
} }
headerInfoBlock.put(filter.getCalculateFor().toMetadataString(), String.valueOf(statistics.getUniGramOccurrences())); headerInfoBlock.put(filter.getCalculateFor().toMetadataString(), String.valueOf(statistics.getUniGramOccurrences().get("Total").longValue()));
// headerInfoBlock.put(filter.getCalculateFor().toMetadataString(), String.valueOf(num_frequencies)); // headerInfoBlock.put(filter.getCalculateFor().toMetadataString(), String.valueOf(num_frequencies));
for (CalculateFor otherKey : filter.getMultipleKeys()) { for (CalculateFor otherKey : filter.getMultipleKeys()) {
@ -127,7 +128,7 @@ public class Export {
} }
for (String key : taxonomyResults.keySet()) { for (String key : taxonomyResults.keySet()) {
if(!key.equals("Total") && num_taxonomy_frequencies.get(key) > 0) { if(!key.equals("Total") && num_taxonomy_frequencies.get(key).longValue() > 0) {
FILE_HEADER_AL.add("Absolutna pogostost [" + key + "]"); FILE_HEADER_AL.add("Absolutna pogostost [" + key + "]");
FILE_HEADER_AL.add("Delež [" + key + "]"); FILE_HEADER_AL.add("Delež [" + key + "]");
FILE_HEADER_AL.add("Relativna pogostost [" + key + "]"); FILE_HEADER_AL.add("Relativna pogostost [" + key + "]");
@ -270,13 +271,13 @@ public class Export {
dataEntry.add(formatNumberAsPercent((double) e.getValue() / num_frequencies)); dataEntry.add(formatNumberAsPercent((double) e.getValue() / num_frequencies));
dataEntry.add(String.format("%.2f", ((double) e.getValue() * 1000000)/num_frequencies)); dataEntry.add(String.format("%.2f", ((double) e.getValue() * 1000000)/num_frequencies));
for (String key : taxonomyResults.keySet()){ for (String key : taxonomyResults.keySet()){
if(!key.equals("Total") && num_taxonomy_frequencies.get(key) > 0) { if(!key.equals("Total") && num_taxonomy_frequencies.get(key).longValue() > 0) {
AtomicLong frequency = taxonomyResults.get(key).get(e.getKey()); AtomicLong frequency = taxonomyResults.get(key).get(e.getKey());
dataEntry.add(frequency.toString()); dataEntry.add(frequency.toString());
// dataEntry.add(formatNumberAsPercent((double) frequency.get() / num_taxonomy_frequencies.get(key))); dataEntry.add(formatNumberAsPercent((double) frequency.get() / num_taxonomy_frequencies.get(key).longValue()));
// dataEntry.add(String.format("%.2f", ((double) frequency.get() * 1000000) / num_taxonomy_frequencies.get(key))); dataEntry.add(String.format("%.2f", ((double) frequency.get() * 1000000) / num_taxonomy_frequencies.get(key).longValue()));
dataEntry.add(formatNumberAsPercent((double) frequency.get() / statistics.getUniGramOccurrences())); // dataEntry.add(formatNumberAsPercent((double) frequency.get() / statistics.getUniGramOccurrences()));
dataEntry.add(String.format("%.2f", ((double) frequency.get() * 1000000) / statistics.getUniGramOccurrences())); // dataEntry.add(String.format("%.2f", ((double) frequency.get() * 1000000) / statistics.getUniGramOccurrences()));
} }
} }

@ -7,7 +7,7 @@
<?import javafx.collections.FXCollections?> <?import javafx.collections.FXCollections?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" <AnchorPane fx:id="gui" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="gui.GUIController"> fx:controller="gui.GUIController">
<children> <children>
<TabPane fx:id="tabPane" prefHeight="600.0" prefWidth="800.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.bottomAnchor="0.0" <TabPane fx:id="tabPane" prefHeight="600.0" prefWidth="800.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.bottomAnchor="0.0"

@ -8,7 +8,7 @@
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.Pane?>
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" <AnchorPane fx:id="corpusTabPane" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="gui.CorpusTab"> fx:controller="gui.CorpusTab">
<children> <children>
<Pane/> <Pane/>
@ -18,7 +18,7 @@
text="Preberi info iz headerjev"/> 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="50.0" prefWidth="704.0" text="Label"/> <Label fx:id="chooseCorpusL" prefHeight="70.0" prefWidth="704.0" text="Label"/>
<!--<CheckBox fx:id="gosUseOrthChB" layoutY="65.0" mnemonicParsing="false" text="Uporabi pogovorni zapis"/>--> <!--<CheckBox fx:id="gosUseOrthChB" layoutY="65.0" mnemonicParsing="false" text="Uporabi pogovorni zapis"/>-->
</children> </children>
</Pane> </Pane>

@ -37,6 +37,9 @@
</ComboBox> </ComboBox>
</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"/>
<!-- 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 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">
@ -57,6 +60,8 @@
<Label layoutX="10.0" layoutY="100.0" prefHeight="25.0" text="Izpiši taksonomije" /> <Label 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 layoutX="10.0" layoutY="140.0" prefHeight="25.0" text="N-gram nivo" /> <Label 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>

Loading…
Cancel
Save