class_docstr: Creates a LightPipeline from a Spark PipelineModel.
  
  LightPipeline is a Spark NLP specific Pipeline class equivalent to Spark
  ML Pipeline. The difference is that it’s execution does not hold to
  Spark principles, instead it computes everything locally (but in
  parallel) in order to achieve fast results when dealing with small
  amounts of data. This means, we do not input a Spark Dataframe, but a
  string or an Array of strings instead, to be annotated. To create Light
  Pipelines, you need to input an already trained (fit) Spark ML Pipeline.
  
  It’s :meth:`.transform` has now an alternative :meth:`.annotate`, which
  directly outputs the results.
  
  Parameters
  ----------
  pipelineModel : :class:`pyspark.ml.PipelineModel`
      The PipelineModel containing Spark NLP Annotators
  parse_embeddings : bool, optional
      Whether to parse embeddings, by default False
  
  Notes
  -----
  Use :meth:`.fullAnnotate` to also output the result as
  :class:`.Annotation`, with metadata.
  
  Examples
  --------
  >>> from sparknlp.base import LightPipeline
  >>> light = LightPipeline(pipeline.fit(data))
  >>> light.annotate("We are very happy about Spark NLP")
  {
      'document': ['We are very happy about Spark NLP'],
      'lemmas': ['We', 'be', 'very', 'happy', 'about', 'Spark', 'NLP'],
      'pos': ['PRP', 'VBP', 'RB', 'JJ', 'IN', 'NNP', 'NNP'],
      'sentence': ['We are very happy about Spark NLP'],
      'spell': ['We', 'are', 'very', 'happy', 'about', 'Spark', 'NLP'],
      'stems': ['we', 'ar', 'veri', 'happi', 'about', 'spark', 'nlp'],
      'token': ['We', 'are', 'very', 'happy', 'about', 'Spark', 'NLP']
  }
class_docstr_tok: ["Creates","a","LightPipeline","from","a","Spark","PipelineModel",".","LightPipeline","is","a","Spark","NLP","specific","Pipeline","class","equivalent","to","Spark","ML","Pipeline",".","The","difference","is","that","it","\u2019","s","execution","does","not","hold","to","Spark","principles",",","instead","it","computes","everything","locally","(","but","in","parallel",")","in","order","to","achieve","fast","results","when","dealing","with","small","amounts","of","data",".","This","means",",","we","do","not","input","a","Spark","Dataframe",",","but","a","string","or","an","Array","of","strings","instead",",","to","be","annotated",".","To","create","Light","Pipelines",",","you","need","to","input","an","already","trained","(","fit",")","Spark","ML","Pipeline",".","It","\u2019","s",":","meth",":","`",".transform","`","has","now","an","alternative",":","meth",":","`",".annotate","`",",","which","directly","outputs","the","results",".","Parameters","--","--","--","--","--","pipelineModel",":",":","class",":","`","pyspark.ml.PipelineModel","`","The","PipelineModel","containing","Spark","NLP","Annotators","parse_embeddings",":","bool",",","optional","Whether","to","parse","embeddings",",","by","default","False","Notes","--","--","-","Use",":","meth",":","`",".fullAnnotate","`","to","also","output","the","result","as",":","class",":","`",".Annotation","`",",","with","metadata",".","Examples","--","--","--","--",">",">",">","from","sparknlp.base","import","LightPipeline",">",">",">","light","=","LightPipeline","(","pipeline.fit","(","data",")",")",">",">",">","light.annotate","(","``","We","are","very","happy","about","Spark","NLP","''",")","{","'document","'",":","[","'We","are","very","happy","about","Spark","NLP","'","]",",","'lemmas","'",":","[","'We","'",",","'be","'",",","'very","'",",","'happy","'",",","'about","'",",","'Spark","'",",","'NLP","'","]",",","'pos","'",":","[","'PRP","'",",","'VBP","'",",","'RB","'",",","'JJ","'",",","'IN","'",",","'NNP","'",",","'NNP","'","]",",","'sentence","'",":","[","'We","are","very","happy","about","Spark","NLP","'","]",",","'spell","'",":","[","'We","'",",","'are","'",",","'very","'",",","'happy","'",",","'about","'",",","'Spark","'",",","'NLP","'","]",",","'stems","'",":","[","'we","'",",","'ar","'",",","'veri","'",",","'happi","'",",","'about","'",",","'spark","'",",","'nlp","'","]",",","'token","'",":","[","'We","'",",","'are","'",",","'very","'",",","'happy","'",",","'about","'",",","'Spark","'",",","'NLP","'","]","}"]
docstr: Annotates the data provided, extracting the results.
  
  The data should be either a list or a str.
  
  Parameters
  ----------
  target : list or str
      The data to be annotated
  optional_target: list or str
      Optional data to be annotated (currently used for Question Answering)
  
  Returns
  -------
  List[dict] or dict
      The result of the annotation
  
  Examples
  --------
  >>> from sparknlp.pretrained import PretrainedPipeline
  >>> explain_document_pipeline = PretrainedPipeline("explain_document_dl")
  >>> result = explain_document_pipeline.annotate('U.N. official Ekeus heads for Baghdad.')
  >>> result.keys()
  dict_keys(['entities', 'stem', 'checked', 'lemma', 'document', 'pos', 'token', 'ner', 'embeddings', 'sentence'])
  >>> result["ner"]
  ['B-ORG', 'O', 'O', 'B-PER', 'O', 'O', 'B-LOC', 'O']
