Skip to content
Snippets Groups Projects
Commit 14aa8d8d authored by Lange, Dr. Herbert's avatar Lange, Dr. Herbert
Browse files

fix problem with dom in exmaraldatierfinder

parent 30a80847
No related branches found
No related tags found
1 merge request!4Feature/new checkers
......@@ -40,19 +40,22 @@ public class EXMARaLDATierFinder extends TierFinder {
@Override
void findTiers(CorpusData cd, String pattern) throws JDOMException {
Document dom = ((EXMARaLDATranscriptionData) cd).getJdom();
// Get all id attributes for tiers matching the pattern, get the values and add them to a new list
List<String> tierIds = new ArrayList<>();
if (cd instanceof EXMARaLDATranscriptionData)
if (cd instanceof EXMARaLDATranscriptionData) {
Document dom = ((EXMARaLDATranscriptionData) cd).getJdom();
tierIds.addAll(((List<Attribute>) Collections.checkedList(XPath.newInstance(
String.format("//tier[contains(@%s,\"%s\")]/@id",
attribute, pattern)).selectNodes(dom), Attribute.class))
.stream().map(Attribute::getValue).collect(Collectors.toList()));
else if (cd instanceof EXMARaLDASegmentedTranscriptionData)
}
else if (cd instanceof EXMARaLDASegmentedTranscriptionData) {
Document dom = ((EXMARaLDASegmentedTranscriptionData) cd).getJdom();
tierIds.addAll(((List<Attribute>) Collections.checkedList(XPath.newInstance(
String.format("//segmented-tier[contains(@%s,\"%s\")]/@id",
attribute, pattern)).selectNodes(dom), Attribute.class))
.stream().map(Attribute::getValue).collect(Collectors.toList()));
}
// Add found tiers to frequency list
tiers.putAll(tierIds);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment