Description
Pretrained RoBERTa NER model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. bioclinical-roberta-es-finenuned-clinical-ner
is a Spanish model originally trained by mrm8488
.
How to use
documentAssembler = DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")
sentenceDetector = SentenceDetector()\
.setInputCols(["document"])\
.setOutputCol("sentence")
tokenizer = Tokenizer() \
.setInputCols("sentence") \
.setOutputCol("token")
ner = RoBertaForTokenClassification.pretrained("roberta_ner_finetuned_bioclinical","es") \
.setInputCols(["sentence", "token"]) \
.setOutputCol("ner")
pipeline = Pipeline(stages=[documentAssembler, tokenizer, ner])
data = spark.createDataFrame([["PUT YOUR STRING HERE."]]).toDF("text")
result = pipeline.fit(data).transform(data)
val documentAssembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")
val sentenceDetector = new SentenceDetector()
.setInputCols(Array("document"))
.setOutputCol("sentence")
val tokenizer = new Tokenizer()
.setInputCols(Array("sentence"))
.setOutputCol("token")
val ner = RoBertaForTokenClassification.pretrained("roberta_ner_finetuned_bioclinical","es")
.setInputCols(Array("sentence", "token"))
.setOutputCol("ner")
val pipeline = new Pipeline().setStages(Array(documentAssembler, tokenizer, ner))
val data = Seq("PUT YOUR STRING HERE.").toDS.toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("es.ner.roberta.bio_clinical.finetuned").predict("""PUT YOUR STRING HERE.""")
Model Information
Model Name: | roberta_ner_finetuned_bioclinical |
Compatibility: | Spark NLP 4.0.0+ |
License: | Open Source |
Edition: | Official |
Input Labels: | [document, token] |
Output Labels: | [ner] |
Language: | es |
Size: | 441.1 MB |
Case sensitive: | true |
Max sentence length: | 256 |
References
https://huggingface.co/mrm8488/bioclinical-roberta-es-finenuned-clinical-ner