NerDLModel Cellular

Description

Pretrained named entity recognition deep learning model for molecular biology related terms. The SparkNLP deep learning model (NerDL) is inspired by a former state of the art model for NER: Chiu & Nicols, Named Entity Recognition with Bidirectional LSTM-CNN.

Predicted Entities

DNA, Cell_type, Cell_line, RNA, Protein

Open in Colab Download

How to use

Use as part of an nlp pipeline with the following stages: DocumentAssembler, SentenceDetector, Tokenizer, WordEmbeddingsModel, NerDLModel. Add the NerConverter to the end of the pipeline to convert entity tokens into full entity chunks.


clinical_ner = NerDLModel.pretrained("ner_cellular", "en", "clinical/models") \
  .setInputCols(["sentence", "token", "embeddings"]) \
  .setOutputCol("ner")

nlpPipeline = Pipeline(stages=[clinical_ner])

empty_data = spark.createDataFrame([[""]]).toDF("text")

model = nlpPipeline.fit(empty_data)

results = model.transform(data)


val ner = NerDLModel.pretrained("ner_cellular", "en", "clinical/models") \
  .setInputCols(["sentence", "token", "embeddings"]) \
  .setOutputCol("ner")

val pipeline = new Pipeline().setStages(Array(ner))

val result = pipeline.fit(Seq.empty[String].toDS.toDF("text")).transform(data)

Results

The output is a dataframe with a sentence per row and a “ner” column containing all of the entity labels in the sentence, entity character indices, and other metadata. To get only the tokens and entity labels, without the metadata, select “token.result” and “ner.result” from your output dataframe or add the “Finisher” to the end of your pipeline.

image

Model Information

Model Name: ner_cellular_en_2.4.2_2.4
Type: ner
Compatibility: Spark NLP 2.4.2
Edition: Official
License: Licensed
Input Labels: [sentence,token, embeddings]
Output Labels: [ner]
Language: [en]
Case sensitive: false

Data Source

Trained on the JNLPBA corpus containing more than 2.404 publication abstracts with ‘embeddings_clinical’. http://www.geniaproject.org/