From 4bc60890602d8d77cf877d639f4d098af1cd70f2 Mon Sep 17 00:00:00 2001 From: Thomas Krause Date: Thu, 5 Sep 2024 18:33:00 +0200 Subject: [PATCH 1/2] Give correct name in xlsx importer to segmentation token. --- CHANGELOG.md | 6 ++++++ src/importer/xlsx.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 497b4354..96952364 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- `xlsx` importer did not give the correct node name to segmentation token. Due + to this inconsistency, span annotations on segmentation nodes where not + connected to the segmentation token. + ## [0.16.0] - 2024-09-02 ### Added diff --git a/src/importer/xlsx.rs b/src/importer/xlsx.rs index e7517764..0a53a67d 100644 --- a/src/importer/xlsx.rs +++ b/src/importer/xlsx.rs @@ -231,7 +231,7 @@ impl ImportSpreadsheet { let overlapped_base_tokens: &[String] = &base_tokens[base_token_start..base_token_end]; // TODO check indices - let node_name = if token_annos.contains(name) { + let node_name = if name == tok_name || token_annos.contains(name) { format!("{}#{}_{}-{}", &doc_path, tok_name, start_row, end_row_excl) } else { format!( From bff645d2ac27a92c5bb3cb17a333d4d289d7391f Mon Sep 17 00:00:00 2001 From: Thomas Krause Date: Thu, 5 Sep 2024 18:46:24 +0200 Subject: [PATCH 2/2] Fix clippy issue and match against array of chars --- src/exporter/exmaralda.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/exporter/exmaralda.rs b/src/exporter/exmaralda.rs index 53404ea0..261b712e 100644 --- a/src/exporter/exmaralda.rs +++ b/src/exporter/exmaralda.rs @@ -133,10 +133,7 @@ impl Exporter for ExportExmaralda { }; let doc_path = output_path.join(format!( "{}.{extension}", - doc_name - .split(|c| c == '/' || c == '\\') - .last() - .unwrap_or(&doc_name) // This always has a last + doc_name.split(['/', '\\']).last().unwrap_or(&doc_name) // This always has a last )); if let Some(doc_parent) = doc_path.as_path().parent() { fs::create_dir_all(doc_parent)?;