class_docstr: Extracts Named Entities based on a CRF Model.
  
  This Named Entity recognition annotator allows for a generic model to be
  trained by utilizing a CRF machine learning algorithm. The data should have
  columns of type ``DOCUMENT, TOKEN, POS, WORD_EMBEDDINGS``. These can be
  extracted with for example
  
  - a SentenceDetector,
  - a Tokenizer and
  - a PerceptronModel.
  
  This is the instantiated model of the :class:`.NerCrfApproach`. For training
  your own model, please see the documentation of that class.
  
  Pretrained models can be loaded with :meth:`.pretrained` of the companion
  object:
  
  >>> nerTagger = NerCrfModel.pretrained() \
  ...     .setInputCols(["sentence", "token", "word_embeddings", "pos"]) \
  ...     .setOutputCol("ner")
  
  
  The default model is ``"ner_crf"``, if no name is provided. For available
  pretrained models please see the `Models Hub
  <https://sparknlp.org/models?task=Named+Entity+Recognition>`__.
  
  For extended examples of usage, see the `Examples
  <https://github.com/JohnSnowLabs/spark-nlp/blob/master/examples/python/training/english/crf-ner/ner_dl_crf.ipynb>`__.
  
  ========================================= ======================
  Input Annotation types                    Output Annotation type
  ========================================= ======================
  ``DOCUMENT, TOKEN, POS, WORD_EMBEDDINGS`` ``NAMED_ENTITY``
  ========================================= ======================
  
  Parameters
  ----------
  includeConfidence
      Whether to include confidence scores in annotation metadata, by default
      False
  
  Examples
  --------
  >>> import sparknlp
  >>> from sparknlp.base import *
  >>> from sparknlp.annotator import *
  >>> from pyspark.ml import Pipeline
  
  First extract the prerequisites for the NerCrfModel
  
  >>> documentAssembler = DocumentAssembler() \
  ...     .setInputCol("text") \
  ...     .setOutputCol("document")
  >>> sentence = SentenceDetector() \
  ...     .setInputCols(["document"]) \
  ...     .setOutputCol("sentence")
  >>> tokenizer = Tokenizer() \
  ...     .setInputCols(["sentence"]) \
  ...     .setOutputCol("token")
  >>> embeddings = WordEmbeddingsModel.pretrained() \
  ...     .setInputCols(["sentence", "token"]) \
  ...     .setOutputCol("word_embeddings")
  >>> posTagger = PerceptronModel.pretrained() \
  ...     .setInputCols(["sentence", "token"]) \
  ...     .setOutputCol("pos")
  
  Then NER can be extracted
  
  >>> nerTagger = NerCrfModel.pretrained() \
  ...     .setInputCols(["sentence", "token", "word_embeddings", "pos"]) \
  ...     .setOutputCol("ner")
  >>> pipeline = Pipeline().setStages([
  ...     documentAssembler,
  ...     sentence,
  ...     tokenizer,
  ...     embeddings,
  ...     posTagger,
  ...     nerTagger
  ... ])
  >>> data = spark.createDataFrame([["U.N. official Ekeus heads for Baghdad."]]).toDF("text")
  >>> result = pipeline.fit(data).transform(data)
  >>> result.select("ner.result").show(truncate=False)
  +------------------------------------+
  |result                              |
  +------------------------------------+
  |[I-ORG, O, O, I-PER, O, O, I-LOC, O]|
  +------------------------------------+
  
  See Also
  --------
  NerDLModel : for a deep learning based approach
  NerConverter : to further process the results
