John Snow labs Usage & Overview

 

The John Snow Labs Python library gives you a clean and easy way to structure your Python projects. The very first line of a project should be:

from johnsnowlabs import *

This imports all licensed and open source Python modules installed from other John Snow Labs Products, as well as many handy utility imports.

The following Functions, Classes and Modules will available in the global namespace

The nlp Module


nlp module with classes and methods from Spark NLP like nlp.BertForSequenceClassification and nlp.map_annotations()

  • nlp.AnnotatorName via Spark NLP Annotators and Transformers i.e. nlp.BertForSequenceClassification
  • Spark NLP Helper Functions i.e. nlp.map_annotations()
  • nlp.F via import pyspark.sql.functions as F under the hood
  • nlp.T via import pyspark.sql.types as T under the hood
  • nlp.SQL via import pyspark.sql as SQL under the hood
  • nlp.ML via from pyspark import ml as ML under the hood
  • To see all the imports see the source

The jsl Module

jsl module with the following methods

  • jsl.install() for installing John Snow Labs libraries and managing your licenses, more info here
  • jsl.load() for predicting with any the 10k+ pretrained models in 1 line of code or training new ones, using the nlu.load() method under the hood
  • jsl.start() for starting a Spark Session with access to features, more info here
  • jsl.viz() for visualizing predictions with any of the 10k+ pretrained models using nlu.viz() under the hood
  • jsl.viz_streamlit() and other `jsl.viz_streamlit_xyz for using any of the 10k+ pretrained models in 0 lines of code with an interactive Streamlit GUI and re-usable and stackable Streamlit Components
  • jsl.to_pretty_df() for predicting on raw strings getting a nicely structures Pandas DF from a Spark Pipeline using nlu.to_pretty_df() under the hood

The viz Module

viz module with classes from Spark NLP Display

  • viz.NerVisualizer for visualizing prediction outputs of Ner based Spark Pipelines
  • viz.DependencyParserVisualizer for visualizing prediction outputs of DependencyParser based Spark Pipelines
  • viz.RelationExtractionVisualizer for visualizing prediction outputs of RelationExtraction based Spark Pipelines
  • viz.EntityResolverVisualizer for visualizing prediction outputs of EntityResolver based Spark Pipelines
  • viz.AssertionVisualizer for visualizing prediction outputs of Assertion based Spark Pipelines

The ocr Module

ocr module with annotator classes and methods from Spark OCR like ocr.VisualDocumentClassifier and `ocr.helpful_method()

The medical Module

medical module with annotator classes and methods from Spark NLP for Medicine like medical.RelationExtractionDL and medical.profile()

  • Medical Annotators , i.e. medical.DeIdentification
  • Training Methods i.e. medical.AnnotationToolJsonReader
  • Evaluation Methods, i.e. medical.NerDLEvaluation
  • NOTE: Any class which has Medical in its name is available, but the Medical prefix has been omitted. I.e. medical.NerModel maps to sparknlp_jsl.annotator.MedicalNerModel
    • This is achieved via from sparknlp_jsl.annotator import MedicalNerModel as NerModel under the hood.
  • To see all the imports see the source

legal module with annotator classes and methods from Spark NLP for Legal like legal.RelationExtractionDL and legal.profile()

  • Legal Annotators , i.e. legal.DeIdentification
  • Training Methods i.e. legal.AnnotationToolJsonReader
  • Evaluation Methods, i.e. legal.NerDLEvaluation
  • NOTE: Any class which has Legal in its name is available, but the Legal prefix has been omitted. I.e. legal.NerModel maps to sparknlp_jsl.annotator.LegalNerModel
    • This is achieved via from sparknlp_jsl.annotator import LegalNerModel as NerModel under the hood.
  • To see all the imports see the source

The finance Module

finance module with annotator classes and methods from Spark NLP for Finance like finance.RelationExtractionDL and finance.profile()

  • Finance Annotators , i.e. finance.DeIdentification
  • Training Methods i.e. finance.AnnotationToolJsonReader
  • Evaluation Methods, i.e. finance.NerDLEvaluation
  • NOTE: Any class which has Finance in its name is available, but the Finance prefix has been omitted. I.e. finance.NerModel maps to sparknlp_jsl.annotator.FinanceNerModel
    • This is achieved via from sparknlp_jsl.annotator import FinanceNerModel as NerModel under the hood.
  • To see all the imports see the source
Last updated