Some functionality from OneWord copied to StringAnalysis and fixed
This commit is contained in:
@@ -43,6 +43,10 @@ public class CharacterAnalysisTab {
|
||||
private CheckComboBox<String> taxonomyCCB;
|
||||
private ArrayList<String> taxonomy;
|
||||
|
||||
@FXML
|
||||
private CheckBox displayTaxonomyChB;
|
||||
private boolean displayTaxonomy;
|
||||
|
||||
@FXML
|
||||
private CheckBox calculatecvvCB;
|
||||
private boolean calculateCvv;
|
||||
@@ -171,6 +175,14 @@ public class CharacterAnalysisTab {
|
||||
taxonomyCCB.setDisable(true);
|
||||
}
|
||||
|
||||
displayTaxonomy = false;
|
||||
// set
|
||||
displayTaxonomyChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
displayTaxonomy = newValue;
|
||||
logger.info("display taxonomy: ", displayTaxonomy);
|
||||
});
|
||||
displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB));
|
||||
|
||||
// cvv
|
||||
calculatecvvCB.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
calculateCvv = newValue;
|
||||
@@ -390,6 +402,7 @@ public class CharacterAnalysisTab {
|
||||
filter.setCalculateFor(calculateFor);
|
||||
filter.setMsd(msd);
|
||||
filter.setTaxonomy(Tax.getTaxonomyCodes(taxonomy, corpus.getCorpusType()));
|
||||
filter.setDisplayTaxonomy(displayTaxonomy);
|
||||
filter.setAl(AnalysisLevel.STRING_LEVEL);
|
||||
filter.setSkipValue(0);
|
||||
filter.setIsCvv(calculateCvv);
|
||||
|
||||
@@ -46,9 +46,9 @@ public class CorpusTab {
|
||||
private CheckBox readHeaderInfoChB;
|
||||
private boolean readHeaderInfo;
|
||||
|
||||
@FXML
|
||||
private CheckBox gosUseOrthChB;
|
||||
private boolean gosUseOrth;
|
||||
// @FXML
|
||||
// private CheckBox gosUseOrthChB;
|
||||
// private boolean gosUseOrth;
|
||||
|
||||
@FXML
|
||||
private Button chooseResultsLocationB;
|
||||
@@ -102,21 +102,21 @@ public class CorpusTab {
|
||||
});
|
||||
readHeaderInfoChB.setTooltip(new Tooltip(TOOLTIP_readHeaderInfoChB));
|
||||
|
||||
gosUseOrthChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
gosUseOrth = newValue;
|
||||
corpus.setGosOrthMode(gosUseOrth);
|
||||
// wordFormationTab.setDisable(gosUseOrth);
|
||||
satNew2Controller.toggleMode(null);
|
||||
oneWordTabController.toggleMode(null);
|
||||
catController.toggleMode(null);
|
||||
|
||||
logger.info("gosUseOrth: ", gosUseOrth);
|
||||
});
|
||||
// gosUseOrthChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
// gosUseOrth = newValue;
|
||||
// corpus.setGosOrthMode(gosUseOrth);
|
||||
//// wordFormationTab.setDisable(gosUseOrth);
|
||||
// satNew2Controller.toggleMode(null);
|
||||
// oneWordTabController.toggleMode(null);
|
||||
// catController.toggleMode(null);
|
||||
//
|
||||
// logger.info("gosUseOrth: ", gosUseOrth);
|
||||
// });
|
||||
|
||||
chooseResultsLocationB.setOnAction(e -> chooseResultsLocation(null));
|
||||
|
||||
// set labels and toggle visibility
|
||||
toggleGosChBVisibility();
|
||||
// toggleGosChBVisibility();
|
||||
|
||||
chooseCorpusLabelContent = Messages.LABEL_CORPUS_LOCATION_NOT_SET;
|
||||
chooseCorpusL.setText(chooseCorpusLabelContent);
|
||||
@@ -227,7 +227,7 @@ public class CorpusTab {
|
||||
private void setResults() {
|
||||
// if everything is ok
|
||||
// check and enable checkbox if GOS
|
||||
toggleGosChBVisibility();
|
||||
// toggleGosChBVisibility();
|
||||
|
||||
// set default results location
|
||||
String defaultResultsLocationPath = corpus.getChosenCorpusLocation().getAbsolutePath();
|
||||
@@ -420,9 +420,9 @@ public class CorpusTab {
|
||||
/**
|
||||
* Hides GOS related checkbox until needed.
|
||||
*/
|
||||
private void toggleGosChBVisibility() {
|
||||
gosUseOrthChB.setVisible(corpus != null && corpus.getCorpusType() != null && corpus.getCorpusType() == CorpusType.GOS);
|
||||
}
|
||||
// private void toggleGosChBVisibility() {
|
||||
// gosUseOrthChB.setVisible(corpus != null && corpus.getCorpusType() != null && corpus.getCorpusType() == CorpusType.GOS);
|
||||
// }
|
||||
|
||||
private String detectCorpusType(Collection<File> corpusFiles, String corpusLocation) {
|
||||
// check that we recognize this corpus
|
||||
|
||||
@@ -55,6 +55,7 @@ public class Messages {
|
||||
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.";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,10 @@ public class OneWordAnalysisTab {
|
||||
private CheckComboBox<String> taxonomyCCB;
|
||||
private ArrayList<String> taxonomy;
|
||||
|
||||
@FXML
|
||||
private CheckBox displayTaxonomyChB;
|
||||
private boolean displayTaxonomy;
|
||||
|
||||
@FXML
|
||||
private ComboBox<String> calculateForCB;
|
||||
private CalculateFor calculateFor;
|
||||
@@ -91,7 +95,7 @@ public class OneWordAnalysisTab {
|
||||
private static final ObservableList<String> alsoVisualizeItemsLemma = FXCollections.observableArrayList("besedna vrsta", "oblikoskladenjska oznaka");
|
||||
private static final ObservableList<String> alsoVisualizeItemsWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
|
||||
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", "različnica");
|
||||
private static final ObservableList<String> alsoVisualizeItemsNormalizedWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
|
||||
private static final ObservableList<String> alsoVisualizeItemsEmpty = FXCollections.observableArrayList();
|
||||
|
||||
// TODO: pass observables for taxonomy based on header scan
|
||||
@@ -192,6 +196,14 @@ public class OneWordAnalysisTab {
|
||||
taxonomyCCB.setDisable(true);
|
||||
}
|
||||
|
||||
displayTaxonomy = false;
|
||||
// set
|
||||
displayTaxonomyChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
displayTaxonomy = newValue;
|
||||
logger.info("display taxonomy: ", displayTaxonomy);
|
||||
});
|
||||
displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB));
|
||||
|
||||
// set default values
|
||||
minimalOccurrencesTF.setText("1");
|
||||
minimalOccurrences = 1;
|
||||
@@ -369,6 +381,7 @@ public class OneWordAnalysisTab {
|
||||
filter.setCalculateFor(calculateFor);
|
||||
filter.setMsd(msd);
|
||||
filter.setTaxonomy(Tax.getTaxonomyCodes(taxonomy, corpus.getCorpusType()));
|
||||
filter.setDisplayTaxonomy(displayTaxonomy);
|
||||
filter.setAl(AnalysisLevel.STRING_LEVEL);
|
||||
filter.setSkipValue(0);
|
||||
filter.setIsCvv(false);
|
||||
|
||||
@@ -38,6 +38,10 @@ public class StringAnalysisTabNew2 {
|
||||
private ArrayList<Pattern> msd;
|
||||
private ArrayList<String> msdStrings;
|
||||
|
||||
@FXML
|
||||
private CheckComboBox<String> alsoVisualizeCCB;
|
||||
private ArrayList<String> alsoVisualize;
|
||||
|
||||
@FXML
|
||||
private CheckComboBox<String> taxonomyCCB;
|
||||
private ArrayList<String> taxonomy;
|
||||
@@ -66,6 +70,10 @@ public class StringAnalysisTabNew2 {
|
||||
private CheckBox notePunctuationsChB;
|
||||
private boolean notePunctuations;
|
||||
|
||||
@FXML
|
||||
private CheckBox displayTaxonomyChB;
|
||||
private boolean displayTaxonomy;
|
||||
|
||||
@FXML
|
||||
private TextField minimalOccurrencesTF;
|
||||
private Integer minimalOccurrences;
|
||||
@@ -111,6 +119,12 @@ public class StringAnalysisTabNew2 {
|
||||
// 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> 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> alsoVisualizeItemsLemma = FXCollections.observableArrayList("besedna vrsta", "oblikoskladenjska oznaka");
|
||||
private static final ObservableList<String> alsoVisualizeItemsWord = FXCollections.observableArrayList("lema", "besedna vrsta", "oblikoskladenjska oznaka");
|
||||
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> alsoVisualizeItemsEmpty = FXCollections.observableArrayList();
|
||||
|
||||
|
||||
// TODO: pass observables for taxonomy based on header scan
|
||||
@@ -163,9 +177,39 @@ public class StringAnalysisTabNew2 {
|
||||
});
|
||||
notePunctuationsChB.setTooltip(new Tooltip(TOOLTIP_readNotePunctuationsChB));
|
||||
|
||||
displayTaxonomy = false;
|
||||
// set
|
||||
displayTaxonomyChB.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
displayTaxonomy = newValue;
|
||||
logger.info("display taxonomy: ", displayTaxonomy);
|
||||
});
|
||||
displayTaxonomyChB.setTooltip(new Tooltip(TOOLTIP_readDisplayTaxonomyChB));
|
||||
|
||||
// calculateForCB
|
||||
calculateForCB.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
calculateFor = CalculateFor.factory(newValue);
|
||||
|
||||
alsoVisualizeCCB.getItems().removeAll();
|
||||
if(newValue.equals("lema")){
|
||||
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsLemma);
|
||||
} else if(newValue.equals("različnica")) {
|
||||
if (corpus.getCorpusType() == CorpusType.GOS)
|
||||
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsWordGos);
|
||||
else
|
||||
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsWord);
|
||||
} else if(newValue.equals("normalizirana različnica")) {
|
||||
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsNormalizedWord);
|
||||
}else {
|
||||
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsEmpty);
|
||||
}
|
||||
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());
|
||||
});
|
||||
|
||||
@@ -205,6 +249,16 @@ public class StringAnalysisTabNew2 {
|
||||
msdTF.setText("");
|
||||
msd = new ArrayList<>();
|
||||
|
||||
alsoVisualizeCCB.getItems().removeAll();
|
||||
alsoVisualizeCCB.getItems().setAll(alsoVisualizeItemsLemma);
|
||||
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();
|
||||
|
||||
// taxonomy
|
||||
if (Tax.getCorpusTypesWithTaxonomy().contains(corpus.getCorpusType())) {
|
||||
taxonomyCCB.getItems().removeAll();
|
||||
@@ -424,7 +478,11 @@ public class StringAnalysisTabNew2 {
|
||||
// if (corpus.getCorpusType() == CorpusType.GOS)
|
||||
// calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_GOS);
|
||||
// else
|
||||
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS);
|
||||
if (corpus.getCorpusType() == CorpusType.GOS)
|
||||
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS_GOS);
|
||||
else
|
||||
calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS);
|
||||
// calculateForCB.getItems().setAll(N_GRAM_COMPUTE_FOR_WORDS);
|
||||
|
||||
} else if (mode == MODE.LETTER) {
|
||||
paneWords.setVisible(false);
|
||||
@@ -462,11 +520,13 @@ public class StringAnalysisTabNew2 {
|
||||
filter.setCalculateFor(calculateFor);
|
||||
filter.setMsd(msd);
|
||||
filter.setTaxonomy(Tax.getTaxonomyCodes(taxonomy, corpus.getCorpusType()));
|
||||
filter.setDisplayTaxonomy(displayTaxonomy);
|
||||
filter.setAl(AnalysisLevel.STRING_LEVEL);
|
||||
filter.setSkipValue(skipValue);
|
||||
filter.setIsCvv(calculateCvv);
|
||||
filter.setSolarFilters(solarFiltersMap);
|
||||
filter.setNotePunctuations(notePunctuations);
|
||||
filter.setMultipleKeys(alsoVisualize);
|
||||
filter.setMinimalOccurrences(minimalOccurrences);
|
||||
filter.setMinimalTaxonomy(minimalTaxonomy);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user