code: def filter_by_annotations_col(dataframe, f, column):
      """Applies a filter over a column of Annotations.
  
      Parameters
      ----------
      dataframe : DataFrame
          Input DataFrame
      f : function
          Filter function
      column : str
          Name of the column
  
      Returns
      -------
      :class:`pyspark.sql.DataFrame`
          Filtered DataFrame
  
      Examples
      --------
      >>> from sparknlp.pretrained import PretrainedPipeline
      >>> from sparknlp.functions import *
      >>> explain_document_pipeline = PretrainedPipeline("explain_document_dl")
      >>> data = spark.createDataFrame([["U.N. official Ekeus heads for Baghdad."]]).toDF("text")
      >>> result = explain_document_pipeline.transform(data)
      >>> def filter_pos(annotation: Annotation):
      ...     return annotation.result == "NNP"
      >>> filter_by_annotations_col(
      ...     explode_annotations_col(result, "pos", "pos"), filter_pos, "pos"
      ... ).select("pos").show(truncate=False)
      +-----------------------------------------+
      |pos                                      |
      +-----------------------------------------+
      |[pos, 0, 2, NNP, [word -> U.N], []]      |
      |[pos, 14, 18, NNP, [word -> Epeus], []]  |
      |[pos, 30, 36, NNP, [word -> Baghdad], []]|
      +-----------------------------------------+
      """
      this_udf = udf(lambda content: f(content), BooleanType())
      return dataframe.filter(this_udf(column))
  
file_path: spark-nlp/python/sparknlp/functions.py
imports: from pyspark.sql.functions import udf, array
  from pyspark.sql.types import *
  from pyspark.sql import DataFrame
  from sparknlp.annotation import Annotation
label_desc: Use image node_id 6 for calling a global function with example usage: filter_by_annotations_col(dataframe, f, column) and returns: dataframe