Pipeline to Detect Adverse Drug Events (BertForTokenClassification)

Description

This pretrained pipeline is built on the top of bert_token_classifier_ner_ade model.

Predicted Entities

ADE, DRUG

Copy S3 URI

How to use

from sparknlp.pretrained import PretrainedPipeline

pipeline = PretrainedPipeline("bert_token_classifier_ner_ade_pipeline", "en", "clinical/models")

text = '''I have an allergic reaction to vancomycin so I have itchy skin, sore throat/burning/itching, numbness of tongue and gums. I would not recommend this drug to anyone, especially since I have never had such an adverse reaction to any other medication.'''

result = pipeline.fullAnnotate(text)
import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline

val pipeline = new PretrainedPipeline("bert_token_classifier_ner_ade_pipeline", "en", "clinical/models")

val text = "I have an allergic reaction to vancomycin so I have itchy skin, sore throat/burning/itching, numbness of tongue and gums. I would not recommend this drug to anyone, especially since I have never had such an adverse reaction to any other medication."

val result = pipeline.fullAnnotate(text)
import nlu
nlu.load("en.classify.token_bert.ade_pipeline").predict("""I have an allergic reaction to vancomycin so I have itchy skin, sore throat/burning/itching, numbness of tongue and gums. I would not recommend this drug to anyone, especially since I have never had such an adverse reaction to any other medication.""")

Results

|sentence_id|chunk                      |begin|end|ner_label|
+-----------+---------------------------+-----+---+---------+
|0          |allergic reaction          |10   |26 |ADE      |
|0          |vancomycin                 |31   |40 |DRUG     |
|0          |itchy skin                 |52   |61 |ADE      |
|0          |sore throat/burning/itching|64   |90 |ADE      |
|0          |numbness of tongue and gums|93   |119|ADE      |
|1          |other                      |231  |235|DRUG     |
|1          |medication                 |237  |246|DRUG     |

Model Information

Model Name: bert_token_classifier_ner_ade_pipeline
Type: pipeline
Compatibility: Healthcare NLP 4.4.4+
License: Licensed
Edition: Official
Language: en
Size: 404.9 MB

Included Models

  • DocumentAssembler
  • SentenceDetectorDLModel
  • TokenizerModel
  • MedicalBertForTokenClassifier
  • NerConverterInternalModel