Packages

case class PretrainedPipeline(downloadName: String, lang: String = "en", source: String = ResourceDownloader.publicLoc, parseEmbeddingsVectors: Boolean = false, diskLocation: Option[String] = None) extends Product with Serializable

Represents a fully constructed and trained Spark NLP pipeline, ready to be used. This way, a whole pipeline can be defined in 1 line. Additionally, the LightPipeline version of the model can be retrieved with member lightModel.

For more extended examples see the Pipelines page and our Github Model Repository for available pipeline models.

Example

import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline
import com.johnsnowlabs.nlp.SparkNLP
val testData = spark.createDataFrame(Seq(
(1, "Google has announced the release of a beta version of the popular TensorFlow machine learning library"),
(2, "Donald John Trump (born June 14, 1946) is the 45th and current president of the United States")
)).toDF("id", "text")

val pipeline = PretrainedPipeline("explain_document_dl", lang="en")

val annotation = pipeline.transform(testData)

annotation.select("entities.result").show(false)

/*
+----------------------------------+
|result                            |
+----------------------------------+
|[Google, TensorFlow]              |
|[Donald John Trump, United States]|
+----------------------------------+
*/
downloadName

Name of the Pipeline Model

lang

Language of the defined pipeline (Default: "en")

source

Source where to get the Pipeline Model

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PretrainedPipeline
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new PretrainedPipeline(downloadName: String, lang: String)
  2. new PretrainedPipeline(downloadName: String)

    Support for java default argument interoperability

  3. new PretrainedPipeline(downloadName: String, lang: String = "en", source: String = ResourceDownloader.publicLoc, parseEmbeddingsVectors: Boolean = false, diskLocation: Option[String] = None)

    downloadName

    Name of the Pipeline Model

    lang

    Language of the defined pipeline (Default: "en")

    source

    Source where to get the Pipeline Model

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def annotate(target: Array[String]): Array[Map[String, Seq[String]]]
  5. def annotate(target: String): Map[String, Seq[String]]
  6. def annotateJava(targets: ArrayList[String]): List[Map[String, List[String]]]
  7. def annotateJava(target: String): Map[String, List[String]]
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  10. val diskLocation: Option[String]
  11. val downloadName: String
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. def fullAnnotate(audios: Array[Array[Float]]): Array[Map[String, Seq[IAnnotation]]]
  15. def fullAnnotate(audio: Array[Float]): Map[String, Seq[IAnnotation]]
  16. def fullAnnotate(targets: Array[String], optionalTargets: Array[String]): Array[Map[String, Seq[IAnnotation]]]
  17. def fullAnnotate(targets: Array[String]): Array[Map[String, Seq[IAnnotation]]]
  18. def fullAnnotate(target: String, optionalTarget: String = ""): Map[String, Seq[IAnnotation]]
  19. def fullAnnotateAudiosJava(audios: ArrayList[ArrayList[Double]]): List[Map[String, List[IAnnotation]]]
  20. def fullAnnotateImage(pathToImages: Array[String]): Array[Map[String, Seq[IAnnotation]]]
  21. def fullAnnotateImage(pathToImage: String): Map[String, Seq[IAnnotation]]
  22. def fullAnnotateImageJava(pathToImages: ArrayList[String]): List[Map[String, List[IAnnotation]]]
  23. def fullAnnotateImageJava(pathToImage: String): Map[String, List[IAnnotation]]
  24. def fullAnnotateJava(targets: ArrayList[String], optionalTargets: ArrayList[String]): List[Map[String, List[IAnnotation]]]
  25. def fullAnnotateJava(targets: ArrayList[String]): List[Map[String, List[IAnnotation]]]
  26. def fullAnnotateJava(target: String, optionalTarget: String): Map[String, List[IAnnotation]]
  27. def fullAnnotateJava(target: String): Map[String, List[IAnnotation]]
  28. def fullAnnotateSingleAudioJava(audio: ArrayList[Double]): Map[String, List[IAnnotation]]
  29. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  30. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  31. val lang: String
  32. lazy val lightModel: LightPipeline
  33. val model: PipelineModel
  34. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  35. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  36. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  37. val parseEmbeddingsVectors: Boolean
  38. val source: String
  39. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  40. def transform(dataFrame: DataFrame): DataFrame
  41. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped