Description
This model, extracts drive license number entities from clinical texts.
Predicted Entities
DLN
How to use
document_assembler = DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")
sentence_detector = SentenceDetectorDLModel.pretrained("sentence_detector_dl_healthcare","en","clinical/models")\
.setInputCols(["document"])\
.setOutputCol("sentence")
tokenizer = Tokenizer() \
.setInputCols(["sentence"]) \
.setOutputCol("token")
dln_contextual_parser = ContextualParserModel.pretrained("dln_parser","en","clinical/models") \
.setInputCols(["sentence", "token"]) \
.setOutputCol("chunk_dln")
chunk_converter = ChunkConverter() \
.setInputCols(["chunk_dln"]) \
.setOutputCol("ner_chunk")
parserPipeline = Pipeline(stages=[
document_assembler,
sentence_detector,
tokenizer,
dln_contextual_parser,
chunk_converter
])
model = parserPipeline.fit(spark.createDataFrame([[""]]).toDF("text"))
sample_text = """Name : Hendrickson, Ora, Record date: 2093-01-13, # 719435.
Dr. John Green, ID: 1231511863, IP 203.120.223.13.
He is a 60-year-old male was admitted to the Day Hospital for cystectomy on 01/13/93.
Patient's VIN : 1HGBH41JXMN109286, SSN #333-44-6666, Driver's license no: A334455B. Driver's license# 12345678. MY DL# B324567 CDL bs34df45
Phone (302) 786-5227, 0295 Keats Street, San Francisco, E-MAIL: smith@gmail.com."""
result = model.transform(spark.createDataFrame([[sample_text]]).toDF("text"))
val document_assembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")
val sentence_detector = SentenceDetectorDLModel.pretrained("sentence_detector_dl_healthcare","en","clinical/models")
.setInputCols("document")
.setOutputCol("sentence")
val tokenizer = new Tokenizer()
.setInputCols("sentence")
.setOutputCol("token")
val dln_contextual_parser = ContextualParserModel.pretrained("dln_parser","en","clinical/models")
.setInputCols(Array("sentence", "token"))
.setOutputCol("chunk_dln")
val chunk_converter = new ChunkConverter()
.setInputCols("chunk_dln")
.setOutputCol("ner_chunk")
val parserPipeline = new Pipeline().setStages(Array(
document_assembler,
sentence_detector,
tokenizer,
dln_contextual_parser,
chunk_converter
))
val sample_text = """Name : Hendrickson, Ora, Record date: 2093-01-13, # 719435.
Dr. John Green, ID: 1231511863, IP 203.120.223.13.
He is a 60-year-old male was admitted to the Day Hospital for cystectomy on 01/13/93.
Patient's VIN : 1HGBH41JXMN109286, SSN #333-44-6666, Driver's license no: A334455B. Driver's license# 12345678. MY DL# B324567 CDL bs34df45
Phone (302) 786-5227, 0295 Keats Street, San Francisco, E-MAIL: smith@gmail.com."""
val data = Seq(sample_text).toDF("text")
val results = parserPipeline.fit(data).transform(data)
Results
+--------+-----+---+-----+
| chunk|begin|end|label|
+--------+-----+---+-----+
|A334455B| 271|278| DLN|
|12345678| 299|306| DLN|
| B324567| 316|322| DLN|
|bs34df45| 328|335| DLN|
+--------+-----+---+-----+
Model Information
Model Name: | dln_parser |
Compatibility: | Healthcare NLP 5.5.0+ |
License: | Licensed |
Edition: | Official |
Input Labels: | [sentence, token] |
Output Labels: | [entity_dln] |
Language: | en |
Size: | 9.3 KB |
Case sensitive: | false |
PREVIOUSDate Regex Matcher