Unverified Commit 334a6d18 authored by Yixiao Yuan's avatar Yixiao Yuan Committed by GitHub
Browse files

Modify group_sub_entities in TokenClassification Pipeline to support label with "-" (#27325)

* fix group_sub_entities bug

* add space
parent 59499bbe
...@@ -503,7 +503,7 @@ class TokenClassificationPipeline(ChunkPipeline): ...@@ -503,7 +503,7 @@ class TokenClassificationPipeline(ChunkPipeline):
entities (`dict`): The entities predicted by the pipeline. entities (`dict`): The entities predicted by the pipeline.
""" """
# Get the first entity in the entity group # Get the first entity in the entity group
entity = entities[0]["entity"].split("-")[-1] entity = entities[0]["entity"].split("-", 1)[-1]
scores = np.nanmean([entity["score"] for entity in entities]) scores = np.nanmean([entity["score"] for entity in entities])
tokens = [entity["word"] for entity in entities] tokens = [entity["word"] for entity in entities]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment