class_docstr: Trains an averaged Perceptron model to tag words part-of-speech. Sets a
  POS tag to each word within a sentence.
  
  For pretrained models please see the :class:`.PerceptronModel`.
  
  The training data needs to be in a Spark DataFrame, where the column needs
  to consist of Annotations of type ``POS``. The `Annotation` needs to have
  member ``result`` set to the POS tag and have a ``"word"`` mapping to its
  word inside of member ``metadata``. This DataFrame for training can easily
  created by the helper class :class:`.POS`.
  
  
  >>> POS().readDataset(spark, datasetPath) \
  ...     .selectExpr("explode(tags) as tags").show(truncate=False)
  +---------------------------------------------+
  |tags                                         |
  +---------------------------------------------+
  |[pos, 0, 5, NNP, [word -> Pierre], []]       |
  |[pos, 7, 12, NNP, [word -> Vinken], []]      |
  |[pos, 14, 14, ,, [word -> ,], []]            |
  |[pos, 31, 34, MD, [word -> will], []]        |
  |[pos, 36, 39, VB, [word -> join], []]        |
  |[pos, 41, 43, DT, [word -> the], []]         |
  |[pos, 45, 49, NN, [word -> board], []]       |
                          ...
  
  
  For extended examples of usage, see the `Examples
  <https://github.com/JohnSnowLabs/spark-nlp/blob/master/examples/python/training/french/Train-Perceptron-French.ipynb>`__.
  
  ====================== ======================
  Input Annotation types Output Annotation type
  ====================== ======================
  ``TOKEN, DOCUMENT``    ``POS``
  ====================== ======================
  
  Parameters
  ----------
  posCol
      Column name for Array of POS tags that match tokens
  nIterations
      Number of iterations in training, converges to better accuracy, by
      default 5
  
  Examples
  --------
  >>> import sparknlp
  >>> from sparknlp.base import *
  >>> from sparknlp.annotator import *
  >>> from sparknlp.training import *
  >>> from pyspark.ml import Pipeline
  >>> documentAssembler = DocumentAssembler() \
  ...     .setInputCol("text") \
  ...     .setOutputCol("document")
  >>> sentence = SentenceDetector() \
  ...     .setInputCols(["document"]) \
  ...     .setOutputCol("sentence")
  >>> tokenizer = Tokenizer() \
  ...     .setInputCols(["sentence"]) \
  ...     .setOutputCol("token")
  >>> datasetPath = "src/test/resources/anc-pos-corpus-small/test-training.txt"
  >>> trainingPerceptronDF = POS().readDataset(spark, datasetPath)
  >>> trainedPos = PerceptronApproach() \
  ...     .setInputCols(["document", "token"]) \
  ...     .setOutputCol("pos") \
  ...     .setPosColumn("tags") \
  ...     .fit(trainingPerceptronDF)
  >>> pipeline = Pipeline().setStages([
  ...     documentAssembler,
  ...     sentence,
  ...     tokenizer,
  ...     trainedPos
  ... ])
  >>> data = spark.createDataFrame([["To be or not to be, is this the question?"]]).toDF("text")
  >>> result = pipeline.fit(data).transform(data)
  >>> result.selectExpr("pos.result").show(truncate=False)
  +--------------------------------------------------+
  |result                                            |
  +--------------------------------------------------+
  |[NNP, NNP, CD, JJ, NNP, NNP, ,, MD, VB, DT, CD, .]|
  +--------------------------------------------------+
docstr: Sets number of iterations in training, by default 5.
  
  Parameters
  ----------
  value : int
      Number of iterations in training
code: def setIterations(self, value):
      """Sets number of iterations in training, by default 5.
  
      Parameters
      ----------
      value : int
          Number of iterations in training
      """
      return self._set(nIterations=value)
  
file_path: spark-nlp/python/sparknlp/annotator/pos/perceptron.py
imports: from sparknlp.common import *
label_desc: Use image node_id 3 for calling the PerceptronApproach obj's underlying member method code with example usage: obj.setIterations(value) and returns: self