I need only one tag for one word.

#4
by Aamer - opened

Hi All

Can anyone help me with how to get only one tag with one word. I am getting ner_result with tags separated by '##'.
For example, Hi Aamer, are you in India?
It is giving result like: A: B-per, ##a: I-per, ##m: I-per, ##e and so on...
I need something like, Aamer: B-person, India: B-loc

Try calling the pipeline with aggregation_strategy="simple"

Is this documented anywhere @omri374 ? All I can see from the readme is that subwords may be recognized and post-processing may be needed.

@cphoover You can find it in the documentation for the specific kind of pipeline that is returned from using pipeline('ner'...
https://huggingface.co/docs/transformers/v4.26.0/en/main_classes/pipelines#transformers.TokenClassificationPipeline

The aggregation_strategy option is not viable with all pipelines.

Sign up or log in to comment