NER Pipeline: Entities group with multiple hyphens
### System Info

- `transformers` version: 4.27.4
- Platform: Linux-5.15.0-67-generic-x86_64-with-glibc2.29
- Python version: 3.8.10
- Huggingface_hub version: 0.13.3
- PyTorch version (GPU?): 2.0.0+cu118 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: no

### Who can help?

@Narsil

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

I have a BERT model that has labels such as `B-tax-percent` or `I-tax-amount`.

When I do an inference on my model, when grouping the entities, I only get the last part of my entity name, for example `percent` or `amount` instead of `tax-percent` or `tax-amount`.

Here is an example:

**config.json**:
```json
{
  "_name_or_path": "Geotrend/distilbert-base-en-fr-cased",
  "activation": "gelu",
  "architectures": [
    "DistilBertForTokenClassification"
  ],
  "attention_dropout": 0.1,
  "dim": 768,
  "dropout": 0.1,
  "hidden_dim": 3072,
  "id2label": {
    "0": "O",
    "1": "B-curr",
    "10": "B-date",
    "11": "B-payment-date",
    "12": "B-tax_^-percent",
// [...]
```
**inference.py:**
```python
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline

tokenizer = AutoTokenizer.from_pretrained("Geotrend/distilbert-base-en-fr-cased")
model = AutoModelForTokenClassification.from_pretrained("./data/models")

nerpipeline = pipeline('ner', model=model, tokenizer=tokenizer, device=0, aggregation_strategy="average")

print(nerpipeline("""37.29%""))```
```
**Output**
```python
[{'entity_group': 'percent', 'score': 0.4425447, 'word': '37', 'start': 0, 'end': 2}, {'entity_group': 'percent', 'score': 0.462865, 'word': '.', 'start': 2, 'end': 3}, {'entity_group': 'percent', 'score': 0.5241904, 'word': '29', 'start': 3, 'end': 5}, {'entity_group': 'percent', 'score': 0.3016571, 'word': '%', 'start': 5, 'end': 6}]
```

### Expected behavior

I would expect the entity group to be named with the full name except the "B" or "I" prefix.

```python
[{'entity_group': 'tax-percent', 'score': 0.4425447, 'word': '37', 'start': 0, 'end': 2}, {'entity_group': 'tax-percent', 'score': 0.462865, 'word': '.', 'start': 2, 'end': 3}, {'entity_group': 'tax-percent', 'score': 0.5241904, 'word': '29', 'start': 3, 'end': 5}, {'entity_group': 'tax-percent', 'score': 0.3016571, 'word': '%', 'start': 5, 'end': 6}]
```

It seems that the issue comes from this line, but maybe there is a reasoning that I am not aware of, or maybe multiple hyphens in entity group names are a bad practice?
https://github.com/huggingface/transformers/blob/04ab5605fbb4ef207b10bf2772d88c53fc242e83/src/transformers/pipelines/token_classification.py#L500
Can you use `B-tax_percent` instead ? It allows preserving the logic and should work out of the box, no ?<|||||>Thank you for your quick response. Yes I could rename them, and at the end that is what I did, but isn't it still a bug? I did not expect the names of my entities to be truncated.

In my case it would not quite work out of the box because I would need to pre-process the label names from my dataset to change the hyphens to underscores for training, and during inference post-process them to put the hyphens again, but of course it is not a big deal and that would be mostly a one-time thing.<|||||>> Yes I could rename them, and at the end that is what I did, but isn't it still a bug? I did not expect the names of my entities to be truncated.

Sort of, `B-` and `I-` are respected conventions and we could definitely split only once to preseve the other, but there's always going to be some specification there (like why `B` and `I`).

PRs are welcome if you want to fix ! <|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.