Enterprise Spark NLP

 

...
pos = PerceptronModel.pretrained("pos_clinical","en","clinical/models")\
	.setInputCols(["token","sentence"])\
	.setOutputCol("pos")

pos_pipeline = Pipeline(stages=[document_assembler, sentence_detector, tokenizer, pos])
light_pipeline = LightPipeline(pos_pipeline.fit(spark.createDataFrame([[""]]).toDF("text")))
result = light_pipeline.fullAnnotate("""He was given boluses of MS04 with some effect, he has since been placed on a PCA - he take 80mg of oxycontin at home, his PCA dose is ~ 2 the morphine dose of the oxycontin, he has also received ativan for anxiety.""")
...
pos = PerceptronModel.pretrained("pos_clinical","en","clinical/models")\
    .setInputCols(["token","sentence"])\
    .setOutputCol("pos")

pos_pipeline = Pipeline(stages=[document_assembler, sentence_detector, tokenizer, pos])
light_pipeline = LightPipeline(pos_pipeline.fit(spark.createDataFrame([[""]]).toDF("text")))
result = light_pipeline.fullAnnotate("""He was given boluses of MS04 with some effect, he has since been placed on a PCA - he take 80mg of oxycontin at home, his PCA dose is ~ 2 the morphine dose of the oxycontin, he has also received ativan for anxiety.""")
val pos = PerceptronModel.pretrained("pos_clinical","en","clinical/models")
	.setInputCols("token","sentence")
	.setOutputCol("pos")

val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, tokenizer, pos))
val data = Seq("He was given boluses of MS04 with some effect, he has since been placed on a PCA - he take 80mg of oxycontin at home, his PCA dose is ~ 2 the morphine dose of the oxycontin, he has also received ativan for anxiety.").toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("en.pos.clinical").predict("""He was given boluses of MS04 with some effect, he has since been placed on a PCA - he take 80mg of oxycontin at home, his PCA dose is ~ 2 the morphine dose of the oxycontin, he has also received ativan for anxiety.""")

Getting started

We call Enterprise Spark NLP libraries to all the commercial NLP libraries, including Healthcare NLP (former Spark NLP for Healthcare), Finance, Legal NLP, among others. This excludes Visual NLP (former Spark OCR), which has its own documentation page, available here.

If you don’t have an Enterprise Spark NLP subscription yet, you can ask for a free trial by clicking on the Try Free button and following the instructions provides in the video below.

Try Free

A detailed step-by-step guide on how to obtain and use a trial license for John Snow Labs NLP Libraries is provided in the video below:

Get a FREE license for John Snow Labs NLP Libraries

Enterprise Spark NLP libraries provides healthcare-specific annotators, pipelines, models, and embeddings for:

  • Entity recognition
  • Entity Linking
  • Entity normalization
  • Assertion Status Detection
  • De-identification
  • Relation Extraction
  • Spell checking & correction
  • and much more!
Last updated