docstr_tok: ["Annotates","the","data","provided",",","extracting","the","results",".","The","data","should","be","either","a","list","or","a","str",".","Parameters","--","--","--","--","--","target",":","list","or","str","The","data","to","be","annotated","optional_target",":","list","or","str","Optional","data","to","be","annotated","(","currently","used","for","Question","Answering",")","Returns","--","--","--","-","List","[","dict","]","or","dict","The","result","of","the","annotation","Examples","--","--","--","--",">",">",">","from","sparknlp.pretrained","import","PretrainedPipeline",">",">",">","explain_document_pipeline","=","PretrainedPipeline","(","``","explain_document_dl","''",")",">",">",">","result","=","explain_document_pipeline.annotate","(","'","U.N",".","official","Ekeus","heads","for","Baghdad",".","'",")",">",">",">","result.keys","(",")","dict_keys","(","[","'entities","'",",","'stem","'",",","'checked","'",",","'lemma","'",",","'document","'",",","'pos","'",",","'token","'",",","'ner","'",",","'embeddings","'",",","'sentence","'","]",")",">",">",">","result","[","``","ner","''","]","[","'","B-ORG","'",",","'","O","'",",","'","O","'",",","'","B-PER","'",",","'","O","'",",","'","O","'",",","'","B-LOC","'",",","'","O","'","]"]
code: def annotate(self, target, optional_target=""):
      """Annotates the data provided, extracting the results.
  
      The data should be either a list or a str.
  
      Parameters
      ----------
      target : list or str
          The data to be annotated
      optional_target: list or str
          Optional data to be annotated (currently used for Question Answering)
  
      Returns
      -------
      List[dict] or dict
          The result of the annotation
  
      Examples
      --------
      >>> from sparknlp.pretrained import PretrainedPipeline
      >>> explain_document_pipeline = PretrainedPipeline("explain_document_dl")
      >>> result = explain_document_pipeline.annotate('U.N. official Ekeus heads for Baghdad.')
      >>> result.keys()
      dict_keys(['entities', 'stem', 'checked', 'lemma', 'document', 'pos', 'token', 'ner', 'embeddings', 'sentence'])
      >>> result["ner"]
      ['B-ORG', 'O', 'O', 'B-PER', 'O', 'O', 'B-LOC', 'O']
      """
  
      def reformat(annotations):
          return {k: list(v) for k, v in annotations.items()}
  
      stages = self.pipeline_model.stages
      if not self._skipPipelineValidation(stages):
          self._validateStagesInputCols(stages)
  
      if optional_target == "":
          if type(target) is str:
              annotations = self._lightPipeline.annotateJava(target)
              result = reformat(annotations)
          elif type(target) is list:
              if type(target[0]) is list:
                  raise TypeError("target is a 1D list")
              annotations = self._lightPipeline.annotateJava(target)
              result = list(
                  map(lambda a: reformat(a), list(annotations))
              )
          else:
              raise TypeError(
                  "target for annotation must be 'str' or list"
              )
  
      else:
          if type(target) is str and type(optional_target) is str:
              annotations = self._lightPipeline.annotateJava(
                  target, optional_target
              )
              result = reformat(annotations)
          elif type(target) is list and type(optional_target) is list:
              if (
                  type(target[0]) is list
                  or type(optional_target[0]) is list
              ):
                  raise TypeError(
                      "target and optional_target is a 1D list"
                  )
              annotations = self._lightPipeline.annotateJava(
                  target, optional_target
              )
              result = list(
                  map(lambda a: reformat(a), list(annotations))
              )
          else:
              raise TypeError(
                  "target and optional_target for annotation must be both 'str' or both lists"
              )
  
      return result
  
imports: import sparknlp.internal
  from sparknlp.annotation import Annotation
  from sparknlp.annotation_audio import AnnotationAudio
  from sparknlp.annotation_image import AnnotationImage
  from sparknlp.common import AnnotatorApproach, AnnotatorModel
  from sparknlp.internal import AnnotatorTransformer
label_desc: Use image node_id 17 for calling the LightPipeline obj's underlying member method code with example usage: obj.annotate(target, optional_target) and returns: result, unknown