Description
A pre-trained pipeline containing NerDl Model. The NER model trained on OntoNotes 5.0 with electra_base_uncased
embeddings. It can extract up to following 18 entities:
Predicted Entities
CARDINAL
, DATE
, EVENT
, FAC
, GPE
, LANGUAGE
, LAW
, LOC
, MONEY
, NORP
, ORDINAL
, ORG
, PERCENT
, PERSON
, PRODUCT
, QUANTITY
, TIME
, WORK_OF_ART
.
Live Demo Download Copy S3 URI
How to use
from sparknlp.pretrained import PretrainedPipeline
pipeline = PretrainedPipeline('onto_recognize_entities_electra_base')
result = pipeline.annotate("Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament.")
import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline
val pipeline = new PretrainedPipeline("onto_recognize_entities_electra_base")
val result = pipeline.annotate("Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament.")
import nlu
text = ["""Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament."""]
ner_df = nlu.load('en.ner.onto.electra.base').predict(text, output_level='chunk')
ner_df[["entities", "entities_class"]]
Results
+------------+---------+
|chunk |ner_label|
+------------+---------+
|Johnson |PERSON |
|first |ORDINAL |
|2001 |DATE |
|Parliament |ORG |
|eight years |DATE |
|London |GPE |
|2008 to 2016|DATE |
|Parliament |ORG |
+------------+---------+
Model Information
Model Name: | onto_recognize_entities_electra_base |
Type: | pipeline |
Compatibility: | Spark NLP 2.7.0+ |
Edition: | Official |
Language: | en |
Included Models
- DocumentAssembler
- SentenceDetectorDLModel
- Tokenizer
- BertEmbeddings
- NerDLModel
- NerConverter