Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

hugingface ner

from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline

tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
model = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")

nlp = pipeline("ner", model=model, tokenizer=tokenizer)
example = "My name is Wolfgang and I live in Berlin"

ner_results = nlp(example)
print(ner_results)
Comment

PREVIOUS NEXT
Code Example
Python :: image.open no such file or directory 
Python :: spacy access vocabulary 
Python :: python runserver port 
Python :: save to xlsx in python 
Python :: python if string contains char 
Python :: roc auc score plotting 
Python :: delete outliers in pandas 
Python :: python argsort a list 
Python :: SyntaxError: positional argument follows keyword argument 
Python :: python comparison operators 
Python :: python check if array 
Python :: py2exe no console 
Python :: recorrer diccionario python 
Python :: optimizationed bubble sort optimizationed 
Python :: input function in python 
Python :: python key from values 
Python :: python find string count in str 
Python :: len function in python 
Python :: read ms word with python 
Python :: pandas dataframe display cell size 
Python :: Python not readable file 
Python :: distinct query in django queryset 
Python :: python os.walk recursive 
Python :: monty hall problem in python 
Python :: calculer un temps en python 
Python :: bracket balanced or not in python 
Python :: import this 
Python :: How do you create an matrix of random integers in Numpy? 
Python :: python convert string to list 
Python :: register admin django 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =