Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
berndmoos committed May 27, 2024
1 parent 00a2843 commit d544a9b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
26 changes: 14 additions & 12 deletions src/org/exmaralda/exakt/exmaraldaSearch/AbstractCOMACorpus.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
*/
package org.exmaralda.exakt.exmaraldaSearch;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.exmaralda.exakt.search.AbstractXMLFileListCorpus;
import org.exmaralda.partitureditor.jexmaralda.StringUtilities;
Expand Down Expand Up @@ -34,13 +36,13 @@ public abstract class AbstractCOMACorpus extends AbstractXMLFileListCorpus imple
String XPATH_TO_SEARCHABLE_SEGMENT = "//segmentation[@name='SpeakerContribution_Event']/ts";
static String XPATH_TO_SEGMENT_NAMES = "//*[self::ts or self::ats or self::nts]/@n";

Hashtable<String,Element> speakerMappings = new Hashtable<String,Element>();
Hashtable<String,Element> communicationMappings = new Hashtable<String,Element>();
Hashtable<String,Element> transcriptionMappings = new Hashtable<String,Element>();
Map<String,Element> speakerMappings = new HashMap<>();
Map<String,Element> communicationMappings = new HashMap<>();
Map<String,Element> transcriptionMappings = new HashMap<>();

Hashtable<String,XPath> speakerAttributes = new Hashtable<String,XPath>();
Hashtable<String,XPath> communicationAttributes = new Hashtable<String,XPath>();
Hashtable<String,XPath> transcriptionAttributes = new Hashtable<String,XPath>();
Map<String,XPath> speakerAttributes = new HashMap<>();
Map<String,XPath> communicationAttributes = new HashMap<>();
Map<String,XPath> transcriptionAttributes = new HashMap<>();

static String[][] FIXED_SPEAKER_ATTRIBUTES = {
{"Sigle*","Sigle/text()"},
Expand All @@ -60,12 +62,12 @@ public abstract class AbstractCOMACorpus extends AbstractXMLFileListCorpus imple
{"Filename*","Filename/text()"}
};

HashSet<String> segmentationNames = new HashSet<String>();
HashSet<String> annotationNames = new HashSet<String>();
HashSet<String> descriptionNames = new HashSet<String>();
HashSet<String> segmentNames = new HashSet<String>();
HashSet<String> segmentationNames = new HashSet<>();
HashSet<String> annotationNames = new HashSet<>();
HashSet<String> descriptionNames = new HashSet<>();
HashSet<String> segmentNames = new HashSet<>();

