From ba2ff10097f65c875a69bf052b5619316190038f Mon Sep 17 00:00:00 2001 From: polwex Date: Sun, 22 Jun 2025 09:25:47 +0700 Subject: actually good! --- sorsyl/lib/ipa_table.ml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sorsyl/lib/ipa_table.ml b/sorsyl/lib/ipa_table.ml index 295100d..3ecbda4 100644 --- a/sorsyl/lib/ipa_table.ml +++ b/sorsyl/lib/ipa_table.ml @@ -121,9 +121,11 @@ let longest_one_seg_prefix trie word = let ipa_segs ?(_normalize = true) data word = let rec aux acc remaining = - match longest_one_seg_prefix data.trie remaining with - | None -> acc - | Some seg -> - aux (seg :: acc) (String.drop_prefix remaining (String.length seg)) + if String.is_empty remaining then acc + else + match longest_one_seg_prefix data.trie remaining with + | None -> aux acc (String.drop_prefix remaining 1) + | Some seg -> + aux (seg :: acc) (String.drop_prefix remaining (String.length seg)) in List.rev (aux [] word) -- cgit v1.2.3