Views
No views yet
1from transformers import pipeline
2
3nlp = pipeline('token-classification', 'yongsun-yoon/deberta-v3-base-open-ner', aggregation_strategy='simple')
4
5text = '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.'
6entity_type = 'ingredient'
7input_text = f'{text}{nlp.tokenizer.sep_token}{entity_type}' # [SEP]
8
9nlp(input_text) # olive oil, onion