From f3f1405ea80911a8952476bf506a5f7861933645 Mon Sep 17 00:00:00 2001 From: BrewingWeasel Date: Sun, 5 Nov 2023 16:41:32 -0500 Subject: [PATCH] fix: running spacy on empty string on launch fixes #17 --- src-tauri/src/language_parsing.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src-tauri/src/language_parsing.rs b/src-tauri/src/language_parsing.rs index c00cffd..2153536 100644 --- a/src-tauri/src/language_parsing.rs +++ b/src-tauri/src/language_parsing.rs @@ -4,6 +4,9 @@ use spacy_parsing::{get_spacy_info, PartOfSpeech}; #[tauri::command] pub async fn parse_text(sent: &str, model: &str) -> Result, String> { let mut words = Vec::new(); + if sent.is_empty() { + return Ok(words); + } let parsed_words = get_spacy_info(sent, model)?; for word in parsed_words { let clickable = !matches!(