From a1ada44c406aa0ba0e3435fcf0cd641f90d24978 Mon Sep 17 00:00:00 2001 From: Thomas Krause Date: Mon, 3 Dec 2018 20:47:59 +0100 Subject: [PATCH] Allow to not map speaker metadata --- .../exmaralda/EXMARaLDA2SaltMapper.java | 10 ++++++---- .../exmaralda/EXMARaLDAImporterProperties.java | 14 ++++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/corpus_tools/peppermodules/exmaralda/EXMARaLDA2SaltMapper.java b/src/main/java/org/corpus_tools/peppermodules/exmaralda/EXMARaLDA2SaltMapper.java index f148a99..2ede2a0 100644 --- a/src/main/java/org/corpus_tools/peppermodules/exmaralda/EXMARaLDA2SaltMapper.java +++ b/src/main/java/org/corpus_tools/peppermodules/exmaralda/EXMARaLDA2SaltMapper.java @@ -172,9 +172,11 @@ public DOCUMENT_STATUS mapSDocument() { this.mapMetaInformation2SDocument(basicTranscription, getDocument()); } // mapping the speakers object - for (Speaker speaker : basicTranscription.getSpeakertable()) { - // map all speaker objects - this.mapSpeaker2SMetaAnnotation(speaker, getDocument()); + if(getProps().isMapSpeakerMetadata()) { + for (Speaker speaker : basicTranscription.getSpeakertable()) { + // map all speaker objects + this.mapSpeaker2SMetaAnnotation(speaker, getDocument()); + } } // remember the original order of the tiers List tierDisplayNames = new LinkedList<>(); @@ -541,7 +543,7 @@ public void computeTierCollection() { private void mapTiers2SNodes(List slot) { for (Tier tier : slot) { - if(getProps().isIgnoreDescription() && tier.getType() == TIER_TYPE.D) { + if(tier.getType() == TIER_TYPE.D && !getProps().isMapDescriptions()) { continue; } diff --git a/src/main/java/org/corpus_tools/peppermodules/exmaralda/EXMARaLDAImporterProperties.java b/src/main/java/org/corpus_tools/peppermodules/exmaralda/EXMARaLDAImporterProperties.java index 6a14479..eaf4b5e 100644 --- a/src/main/java/org/corpus_tools/peppermodules/exmaralda/EXMARaLDAImporterProperties.java +++ b/src/main/java/org/corpus_tools/peppermodules/exmaralda/EXMARaLDAImporterProperties.java @@ -58,7 +58,8 @@ public class EXMARaLDAImporterProperties extends PepperModuleProperties { public static final String PROP_TRIM_EVENTS = "trimEvents"; public static final String PROP_PARSE_NAMESPACE = "parseNamespace"; public static final String PROP_MAP_TIMELINE = "mapTimeline"; - public static final String PROP_IGNORE_DESCRIPTION = "ignoreDescription"; + public static final String PROP_MAP_DESCRIPTIONS = "mapDescriptions"; + public static final String PROP_MAP_SPEAKER_METADATA = "mapSpeakerMetadata"; public EXMARaLDAImporterProperties() { @@ -75,7 +76,8 @@ public EXMARaLDAImporterProperties() { this.addProperty(new PepperModuleProperty(PROP_TRIM_EVENTS, Boolean.class, "When this property is true, all events in exmaralda are trimmed before they are mapped to Salt. That means for instance trailing blanks are removed. ", false, false)); this.addProperty(new PepperModuleProperty(PROP_PARSE_NAMESPACE, Boolean.class, "Parse the qualified annotation name including the namespace (e.g. myns::annoname) from the category name.", false, false)); this.addProperty(new PepperModuleProperty(PROP_MAP_TIMELINE, Boolean.class, "Import the EXMARaLDA timeline as Salt STimeline", true, false)); - this.addProperty(new PepperModuleProperty(PROP_IGNORE_DESCRIPTION, Boolean.class, "Ignore all tiers of the type \"Description\"", false, false)); + this.addProperty(PepperModuleProperty.create().withName(PROP_MAP_DESCRIPTIONS).withType(Boolean.class).withDescription("Map tiers of the type \\\"Description\\\"").withDefaultValue(true).build()); + this.addProperty(PepperModuleProperty.create().withName(PROP_MAP_SPEAKER_METADATA).withType(Boolean.class).withDescription("Import the metadata of the speaker").withDefaultValue(true).build()); } @Deprecated @@ -136,8 +138,12 @@ public Boolean isMapTimeline() { return ((Boolean) this.getProperty(PROP_MAP_TIMELINE).getValue()); } - public Boolean isIgnoreDescription() { - return ((Boolean) this.getProperty(PROP_IGNORE_DESCRIPTION).getValue()); + public Boolean isMapDescriptions() { + return ((Boolean) this.getProperty(PROP_MAP_DESCRIPTIONS).getValue()); + } + + public Boolean isMapSpeakerMetadata() { + return ((Boolean) this.getProperty(PROP_MAP_SPEAKER_METADATA).getValue()); }