Added implementation of taxonomy set operations (intersection and union)
This commit is contained in:
@@ -858,11 +858,15 @@ public class XML_processing {
|
||||
if (!ValidationUtil.isEmpty(stats.getFilter().getTaxonomy())) {
|
||||
currentFiletaxonomy.retainAll(stats.getFilter().getTaxonomy()); // intersection
|
||||
|
||||
if (currentFiletaxonomy.isEmpty()) {
|
||||
if (stats.getFilter().getTaxonomySetOperation().equals(I18N.get("taxonomySetOperation.UNION")) && currentFiletaxonomy.isEmpty()) {
|
||||
// taxonomies don't match so stop
|
||||
// union (select words that match any of selected taxonomy
|
||||
// return false;
|
||||
taxonomyMatch = false;
|
||||
// System.out.println("TEST");
|
||||
//
|
||||
} else if(stats.getFilter().getTaxonomySetOperation().equals(I18N.get("taxonomySetOperation.INTERSECTION")) && currentFiletaxonomy.size() != stats.getFilter().getTaxonomy().size()){
|
||||
// intersection (select only words that precisely match selected taxonomy
|
||||
taxonomyMatch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1114,11 +1118,15 @@ public class XML_processing {
|
||||
if (!ValidationUtil.isEmpty(stats.getFilter().getTaxonomy())) {
|
||||
currentFiletaxonomy.retainAll(stats.getFilter().getTaxonomy()); // intersection
|
||||
|
||||
if (currentFiletaxonomy.isEmpty()) {
|
||||
if (stats.getFilter().getTaxonomySetOperation().equals(I18N.get("taxonomySetOperation.UNION")) && currentFiletaxonomy.isEmpty()) {
|
||||
// taxonomies don't match so stop
|
||||
// union (select words that match any of selected taxonomy
|
||||
// return false;
|
||||
taxonomyMatch = false;
|
||||
// System.out.println("TEST");
|
||||
//
|
||||
} else if(stats.getFilter().getTaxonomySetOperation().equals(I18N.get("taxonomySetOperation.INTERSECTION")) && currentFiletaxonomy.size() != stats.getFilter().getTaxonomy().size()){
|
||||
// intersection (select only words that precisely match selected taxonomy
|
||||
taxonomyMatch = false;
|
||||
}
|
||||
}
|
||||
} else if (endElement.getName().getLocalPart().equals("text")){
|
||||
@@ -1400,13 +1408,29 @@ public class XML_processing {
|
||||
|
||||
} else if (endElement.getName().getLocalPart().equals("teiHeader")) {
|
||||
// before proceeding to read this file, make sure that taxonomy filters are a match
|
||||
// if (!ValidationUtil.isEmpty(stats.getFilter().getTaxonomy())) {
|
||||
// currentFiletaxonomy.retainAll(stats.getFilter().getTaxonomy()); // intersection
|
||||
//
|
||||
// // disregard this entry if taxonomies don't match
|
||||
// includeFile = !currentFiletaxonomy.isEmpty();
|
||||
//
|
||||
//// currentFiletaxonomy = new ArrayList<>();
|
||||
// }
|
||||
if (!ValidationUtil.isEmpty(stats.getFilter().getTaxonomy())) {
|
||||
currentFiletaxonomy.retainAll(stats.getFilter().getTaxonomy()); // intersection
|
||||
|
||||
// disregard this entry if taxonomies don't match
|
||||
includeFile = !currentFiletaxonomy.isEmpty();
|
||||
|
||||
// currentFiletaxonomy = new ArrayList<>();
|
||||
if (stats.getFilter().getTaxonomySetOperation().equals(I18N.get("taxonomySetOperation.UNION")) && currentFiletaxonomy.isEmpty()) {
|
||||
// taxonomies don't match so stop
|
||||
// union (select words that match any of selected taxonomy
|
||||
// return false;
|
||||
includeFile = false;
|
||||
//
|
||||
} else if(stats.getFilter().getTaxonomySetOperation().equals(I18N.get("taxonomySetOperation.INTERSECTION")) && currentFiletaxonomy.size() != stats.getFilter().getTaxonomy().size()){
|
||||
// intersection (select only words that precisely match selected taxonomy
|
||||
includeFile = false;
|
||||
} else {
|
||||
includeFile = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1580,8 +1604,14 @@ public class XML_processing {
|
||||
if (!ValidationUtil.isEmpty(stats.getFilter().getTaxonomy())) {
|
||||
currentFiletaxonomy.retainAll(stats.getFilter().getTaxonomy()); // intersection
|
||||
|
||||
if (currentFiletaxonomy.isEmpty()) {
|
||||
// taxonomies don't match so don't save
|
||||
if (stats.getFilter().getTaxonomySetOperation().equals(I18N.get("taxonomySetOperation.UNION")) && currentFiletaxonomy.isEmpty()) {
|
||||
// taxonomies don't match so stop
|
||||
// union (select words that match any of selected taxonomy
|
||||
// return false;
|
||||
taxonomyMatch = false;
|
||||
//
|
||||
} else if(stats.getFilter().getTaxonomySetOperation().equals(I18N.get("taxonomySetOperation.INTERSECTION")) && currentFiletaxonomy.size() != stats.getFilter().getTaxonomy().size()){
|
||||
// intersection (select only words that precisely match selected taxonomy
|
||||
taxonomyMatch = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class Filter implements Cloneable {
|
||||
NOTE_PUNCTUATIONS,
|
||||
MINIMAL_OCCURRENCES,
|
||||
MINIMAL_TAXONOMY,
|
||||
TAXONOMY_SET_OPERATION,
|
||||
COLLOCABILITY,
|
||||
PREFIX_LENGTH,
|
||||
SUFFIX_LENGTH,
|
||||
@@ -104,6 +105,14 @@ public class Filter implements Cloneable {
|
||||
return (Integer) filter.get(STRING_LENGTH);
|
||||
}
|
||||
|
||||
public void setTaxonomySetOperation(String taxonomySetOperation) {
|
||||
filter.put(TAXONOMY_SET_OPERATION, taxonomySetOperation);
|
||||
}
|
||||
|
||||
public String getTaxonomySetOperation() {
|
||||
return (String) filter.get(TAXONOMY_SET_OPERATION);
|
||||
}
|
||||
|
||||
public void setTaxonomy(ArrayList<Taxonomy> taxonomy) {
|
||||
filter.put(TAXONOMY, taxonomy);
|
||||
}
|
||||
|
||||
@@ -593,6 +593,12 @@ public class StatisticsNew {
|
||||
info.put(I18N.get("exportHeader.msd"), "");
|
||||
}
|
||||
|
||||
if (!isEmpty(filter.getTaxonomySetOperation())) {
|
||||
info.put(I18N.get("exportHeader.taxonomySetOperation"), filter.getTaxonomySetOperation());
|
||||
} else {
|
||||
info.put(I18N.get("exportHeader.taxonomySetOperation"), "");
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
@@ -66,6 +66,9 @@ public class CharacterAnalysisTab {
|
||||
@FXML
|
||||
public Label minimalTaxonomyL;
|
||||
|
||||
@FXML
|
||||
public Label taxonomySetOperationL;
|
||||
|
||||
@FXML
|
||||
public ImageView stringLengthI;
|
||||
|
||||
@@ -87,6 +90,9 @@ public class CharacterAnalysisTab {
|
||||
@FXML
|
||||
public ImageView minimalTaxonomyI;
|
||||
|
||||
@FXML
|
||||
public ImageView taxonomySetOperationI;
|
||||
|
||||
@FXML
|
||||
public Label solarFilters;
|
||||
|
||||
@@ -119,6 +125,10 @@ public class CharacterAnalysisTab {
|
||||
private TextField minimalTaxonomyTF;
|
||||
private Integer minimalTaxonomy;
|
||||
|
||||
@FXML
|
||||
private ComboBox<String> taxonomySetOperationCB;
|
||||
private String taxonomySetOperation;
|
||||
|
||||
// @FXML
|
||||
// private ToggleGroup calculateForRB;
|
||||
// private CalculateFor calculateFor;
|
||||
@@ -169,6 +179,9 @@ public class CharacterAnalysisTab {
|
||||
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 String [] TAXONOMY_SET_OPERATION_ARRAY = {"taxonomySetOperation.UNION", "taxonomySetOperation.INTERSECTION"};
|
||||
private static final ArrayList<String> TAXONOMY_SET_OPERATION = new ArrayList<>(Arrays.asList(TAXONOMY_SET_OPERATION_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_WORDS_ORTH = FXCollections.observableArrayList("različnica");
|
||||
|
||||
@@ -211,6 +224,18 @@ public class CharacterAnalysisTab {
|
||||
|
||||
calculateForCB.getSelectionModel().select(0);
|
||||
|
||||
taxonomySetOperationCB.setDisable(true);
|
||||
taxonomySetOperationCB.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if(newValue == null){
|
||||
newValue = I18N.getTranslatedValue(oldValue, TAXONOMY_SET_OPERATION);
|
||||
taxonomySetOperationCB.getSelectionModel().select(newValue);
|
||||
}
|
||||
taxonomySetOperation = newValue;
|
||||
logger.info("Taxonomy set operation:", taxonomySetOperation);
|
||||
});
|
||||
|
||||
taxonomySetOperationCB.getSelectionModel().select(0);
|
||||
|
||||
// msd
|
||||
msdTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
@@ -279,6 +304,12 @@ public class CharacterAnalysisTab {
|
||||
for (Taxonomy t : checkedItemsTaxonomy) {
|
||||
taxonomyCCB.getCheckModel().check(t.toLongNameString());
|
||||
}
|
||||
if (taxonomyCCB.getCheckModel().getCheckedItems().size() > 0) {
|
||||
taxonomySetOperationCB.setDisable(false);
|
||||
} else {
|
||||
taxonomySetOperationCB.getSelectionModel().select(0);
|
||||
taxonomySetOperationCB.setDisable(true);
|
||||
}
|
||||
changing = true;
|
||||
logger.info(String.format("Selected taxonomy: %s", StringUtils.join(checkedItems, ",")));
|
||||
}
|
||||
@@ -519,6 +550,7 @@ public class CharacterAnalysisTab {
|
||||
taxonomyL.textProperty().bind(I18N.createStringBinding("label.taxonomy"));
|
||||
minimalOccurrencesL.textProperty().bind(I18N.createStringBinding("label.minimalOccurrences"));
|
||||
minimalTaxonomyL.textProperty().bind(I18N.createStringBinding("label.minimalTaxonomy"));
|
||||
taxonomySetOperationL.textProperty().bind(I18N.createStringBinding("label.taxonomySetOperation"));
|
||||
|
||||
addTooltipToImage(stringLengthI, I18N.createStringBinding("label.letter.stringLengthH"));
|
||||
addTooltipToImage(calculateForI, I18N.createStringBinding("label.letter.calculateForH"));
|
||||
@@ -527,11 +559,13 @@ public class CharacterAnalysisTab {
|
||||
addTooltipToImage(taxonomyI, I18N.createStringBinding("label.letter.taxonomyH"));
|
||||
addTooltipToImage(minimalOccurrencesI, I18N.createStringBinding("label.letter.minimalOccurrencesH"));
|
||||
addTooltipToImage(minimalTaxonomyI, I18N.createStringBinding("label.letter.minimalTaxonomyH"));
|
||||
addTooltipToImage(taxonomySetOperationI, I18N.createStringBinding("label.letter.taxonomySetOperationH"));
|
||||
|
||||
solarFilters.textProperty().bind(I18N.createStringBinding("label.solarFilters"));
|
||||
|
||||
|
||||
calculateForCB.itemsProperty().bind(I18N.createObjectBinding(N_GRAM_COMPUTE_FOR_LETTERS));
|
||||
taxonomySetOperationCB.itemsProperty().bind(I18N.createObjectBinding(TAXONOMY_SET_OPERATION));
|
||||
|
||||
}
|
||||
|
||||
@@ -595,6 +629,7 @@ public class CharacterAnalysisTab {
|
||||
filter.setStringLength(stringLength);
|
||||
filter.setMinimalOccurrences(minimalOccurrences);
|
||||
filter.setMinimalTaxonomy(minimalTaxonomy);
|
||||
filter.setTaxonomySetOperation(taxonomySetOperation);
|
||||
|
||||
String message = Validation.validateForStringLevel(filter);
|
||||
if (message == null) {
|
||||
|
||||
@@ -71,6 +71,9 @@ public class OneWordAnalysisTab {
|
||||
@FXML
|
||||
public Label minimalTaxonomyL;
|
||||
|
||||
@FXML
|
||||
public Label taxonomySetOperationL;
|
||||
|
||||
@FXML
|
||||
public ImageView calculateForI;
|
||||
|
||||
@@ -95,6 +98,9 @@ public class OneWordAnalysisTab {
|
||||
@FXML
|
||||
public ImageView minimalTaxonomyI;
|
||||
|
||||
@FXML
|
||||
public ImageView taxonomySetOperationI;
|
||||
|
||||
@FXML
|
||||
private TextField msdTF;
|
||||
private ArrayList<Pattern> msd;
|
||||
@@ -128,6 +134,10 @@ public class OneWordAnalysisTab {
|
||||
private TextField minimalTaxonomyTF;
|
||||
private Integer minimalTaxonomy;
|
||||
|
||||
@FXML
|
||||
private ComboBox<String> taxonomySetOperationCB;
|
||||
private String taxonomySetOperation;
|
||||
|
||||
@FXML
|
||||
private Button computeNgramsB;
|
||||
|
||||
@@ -201,6 +211,9 @@ public class OneWordAnalysisTab {
|
||||
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));
|
||||
|
||||
private static final String [] TAXONOMY_SET_OPERATION_ARRAY = {"taxonomySetOperation.UNION", "taxonomySetOperation.INTERSECTION"};
|
||||
private static final ArrayList<String> TAXONOMY_SET_OPERATION = new ArrayList<>(Arrays.asList(TAXONOMY_SET_OPERATION_ARRAY));
|
||||
|
||||
// TODO: pass observables for taxonomy based on header scan
|
||||
// after header scan
|
||||
private ObservableList<String> taxonomyCCBValues;
|
||||
@@ -320,6 +333,18 @@ public class OneWordAnalysisTab {
|
||||
|
||||
calculateForCB.getSelectionModel().select(0);
|
||||
|
||||
taxonomySetOperationCB.setDisable(true);
|
||||
taxonomySetOperationCB.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if(newValue == null){
|
||||
newValue = I18N.getTranslatedValue(oldValue, TAXONOMY_SET_OPERATION);
|
||||
taxonomySetOperationCB.getSelectionModel().select(newValue);
|
||||
}
|
||||
taxonomySetOperation = newValue;
|
||||
logger.info("Taxonomy set operation:", taxonomySetOperation);
|
||||
});
|
||||
|
||||
taxonomySetOperationCB.getSelectionModel().select(0);
|
||||
|
||||
// msd
|
||||
msdTF.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue) {
|
||||
@@ -419,6 +444,12 @@ public class OneWordAnalysisTab {
|
||||
for (Taxonomy t : checkedItemsTaxonomy) {
|
||||
taxonomyCCB.getCheckModel().check(t.toLongNameString());
|
||||
}
|
||||
if (taxonomyCCB.getCheckModel().getCheckedItems().size() > 0) {
|
||||
taxonomySetOperationCB.setDisable(false);
|
||||
} else {
|
||||
taxonomySetOperationCB.getSelectionModel().select(0);
|
||||
taxonomySetOperationCB.setDisable(true);
|
||||
}
|
||||
changing = true;
|
||||
logger.info(String.format("Selected taxonomy: %s", StringUtils.join(checkedItems, ",")));
|
||||
}
|
||||
@@ -629,6 +660,7 @@ public class OneWordAnalysisTab {
|
||||
minimalOccurrencesL.textProperty().bind(I18N.createStringBinding("label.minimalOccurrences"));
|
||||
minimalTaxonomyL.textProperty().bind(I18N.createStringBinding("label.minimalTaxonomy"));
|
||||
solarFilters.textProperty().bind(I18N.createStringBinding("label.solarFilters"));
|
||||
taxonomySetOperationL.textProperty().bind(I18N.createStringBinding("label.taxonomySetOperation"));
|
||||
|
||||
addTooltipToImage(calculateForI, I18N.createStringBinding("label.word.calculateForH"));
|
||||
addTooltipToImage(alsoVisualizeI, I18N.createStringBinding("label.word.alsoVisualizeH"));
|
||||
@@ -639,6 +671,9 @@ public class OneWordAnalysisTab {
|
||||
addTooltipToImage(taxonomyI, I18N.createStringBinding("label.word.taxonomyH"));
|
||||
addTooltipToImage(minimalOccurrencesI, I18N.createStringBinding("label.word.minimalOccurrencesH"));
|
||||
addTooltipToImage(minimalTaxonomyI, I18N.createStringBinding("label.word.minimalTaxonomyH"));
|
||||
addTooltipToImage(taxonomySetOperationI, I18N.createStringBinding("label.letter.taxonomySetOperationH"));
|
||||
|
||||
taxonomySetOperationCB.itemsProperty().bind(I18N.createObjectBinding(TAXONOMY_SET_OPERATION));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -692,6 +727,7 @@ public class OneWordAnalysisTab {
|
||||
filter.setMinimalOccurrences(minimalOccurrences);
|
||||
filter.setMinimalTaxonomy(minimalTaxonomy);
|
||||
filter.setWriteMsdAtTheEnd(writeMsdAtTheEnd);
|
||||
filter.setTaxonomySetOperation(taxonomySetOperation);
|
||||
|
||||
String message = Validation.validateForStringLevel(filter);
|
||||
if (message == null) {
|
||||
|
||||
@@ -69,6 +69,9 @@ public class StringAnalysisTabNew2 {
|
||||
@FXML
|
||||
public Label minimalTaxonomyL;
|
||||
|
||||
@FXML
|
||||
public Label taxonomySetOperationL;
|
||||
|
||||
@FXML
|
||||
public Label skipValueL;
|
||||
|
||||
@@ -108,6 +111,9 @@ public class StringAnalysisTabNew2 {
|
||||
@FXML
|
||||
public ImageView minimalTaxonomyI;
|
||||
|
||||
@FXML
|
||||
public ImageView taxonomySetOperationI;
|
||||
|
||||
@FXML
|
||||
public ImageView skipValueI;
|
||||
|
||||
@@ -173,6 +179,10 @@ public class StringAnalysisTabNew2 {
|
||||
private TextField minimalTaxonomyTF;
|
||||
private Integer minimalTaxonomy;
|
||||
|
||||
@FXML
|
||||
private ComboBox<String> taxonomySetOperationCB;
|
||||
private String taxonomySetOperation;
|
||||
|
||||
@FXML
|
||||
private Pane paneWords;
|
||||
|
||||
@@ -250,6 +260,8 @@ public class StringAnalysisTabNew2 {
|
||||
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));
|
||||
|
||||
private static final String [] TAXONOMY_SET_OPERATION_ARRAY = {"taxonomySetOperation.UNION", "taxonomySetOperation.INTERSECTION"};
|
||||
private static final ArrayList<String> TAXONOMY_SET_OPERATION = new ArrayList<>(Arrays.asList(TAXONOMY_SET_OPERATION_ARRAY));
|
||||
|
||||
// TODO: pass observables for taxonomy based on header scan
|
||||
// after header scan
|
||||
@@ -431,6 +443,18 @@ public class StringAnalysisTabNew2 {
|
||||
|
||||
calculateForCB.getSelectionModel().select(0);
|
||||
|
||||
taxonomySetOperationCB.setDisable(true);
|
||||
taxonomySetOperationCB.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if(newValue == null){
|
||||
newValue = I18N.getTranslatedValue(oldValue, TAXONOMY_SET_OPERATION);
|
||||
taxonomySetOperationCB.getSelectionModel().select(newValue);
|
||||
}
|
||||
taxonomySetOperation = newValue;
|
||||
logger.info("Taxonomy set operation:", taxonomySetOperation);
|
||||
});
|
||||
|
||||
taxonomySetOperationCB.getSelectionModel().select(0);
|
||||
|
||||
// collocabilityCCB
|
||||
if (collocabilityListener != null){
|
||||
collocabilityCCB.getCheckModel().getCheckedItems().removeListener(collocabilityListener);
|
||||
@@ -565,6 +589,12 @@ public class StringAnalysisTabNew2 {
|
||||
for (Taxonomy t : checkedItemsTaxonomy) {
|
||||
taxonomyCCB.getCheckModel().check(t.toLongNameString());
|
||||
}
|
||||
if (taxonomyCCB.getCheckModel().getCheckedItems().size() > 0) {
|
||||
taxonomySetOperationCB.setDisable(false);
|
||||
} else {
|
||||
taxonomySetOperationCB.getSelectionModel().select(0);
|
||||
taxonomySetOperationCB.setDisable(true);
|
||||
}
|
||||
changing = true;
|
||||
logger.info(String.format("Selected taxonomy: %s", StringUtils.join(checkedItems, ",")));
|
||||
}
|
||||
@@ -806,6 +836,7 @@ public class StringAnalysisTabNew2 {
|
||||
taxonomyL.textProperty().bind(I18N.createStringBinding("label.taxonomy"));
|
||||
minimalOccurrencesL.textProperty().bind(I18N.createStringBinding("label.minimalOccurrences"));
|
||||
minimalTaxonomyL.textProperty().bind(I18N.createStringBinding("label.minimalTaxonomy"));
|
||||
taxonomySetOperationL.textProperty().bind(I18N.createStringBinding("label.taxonomySetOperation"));
|
||||
solarFilters.textProperty().bind(I18N.createStringBinding("label.solarFilters"));
|
||||
|
||||
addTooltipToImage(calculateForI, I18N.createStringBinding("label.wordSet.calculateForH"));
|
||||
@@ -820,6 +851,9 @@ public class StringAnalysisTabNew2 {
|
||||
addTooltipToImage(taxonomyI, I18N.createStringBinding("label.wordSet.taxonomyH"));
|
||||
addTooltipToImage(minimalOccurrencesI, I18N.createStringBinding("label.wordSet.minimalOccurrencesH"));
|
||||
addTooltipToImage(minimalTaxonomyI, I18N.createStringBinding("label.wordSet.minimalTaxonomyH"));
|
||||
addTooltipToImage(taxonomySetOperationI, I18N.createStringBinding("label.letter.taxonomySetOperationH"));
|
||||
|
||||
taxonomySetOperationCB.itemsProperty().bind(I18N.createObjectBinding(TAXONOMY_SET_OPERATION));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -879,6 +913,7 @@ public class StringAnalysisTabNew2 {
|
||||
filter.setMinimalOccurrences(minimalOccurrences);
|
||||
filter.setMinimalTaxonomy(minimalTaxonomy);
|
||||
filter.setCollocability(collocability);
|
||||
filter.setTaxonomySetOperation(taxonomySetOperation);
|
||||
|
||||
// if (ngramValue != null && ngramValue == 0) {
|
||||
// filter.setStringLength(stringLength);
|
||||
|
||||
@@ -85,6 +85,9 @@ public class WordLevelTab {
|
||||
@FXML
|
||||
public Label minimalTaxonomyL;
|
||||
|
||||
@FXML
|
||||
public Label taxonomySetOperationL;
|
||||
|
||||
|
||||
@FXML
|
||||
public ImageView calculateForI;
|
||||
@@ -119,6 +122,9 @@ public class WordLevelTab {
|
||||
@FXML
|
||||
public ImageView minimalTaxonomyI;
|
||||
|
||||
@FXML
|
||||
public ImageView taxonomySetOperationI;
|
||||
|
||||
@FXML
|
||||
private TextField msdTF;
|
||||
private ArrayList<Pattern> msd;
|
||||
@@ -168,6 +174,10 @@ public class WordLevelTab {
|
||||
private TextField minimalTaxonomyTF;
|
||||
private Integer minimalTaxonomy;
|
||||
|
||||
@FXML
|
||||
private ComboBox<String> taxonomySetOperationCB;
|
||||
private String taxonomySetOperation;
|
||||
|
||||
@FXML
|
||||
private Button computeNgramsB;
|
||||
|
||||
@@ -226,7 +236,11 @@ public class WordLevelTab {
|
||||
// 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 [] TAXONOMY_SET_OPERATION_ARRAY = {"taxonomySetOperation.UNION", "taxonomySetOperation.INTERSECTION"};
|
||||
private static final ArrayList<String> TAXONOMY_SET_OPERATION = new ArrayList<>(Arrays.asList(TAXONOMY_SET_OPERATION_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));
|
||||
|
||||
@@ -344,6 +358,19 @@ public class WordLevelTab {
|
||||
|
||||
calculateForCB.getSelectionModel().select(0);
|
||||
|
||||
taxonomySetOperationCB.setDisable(true);
|
||||
taxonomySetOperationCB.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if(newValue == null){
|
||||
newValue = I18N.getTranslatedValue(oldValue, TAXONOMY_SET_OPERATION);
|
||||
taxonomySetOperationCB.getSelectionModel().select(newValue);
|
||||
}
|
||||
taxonomySetOperation = newValue;
|
||||
logger.info("Taxonomy set operation:", taxonomySetOperation);
|
||||
});
|
||||
|
||||
taxonomySetOperationCB.getSelectionModel().select(0);
|
||||
|
||||
|
||||
prefixLengthCB.getSelectionModel().select(0);
|
||||
prefixLength = 0;
|
||||
|
||||
@@ -547,6 +574,12 @@ public class WordLevelTab {
|
||||
for (Taxonomy t : checkedItemsTaxonomy) {
|
||||
taxonomyCCB.getCheckModel().check(t.toLongNameString());
|
||||
}
|
||||
if (taxonomyCCB.getCheckModel().getCheckedItems().size() > 0) {
|
||||
taxonomySetOperationCB.setDisable(false);
|
||||
} else {
|
||||
taxonomySetOperationCB.getSelectionModel().select(0);
|
||||
taxonomySetOperationCB.setDisable(true);
|
||||
}
|
||||
changing = true;
|
||||
logger.info(String.format("Selected taxonomy: %s", StringUtils.join(checkedItems, ",")));
|
||||
}
|
||||
@@ -766,6 +799,7 @@ public class WordLevelTab {
|
||||
minimalOccurrencesL.textProperty().bind(I18N.createStringBinding("label.minimalOccurrences"));
|
||||
minimalTaxonomyL.textProperty().bind(I18N.createStringBinding("label.minimalTaxonomy"));
|
||||
solarFilters.textProperty().bind(I18N.createStringBinding("label.solarFilters"));
|
||||
taxonomySetOperationL.textProperty().bind(I18N.createStringBinding("label.taxonomySetOperation"));
|
||||
|
||||
addTooltipToImage(calculateForI, I18N.createStringBinding("label.wordPart.calculateForH"));
|
||||
addTooltipToImage(alsoVisualizeI, I18N.createStringBinding("label.wordPart.alsoVisualizeH"));
|
||||
@@ -780,6 +814,9 @@ public class WordLevelTab {
|
||||
addTooltipToImage(taxonomyI, I18N.createStringBinding("label.wordPart.taxonomyH"));
|
||||
addTooltipToImage(minimalOccurrencesI, I18N.createStringBinding("label.wordPart.minimalOccurrencesH"));
|
||||
addTooltipToImage(minimalTaxonomyI, I18N.createStringBinding("label.wordPart.minimalTaxonomyH"));
|
||||
addTooltipToImage(taxonomySetOperationI, I18N.createStringBinding("label.letter.taxonomySetOperationH"));
|
||||
|
||||
taxonomySetOperationCB.itemsProperty().bind(I18N.createObjectBinding(TAXONOMY_SET_OPERATION));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -840,6 +877,7 @@ public class WordLevelTab {
|
||||
filter.setSuffixLength(suffixLength);
|
||||
filter.setPrefixList(prefixList);
|
||||
filter.setSuffixList(suffixList);
|
||||
filter.setTaxonomySetOperation(taxonomySetOperation);
|
||||
// filter.setWriteMsdAtTheEnd(writeMsdAtTheEnd);
|
||||
|
||||
String message = Validation.validateForStringLevel(filter);
|
||||
|
||||
Reference in New Issue
Block a user