File size: 633 Bytes
b58f941
 
 
 
092a3fe
a709768
a40e20f
 
 
a709768
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
---
language:
- en
---
# Open Named Entity Recognition (English)

You can read the details in [this post](https://medium.com/@yongsun.yoon/cross-encoder-for-open-named-entity-recognition-4a7d485c37cc).


```python
from transformers import pipeline

nlp = pipeline('token-classification', 'yongsun-yoon/deberta-v3-base-open-ner', aggregation_strategy='simple')

text = 'Heat the olive oil in a frying pan, add the onion and cook for 5 minutes until softened and starting to turn golden. Set aside.'
entity_type = 'ingredient'
input_text = f'{text}{nlp.tokenizer.sep_token}{entity_type}' # [SEP]

nlp(input_text) # olive oil, onion
```