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
Ordering
- Alphabetic
- By Inheritance
Inherited
- PretrainedPipeline
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- All
Instance Constructors
- new PretrainedPipeline(downloadName: String, lang: String)
-
new
PretrainedPipeline(downloadName: String)
Support for java default argument interoperability
-
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
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def annotate(target: Array[String]): Array[Map[String, Seq[String]]]
- def annotate(target: String): Map[String, Seq[String]]
- def annotateJava(targets: ArrayList[String]): List[Map[String, List[String]]]
- def annotateJava(target: String): Map[String, List[String]]
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- val diskLocation: Option[String]
- val downloadName: String
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def fullAnnotate(audios: Array[Array[Float]]): Array[Map[String, Seq[IAnnotation]]]
- def fullAnnotate(audio: Array[Float]): Map[String, Seq[IAnnotation]]
- def fullAnnotate(targets: Array[String], optionalTargets: Array[String]): Array[Map[String, Seq[IAnnotation]]]
- def fullAnnotate(targets: Array[String]): Array[Map[String, Seq[IAnnotation]]]
- def fullAnnotate(target: String, optionalTarget: String = ""): Map[String, Seq[IAnnotation]]
- def fullAnnotateAudiosJava(audios: ArrayList[ArrayList[Double]]): List[Map[String, List[IAnnotation]]]
- def fullAnnotateImage(pathToImages: Array[String]): Array[Map[String, Seq[IAnnotation]]]
- def fullAnnotateImage(pathToImage: String): Map[String, Seq[IAnnotation]]
- def fullAnnotateImageJava(pathToImages: ArrayList[String]): List[Map[String, List[IAnnotation]]]
- def fullAnnotateImageJava(pathToImage: String): Map[String, List[IAnnotation]]
- def fullAnnotateJava(targets: ArrayList[String], optionalTargets: ArrayList[String]): List[Map[String, List[IAnnotation]]]
- def fullAnnotateJava(targets: ArrayList[String]): List[Map[String, List[IAnnotation]]]
- def fullAnnotateJava(target: String, optionalTarget: String): Map[String, List[IAnnotation]]
- def fullAnnotateJava(target: String): Map[String, List[IAnnotation]]
- def fullAnnotateSingleAudioJava(audio: ArrayList[Double]): Map[String, List[IAnnotation]]
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val lang: String
- lazy val lightModel: LightPipeline
- val model: PipelineModel
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val parseEmbeddingsVectors: Boolean
- val source: String
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def transform(dataFrame: DataFrame): DataFrame
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()