Project copied
This commit is contained in:
12
src/main/java/data/Enums/InflectedJosTypes.java
Normal file
12
src/main/java/data/Enums/InflectedJosTypes.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package data.Enums;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class InflectedJosTypes {
|
||||
public static final HashSet<Character> inflectedJosTypes = new HashSet<>();
|
||||
|
||||
static {
|
||||
inflectedJosTypes.addAll(Arrays.asList('S', 'G', 'P'));
|
||||
}
|
||||
}
|
||||
68
src/main/java/data/Enums/Msd.java
Normal file
68
src/main/java/data/Enums/Msd.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package data.Enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public enum Msd {
|
||||
NOUN("samostalnik", 'S', "Noun", 'N', 5),
|
||||
VERB("glagol", 'G', "Verb", 'V', 7),
|
||||
ADJECTIVE("pridevnik", 'P', "Adjective", 'A', 6),
|
||||
ADVERB("prislov", 'R', "Adverb", 'R', 2),
|
||||
PRONOUN("zaimek", 'Z', "Pronoun", 'P', 8),
|
||||
NUMERAL("števnik", 'K', "Numeral", 'M', 6),
|
||||
PREPOSITION("predlog", 'D', "Preposition", 'S', 1),
|
||||
CONJUNCTION("veznik", 'V', "Conjunction", 'C', 1),
|
||||
PARTICLE("členek", 'L', "Particle", 'Q', 0),
|
||||
INTERJECTION("medmet", 'M', "Interjection", 'I', 0),
|
||||
ABBREVIATION("okrajšava", 'O', "Abbreviation", 'Y', 0),
|
||||
RESIDUAL("neuvrščeno", 'N', "Residual", 'X', 1);
|
||||
|
||||
private final String siName;
|
||||
private final Character siCode;
|
||||
private final String enName;
|
||||
private final Character enCode;
|
||||
private final Integer nOfAttributes;
|
||||
|
||||
private static HashMap<Character, Integer> siCodeNOfAttributes;
|
||||
|
||||
static {
|
||||
siCodeNOfAttributes = new HashMap<>();
|
||||
for (Msd msd : Msd.values()) {
|
||||
siCodeNOfAttributes.put(msd.getSiCode(), msd.nOfAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
Msd(String siName, Character siCode, String enName, Character enCode, int nOfAttributes) {
|
||||
this.siName = siName;
|
||||
this.siCode = siCode;
|
||||
this.enName = enName;
|
||||
this.enCode = enCode;
|
||||
this.nOfAttributes = nOfAttributes;
|
||||
}
|
||||
|
||||
public String getSiName() {
|
||||
return siName;
|
||||
}
|
||||
|
||||
public Character getSiCode() {
|
||||
return siCode;
|
||||
}
|
||||
|
||||
public String getEnName() {
|
||||
return enName;
|
||||
}
|
||||
|
||||
public Character getEnCode() {
|
||||
return enCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of attributes for the given type.
|
||||
*
|
||||
* @param msd
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static int getMsdLengthForType(String msd) {
|
||||
return siCodeNOfAttributes.get(msd.charAt(0)) + 1;
|
||||
}
|
||||
}
|
||||
55
src/main/java/data/Enums/WordLevelDefaultValues.java
Normal file
55
src/main/java/data/Enums/WordLevelDefaultValues.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package data.Enums;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class WordLevelDefaultValues {
|
||||
public final static Logger logger = LogManager.getLogger(WordLevelDefaultValues.class);
|
||||
|
||||
private static HashSet<String> suffixes;
|
||||
private static final String SUFFIXES_FILE = "/Lists/suffixes.txt";
|
||||
public static final int MIN_N_OF_CHARACTERS_LEFT_SUFFIX = 2;
|
||||
|
||||
private static HashSet<String> prefixes;
|
||||
private static final String PREFIXES_FILE = "/Lists/prefixes.txt";
|
||||
public static final int MIN_N_OF_CHARACTERS_LEFT_PREFIX = 2;
|
||||
|
||||
static {
|
||||
suffixes = new HashSet<>();
|
||||
suffixes = readFromFile(SUFFIXES_FILE);
|
||||
prefixes = new HashSet<>();
|
||||
prefixes = readFromFile(PREFIXES_FILE);
|
||||
}
|
||||
|
||||
private static HashSet<String> readFromFile(String fileName) {
|
||||
Set<String> dictionary = new HashSet<>();
|
||||
|
||||
try (InputStream is = WordLevelDefaultValues.class.getClass().getResourceAsStream(fileName)) {
|
||||
if (is != null) {
|
||||
// TODO: warn if !exists
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
dictionary = reader.lines().collect(Collectors.toSet());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("Problem reading init dictionary", e);
|
||||
}
|
||||
|
||||
return (HashSet<String>) dictionary;
|
||||
}
|
||||
|
||||
public static HashSet<String> getSuffixes() {
|
||||
return suffixes;
|
||||
}
|
||||
|
||||
public static HashSet<String> getPrefixes() {
|
||||
return prefixes;
|
||||
}
|
||||
}
|
||||
16
src/main/java/data/Enums/WordLevelType.java
Normal file
16
src/main/java/data/Enums/WordLevelType.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package data.Enums;
|
||||
|
||||
public enum WordLevelType {
|
||||
SUFFIX("pripona"),
|
||||
PREFIX("predpona");
|
||||
|
||||
private final String name;
|
||||
|
||||
WordLevelType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
57
src/main/java/data/Enums/solar/SolarFilters.java
Normal file
57
src/main/java/data/Enums/solar/SolarFilters.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package data.Enums.solar;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
public class SolarFilters {
|
||||
private static HashMap<String, ObservableList<String>> SOLAR_FILTERS;
|
||||
public static final String SOLA = "sola";
|
||||
public static final String PREDMET = "predmet";
|
||||
public static final String RAZRED = "razred";
|
||||
public static final String REGIJA = "regija";
|
||||
public static final String TIP = "tip";
|
||||
public static final String LETO = "leto";
|
||||
|
||||
static {
|
||||
SOLAR_FILTERS = new HashMap<>();
|
||||
|
||||
SOLAR_FILTERS.put(REGIJA, FXCollections.observableArrayList("Celje", "Gorica", "Koper", "Kranj", "Krško", "Ljubljana", "Maribor", "Murska Sobota", "Novo mesto", "Postojna", "Slovenj Gradec"));
|
||||
SOLAR_FILTERS.put(PREDMET, FXCollections.observableArrayList("državljanska vzgoja in etika", "ekonomija", "filozofija", "geografija", "kemija", "podjetništvo", "psihologija", "slovenščina", "sociologija", "umetnostna vzgoja", "zgodovina"));
|
||||
SOLAR_FILTERS.put(RAZRED, FXCollections.observableArrayList("6. razred", "7. razred", "8. razred", "9. razred", "1. letnik", "2. letnik", "3. letnik", "4. letnik", "5. letnik", "maturitetni tečaj"));
|
||||
SOLAR_FILTERS.put(LETO, FXCollections.observableArrayList("2007", "2008", "2009", "2009/2010", "2010"));
|
||||
SOLAR_FILTERS.put(SOLA, FXCollections.observableArrayList("gimnazija", "osnovna šola", "poklicna šola", "strokovna šola"));
|
||||
SOLAR_FILTERS.put(TIP, FXCollections.observableArrayList("esej/spis", "pisni izdelek (učna ura)", "test (daljše besedilo)", "test (odgovori na vprašanja)"));
|
||||
}
|
||||
|
||||
public static final ObservableList<String> N_GRAM_COMPUTE_FOR_FULL = FXCollections.observableArrayList("različnica", "lema", "oblikoskladenjska oznaka", "oblikoskladenjska lastnost", "besedna vrsta");
|
||||
public static final ObservableList<String> N_GRAM_COMPUTE_FOR_LIMITED = FXCollections.observableArrayList("različnica", "lema");
|
||||
|
||||
/**
|
||||
* Returns filters with all possible values
|
||||
*/
|
||||
public static HashMap<String, ObservableList<String>> getFiltersForComboBoxes() {
|
||||
return SOLAR_FILTERS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns filters with all possible values
|
||||
*/
|
||||
public static HashMap<String, ObservableList<String>> getFiltersForComboBoxes(HashMap<String, HashSet<String>> foundFilters) {
|
||||
HashMap<String, ObservableList<String>> filtersForComboBoxes = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, ObservableList<String>> e : SOLAR_FILTERS.entrySet()) {
|
||||
if (!foundFilters.containsKey(e.getKey())) {
|
||||
// if, by some reason a specific filter wasn't in the corpus, return a blank list for that filter
|
||||
filtersForComboBoxes.put(e.getKey(), FXCollections.observableArrayList());
|
||||
} else {
|
||||
filtersForComboBoxes.put(e.getKey(), FXCollections.observableArrayList(foundFilters.get(e.getKey())).sorted());
|
||||
}
|
||||
}
|
||||
|
||||
return filtersForComboBoxes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user