Description
Pretrained Named Entity Recognition model, uploaded to Hugging Face, adapted and imported into Spark NLP. RuPERTa-base-finetuned-ner
is a Spanish model orginally trained by mrm8488
.
Predicted Entities
MISC
, ORG
, LOC
, PER
How to use
documentAssembler = DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")
sentenceDetector = SentenceDetectorDLModel.pretrained("sentence_detector_dl", "xx")\
.setInputCols(["document"])\
.setOutputCol("sentence")
tokenizer = Tokenizer() \
.setInputCols("sentence") \
.setOutputCol("token")
tokenClassifier = RoBertaForTokenClassification.pretrained("roberta_ner_RuPERTa_base_finetuned_ner","es") \
.setInputCols(["sentence", "token"]) \
.setOutputCol("ner")
pipeline = Pipeline(stages=[documentAssembler, sentenceDetector, tokenizer, tokenClassifier])
data = spark.createDataFrame([["Amo Spark NLP"]]).toDF("text")
result = pipeline.fit(data).transform(data)
val documentAssembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")
val sentenceDetector = SentenceDetectorDLModel.pretrained("sentence_detector_dl", "xx")
.setInputCols(Array("document"))
.setOutputCol("sentence")
val tokenizer = new Tokenizer()
.setInputCols(Array("sentence"))
.setOutputCol("token")
val tokenClassifier = RoBertaForTokenClassification.pretrained("roberta_ner_RuPERTa_base_finetuned_ner","es")
.setInputCols(Array("sentence", "token"))
.setOutputCol("ner")
val pipeline = new Pipeline().setStages(Array(documentAssembler,sentenceDetector, tokenizer, tokenClassifier))
val data = Seq("Amo Spark NLP").toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("es.ner.RuPERTa_base_finetuned_ner").predict("""Amo Spark NLP""")
Model Information
Model Name: | roberta_ner_RuPERTa_base_finetuned_ner |
Compatibility: | Spark NLP 3.4.2+ |
License: | Open Source |
Edition: | Official |
Input Labels: | [document, token] |
Output Labels: | [ner] |
Language: | es |
Size: | 470.7 MB |
Case sensitive: | true |
Max sentence length: | 128 |
References
- https://huggingface.co/mrm8488/RuPERTa-base-finetuned-ner
- https://www.kaggle.com/nltkdata/conll-corpora
- https://www.kaggle.com/nltkdata/conll-corpora
- https://twitter.com/mrm8488