Skip to content

Commit

Permalink
Handle empty list of entities when aggregating entities (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanosman authored Aug 5, 2024
1 parent 78a7dcf commit 5245a7e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/bumblebee/text/token_classification.ex
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ defmodule Bumblebee.Text.TokenClassification do
end)
end

defp override_token_labels([], _spec, _strategy), do: []

defp override_token_labels([entity | entities], spec, strategy) do
{final_group, word_entities} =
Enum.reduce(entities, {[entity], []}, fn entity, {word_group, word_entities} ->
Expand Down

0 comments on commit 5245a7e

Please sign in to comment.