class_docstr_tok: ["Extracts","Named","Entities","based","on","a","CRF","Model",".","This","Named","Entity","recognition","annotator","allows","for","a","generic","model","to","be","trained","by","utilizing","a","CRF","machine","learning","algorithm",".","The","data","should","have","columns","of","type","``","DOCUMENT",",","TOKEN",",","POS",",","WORD_EMBEDDINGS","``",".","These","can","be","extracted","with","for","example","-","a","SentenceDetector",",","-","a","Tokenizer","and","-","a","PerceptronModel",".","This","is","the","instantiated","model","of","the",":","class",":","`",".NerCrfApproach","`",".","For","training","your","own","model",",","please","see","the","documentation","of","that","class",".","Pretrained","models","can","be","loaded","with",":","meth",":","`",".pretrained","`","of","the","companion","object",":",">",">",">","nerTagger","=","NerCrfModel.pretrained","(",")","\\","...",".setInputCols","(","[","``","sentence","''",",","``","token","''",",","``","word_embeddings","''",",","``","pos","''","]",")","\\","...",".setOutputCol","(","``","ner","''",")","The","default","model","is","``","``","ner_crf","''","``",",","if","no","name","is","provided",".","For","available","pretrained","models","please","see","the","`","Models","Hub","<","https",":","\/\/sparknlp.org\/models","?","task=Named+Entity+Recognition",">","`","__",".","For","extended","examples","of","usage",",","see","the","`","Examples","<","https",":","\/\/github.com\/JohnSnowLabs\/spark-nlp\/blob\/master\/examples\/python\/training\/english\/crf-ner\/ner_dl_crf.ipynb",">","`","__",".","=========================================","======================","Input","Annotation","types","Output","Annotation","type","=========================================","======================","``","DOCUMENT",",","TOKEN",",","POS",",","WORD_EMBEDDINGS","``","``","NAMED_ENTITY","``","=========================================","======================","Parameters","--","--","--","--","--","includeConfidence","Whether","to","include","confidence","scores","in","annotation","metadata",",","by","default","False","Examples","--","--","--","--",">",">",">","import","sparknlp",">",">",">","from","sparknlp.base","import","*",">",">",">","from","sparknlp.annotator","import","*",">",">",">","from","pyspark.ml","import","Pipeline","First","extract","the","prerequisites","for","the","NerCrfModel",">",">",">","documentAssembler","=","DocumentAssembler","(",")","\\","...",".setInputCol","(","``","text","''",")","\\","...",".setOutputCol","(","``","document","''",")",">",">",">","sentence","=","SentenceDetector","(",")","\\","...",".setInputCols","(","[","``","document","''","]",")","\\","...",".setOutputCol","(","``","sentence","''",")",">",">",">","tokenizer","=","Tokenizer","(",")","\\","...",".setInputCols","(","[","``","sentence","''","]",")","\\","...",".setOutputCol","(","``","token","''",")",">",">",">","embeddings","=","WordEmbeddingsModel.pretrained","(",")","\\","...",".setInputCols","(","[","``","sentence","''",",","``","token","''","]",")","\\","...",".setOutputCol","(","``","word_embeddings","''",")",">",">",">","posTagger","=","PerceptronModel.pretrained","(",")","\\","...",".setInputCols","(","[","``","sentence","''",",","``","token","''","]",")","\\","...",".setOutputCol","(","``","pos","''",")","Then","NER","can","be","extracted",">",">",">","nerTagger","=","NerCrfModel.pretrained","(",")","\\","...",".setInputCols","(","[","``","sentence","''",",","``","token","''",",","``","word_embeddings","''",",","``","pos","''","]",")","\\","...",".setOutputCol","(","``","ner","''",")",">",">",">","pipeline","=","Pipeline","(",")",".setStages","(","[","...","documentAssembler",",","...","sentence",",","...","tokenizer",",","...","embeddings",",","...","posTagger",",","...","nerTagger","...","]",")",">",">",">","data","=","spark.createDataFrame","(","[","[","``","U.N.","official","Ekeus","heads","for","Baghdad",".","``","]","]",")",".toDF","(","``","text","''",")",">",">",">","result","=","pipeline.fit","(","data",")",".transform","(","data",")",">",">",">","result.select","(","``","ner.result","''",")",".show","(","truncate=False",")","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|result","|","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","[","I-ORG",",","O",",","O",",","I-PER",",","O",",","O",",","I-LOC",",","O","]","|","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","See","Also","--","--","--","--","NerDLModel",":","for","a","deep","learning","based","approach","NerConverter",":","to","further","process","the","results"]
docstr: Downloads and loads a pretrained model.
  
  Parameters
  ----------
  name : str, optional
      Name of the pretrained model, by default "ner_crf"
  lang : str, optional
      Language of the pretrained model, by default "en"
  remote_loc : str, optional
      Optional remote address of the resource, by default None. Will use
      Spark NLPs repositories otherwise.
  
  Returns
  -------
  NerCrfModel
      The restored model
docstr_tok: ["Downloads","and","loads","a","pretrained","model",".","Parameters","--","--","--","--","--","name",":","str",",","optional","Name","of","the","pretrained","model",",","by","default","``","ner_crf","''","lang",":","str",",","optional","Language","of","the","pretrained","model",",","by","default","``","en","''","remote_loc",":","str",",","optional","Optional","remote","address","of","the","resource",",","by","default","None",".","Will","use","Spark","NLPs","repositories","otherwise",".","Returns","--","--","--","-","NerCrfModel","The","restored","model"]
code: def pretrained(name="ner_crf", lang="en", remote_loc=None):
      """Downloads and loads a pretrained model.
  
      Parameters
      ----------
      name : str, optional
          Name of the pretrained model, by default "ner_crf"
      lang : str, optional
          Language of the pretrained model, by default "en"
      remote_loc : str, optional
          Optional remote address of the resource, by default None. Will use
          Spark NLPs repositories otherwise.
  
      Returns
      -------
      NerCrfModel
          The restored model
      """
      from sparknlp.pretrained import ResourceDownloader
  
      return ResourceDownloader.downloadModel(
          NerCrfModel, name, lang, remote_loc
      )
  
file_path: spark-nlp/python/sparknlp/annotator/ner/ner_crf.py
imports: from sparknlp.common import *
  from sparknlp.annotator.ner.ner_approach import NerApproach
label_desc: Use image node_id 3 for calling the NerCrfModel obj's underlying member method code with example usage: obj.pretrained(name, lang, remote_loc) and returns: ResourceDownloader