void fetchAttributes(String xpathToStartElement, Hashtable<String, XPath> index, String[][] fixedAttributes) {
void fetchAttributes(String xpathToStartElement, Map<String, XPath> index, String[][] fixedAttributes) {
String searchString = xpathToStartElement + "/Description/Key/@Name";
try {
XPath xp = XPath.newInstance(searchString);
Expand Down Expand Up @@ -124,7 +126,7 @@ void fetchSpeakerLanguageAttributes() {
String keyPath = locationPath + "/Description/Key/@Name";
//System.out.println("KeyPath: " + keyPath);
XPath xp = XPath.newInstance("//Speaker/" + keyPath);
HashSet<String> allDescriptionNames = new HashSet<String>();
HashSet<String> allDescriptionNames = new HashSet<>();
for (Object o : xp.selectNodes(comaDocument)){
Attribute a = (Attribute) o;
allDescriptionNames.add(a.getValue());
Expand Down
2 changes: 2 additions & 0 deletions src/org/exmaralda/exakt/exmaraldaSearch/COMACorpus.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ public void readCorpus(File file, boolean index) throws JDOMException, IOExcepti
fetchAttributes("//Transcription", transcriptionAttributes, FIXED_TRANSCRIPTION_ATTRIBUTES);
}

@Override
public String getXPathToSearchableSegment() {
return XPATH_TO_SEARCHABLE_SEGMENT;
}

@Override
public void setXPathToSearchableSegment(String xp){
XPATH_TO_SEARCHABLE_SEGMENT = xp;
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/exmaralda/exakt/exmaraldaSearch/swing/EXAKT.java
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ public ImageIcon getWelcomeScreen() {
public void resetSettings(){
try {
java.util.prefs.Preferences.userRoot().node(getPreferencesNode()).clear();
JOptionPane.showMessageDialog(rootPane, "Preferences reset.\nRestart the editor.");
JOptionPane.showMessageDialog(rootPane, "<html>Preferences reset.<br/><b>Restart the editor.</b></html>");
} catch (BackingStoreException ex) {
Logger.getLogger(EXAKT.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(rootPane, "Problem resetting preferences:\n" + ex.getLocalizedMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

private void columnSelectionComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_columnSelectionComboBoxActionPerformed
int index = columnSelectionComboBox.getSelectedIndex();
HashSet<String> types = new HashSet<String>();
HashSet<String> types = new HashSet<>();
if (index==1) types = tableModel.getData().getTypes();
else if (index==3) types = tableModel.getTypes(1);
else if (index==4) types = tableModel.getTypes(2);
Expand Down
5 changes: 3 additions & 2 deletions src/org/exmaralda/exakt/search/swing/InputHelperPanel.form
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@
<Component class="javax.swing.JComboBox" name="alphabetComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="9">
<StringArray count="10">
<StringItem index="0" value="Default"/>
<StringItem index="1" value="German"/>
<StringItem index="2" value="Turkish"/>
Expand All @@ -772,7 +772,8 @@
<StringItem index="5" value="Italian"/>
<StringItem index="6" value="Spanish"/>
<StringItem index="7" value="French"/>
<StringItem index="8" value="Any character"/>
<StringItem index="8" value="Slovene"/>
<StringItem index="9" value="Any character"/>
</StringArray>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
Expand Down
11 changes: 7 additions & 4 deletions src/org/exmaralda/exakt/search/swing/InputHelperPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public class InputHelperPanel extends javax.swing.JPanel implements UnicodeKeybo
"[A-Za-zÀÈÉÌÍÎÓÒÚÙàèéìíîóòúù]", // 5 : ITALIAN
"[A-Za-zÑñ]", // 6 : SPANISH
"[A-Za-zÀÂÇÉÈÊËÎÏÔŒÙÛàâçéèêëïîôœûù]", // 7 : FRENCH
"[\\p{L}]" // 8 : ANY KIND OF ALPHABET
"[A-Za-zČŠŽčšž]", // 8 : SLOVENE
"[\\p{L}]" // 9 : ANY KIND OF ALPHABET

};

Expand All @@ -38,7 +39,8 @@ public class InputHelperPanel extends javax.swing.JPanel implements UnicodeKeybo
"[A-ZÀÈÉÌÍÎÓÒÚÙ]", // 5 : ITALIAN
"[A-ZÑ]", // 6 : SPANISH
"[A-ZÀÂÇÉÈÊËÎÏÔŒÙÛ]", // 7 : FRENCH
"[\\p{Lu}]" // 8 : ANY KIND OF ALPHABET
"[A-ZČŠŽ]", // 8 : SLOVENE
"[\\p{Lu}]" // 9 : ANY KIND OF ALPHABET
};

private static final String[] LOWER_CASE_CHARACTER = {
Expand All @@ -50,7 +52,8 @@ public class InputHelperPanel extends javax.swing.JPanel implements UnicodeKeybo
"[a-zàèéìíîóòúù]", // 5 : ITALIAN
"[a-záéíñóúü]", // 6 : SPANISH
"[a-zàâçéèêëïîôœûù]", // 7 : FRENCH
"[\\p{Ll}]" // 8 : ANY KIND OF ALPHABET
"[a-zčšž]", // 8 : SLOVENE
"[\\p{Ll}]" // 9 : ANY KIND OF ALPHABET
};

Comparator<String> caseIgnoringComparator = new java.util.Comparator<String>() {
Expand Down Expand Up @@ -600,7 +603,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jLabel5.setText("Alphabet: ");
alphabetPanel.add(jLabel5);

alphabetComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default", "German", "Turkish", "Scandinavian", "Portuguese", "Italian", "Spanish", "French", "Any character" }));
alphabetComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default", "German", "Turkish", "Scandinavian", "Portuguese", "Italian", "Spanish", "French", "Slovene", "Any character" }));
alphabetComboBox.setMaximumSize(new java.awt.Dimension(55, 22));
alphabetPanel.add(alphabetComboBox);

Expand Down

0 comments on commit d544a9b

Please sign in to comment.