diff options
author | polwex <polwex@sortug.com> | 2025-06-22 09:25:47 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-06-22 09:25:47 +0700 |
commit | ba2ff10097f65c875a69bf052b5619316190038f (patch) | |
tree | 4a5c8bb038639d0e7db3b3a8190ec9058f45322f | |
parent | b43fe0d51da9a247bf94af27898d63f79d424073 (diff) |
actually good!
-rw-r--r-- | sorsyl/lib/ipa_table.ml | 10 |
1 files 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) |