Packages

c

com.johnsnowlabs.nlp.annotators.assertion

AssertionChunkConverter

class AssertionChunkConverter extends Transformer with DefaultParamsWritable with HasInputAnnotationCols with HasOutputAnnotationCol with HasOutputAnnotatorType with CheckLicense

Creates a chunk column with metadata for training assertion status detection models.

In some cases, there may be issues while creating the chunk column when using token indices that can lead to loss of data to train assertion status models. The AssertionChunkConverter annotator uses both begin and end indices of the tokens as input to add a more robust metadata to the chunk column in a way that improves the reliability of the indices and avoid loss of data.

Notes

Chunk begin and end indices in the assertion status model training dataframe can be populated using the new version of ALAB module.

Example

Define the stages of the pipeline

val document = new DocumentAssembler()
  .setInputCol("text")
  .setOutputCol("document")
val sentenceDetector = new SentenceDetector()
  .setInputCols("document")
  .setOutputCol("sentence")
val tokenizer = new Tokenizer()
  .setInputCols("sentence")
  .setOutputCol("token")
val converter  = new AssertionChunkConverter()
  .setInputCols("tokens")
  .setChunkTextCol("target")
  .setChunkBeginCol("char_begin")
  .setChunkEndCol("char_end")
  .setOutputTokenBeginCol("token_begin")
  .setOutputTokenEndCol("token_end")
  .setOutputCol("chunk")

Define the pipeline and obtain the results

val pipeline = new Pipeline().setStages(Array(
  document,
  sentenceDetector,
  tokenizer,
  converter
))

results = pipeline.fit(data).transform(data)
Linear Supertypes
CheckLicense, HasOutputAnnotatorType, HasOutputAnnotationCol, HasInputAnnotationCols, DefaultParamsWritable, MLWritable, Transformer, PipelineStage, Logging, Params, Serializable, Serializable, Identifiable, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. AssertionChunkConverter
  2. CheckLicense
  3. HasOutputAnnotatorType
  4. HasOutputAnnotationCol
  5. HasInputAnnotationCols
  6. DefaultParamsWritable
  7. MLWritable
  8. Transformer
  9. PipelineStage
  10. Logging
  11. Params
  12. Serializable
  13. Serializable
  14. Identifiable
  15. AnyRef
  16. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new AssertionChunkConverter()
  2. new AssertionChunkConverter(uid: String)

    uid

    a unique identifier for the instantiated AnnotatorModel

Type Members

  1. type AnnotatorType = String
    Definition Classes
    HasOutputAnnotatorType

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def $[T](param: Param[T]): T
    Attributes
    protected
    Definition Classes
    Params
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. final def checkSchema(schema: StructType, inputAnnotatorType: String): Boolean
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  7. def checkValidEnvironment(spark: Option[SparkSession], scopes: Seq[String]): Unit
    Definition Classes
    CheckLicense
  8. def checkValidScope(scope: String): Unit
    Definition Classes
    CheckLicense
  9. def checkValidScopeAndEnvironment(scope: String, spark: Option[SparkSession], checkLp: Boolean): Unit
    Definition Classes
    CheckLicense
  10. def checkValidScopesAndEnvironment(scopes: Seq[String], spark: Option[SparkSession], checkLp: Boolean): Unit
    Definition Classes
    CheckLicense
  11. val chunkBeginCol: Param[String]

    Name of the column containing the start index of the chunk

  12. val chunkEndCol: Param[String]

    Name of the column containing the end index of the chunk

  13. val chunkTextCol: Param[String]

    Name of the column containing the text chunk

  14. final def clear(param: Param[_]): AssertionChunkConverter.this.type
    Definition Classes
    Params
  15. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  16. def copy(extra: ParamMap): AssertionChunkConverter
    Definition Classes
    AssertionChunkConverter → Transformer → PipelineStage → Params
  17. def copyValues[T <: Params](to: T, extra: ParamMap): T
    Attributes
    protected
    Definition Classes
    Params
  18. final def defaultCopy[T <: Params](extra: ParamMap): T
    Attributes
    protected
    Definition Classes
    Params
  19. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  21. def explainParam(param: Param[_]): String
    Definition Classes
    Params
  22. def explainParams(): String
    Definition Classes
    Params
  23. final def extractParamMap(): ParamMap
    Definition Classes
    Params
  24. final def extractParamMap(extra: ParamMap): ParamMap
    Definition Classes
    Params
  25. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. final def get[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  27. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  28. final def getDefault[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  29. def getInputCols: Array[String]
    Definition Classes
    HasInputAnnotationCols
  30. final def getOrDefault[T](param: Param[T]): T
    Definition Classes
    Params
  31. final def getOutputCol: String
    Definition Classes
    HasOutputAnnotationCol
  32. def getParam(paramName: String): Param[Any]
    Definition Classes
    Params
  33. final def hasDefault[T](param: Param[T]): Boolean
    Definition Classes
    Params
  34. def hasParam(paramName: String): Boolean
    Definition Classes
    Params
  35. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  36. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  37. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  38. val inputAnnotatorTypes: Array[String]

    Input Annotator Type : DOCUMENT, TOKEN, NAMED_ENTITY

    Input Annotator Type : DOCUMENT, TOKEN, NAMED_ENTITY

    Definition Classes
    AssertionChunkConverter → HasInputAnnotationCols
  39. final val inputCols: StringArrayParam
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  40. final def isDefined(param: Param[_]): Boolean
    Definition Classes
    Params
  41. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  42. final def isSet(param: Param[_]): Boolean
    Definition Classes
    Params
  43. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  44. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  45. def logDebug(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  46. def logDebug(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  47. def logError(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  48. def logError(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  49. def logInfo(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  50. def logInfo(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  51. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  52. def logTrace(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  53. def logTrace(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  54. def logWarning(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  55. def logWarning(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  56. def msgHelper(schema: StructType): String
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  57. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  58. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  59. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  60. val optionalInputAnnotatorTypes: Array[String]
    Definition Classes
    HasInputAnnotationCols
  61. val outputAnnotatorType: AnnotatorType

    Output Annotator Type : CHUNK

    Output Annotator Type : CHUNK

    Definition Classes
    AssertionChunkConverter → HasOutputAnnotatorType
  62. final val outputCol: Param[String]
    Attributes
    protected
    Definition Classes
    HasOutputAnnotationCol
  63. val outputTokenBeginCol: Param[String]

    Name of the column containing selected token start

  64. val outputTokenEndCol: Param[String]

    Name of the column containing selected token end index

  65. lazy val params: Array[Param[_]]
    Definition Classes
    Params
  66. def save(path: String): Unit
    Definition Classes
    MLWritable
    Annotations
    @Since( "1.6.0" ) @throws( ... )
  67. final def set(paramPair: ParamPair[_]): AssertionChunkConverter.this.type
    Attributes
    protected
    Definition Classes
    Params
  68. final def set(param: String, value: Any): AssertionChunkConverter.this.type
    Attributes
    protected
    Definition Classes
    Params
  69. final def set[T](param: Param[T], value: T): AssertionChunkConverter.this.type
    Definition Classes
    Params
  70. def setChunkBeginCol(col: String): AssertionChunkConverter.this.type

    Sets the name of the column containing the start of the chunk

  71. def setChunkEndCol(col: String): AssertionChunkConverter.this.type

    Sets the name of the column containing the end of the chunk

  72. def setChunkTextCol(col: String): AssertionChunkConverter.this.type

    Sets the name of the column containing the text chunk

  73. final def setDefault(paramPairs: ParamPair[_]*): AssertionChunkConverter.this.type
    Attributes
    protected
    Definition Classes
    Params
  74. final def setDefault[T](param: Param[T], value: T): AssertionChunkConverter.this.type
    Attributes
    protected
    Definition Classes
    Params
  75. final def setInputCols(value: String*): AssertionChunkConverter.this.type
    Definition Classes
    HasInputAnnotationCols
  76. def setInputCols(value: Array[String]): AssertionChunkConverter.this.type
    Definition Classes
    HasInputAnnotationCols
  77. final def setOutputCol(value: String): AssertionChunkConverter.this.type
    Definition Classes
    HasOutputAnnotationCol
  78. def setOutputTokenBeginCol(col: String): AssertionChunkConverter.this.type

    Sets the name of the column containing selected token start

  79. def setOutputTokenEndCol(col: String): AssertionChunkConverter.this.type

    Sets the name of the column containing selected token end

  80. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  81. def toString(): String
    Definition Classes
    Identifiable → AnyRef → Any
  82. def transform(dataset: Dataset[_]): DataFrame
    Definition Classes
    AssertionChunkConverter → Transformer
  83. def transform(dataset: Dataset[_], paramMap: ParamMap): DataFrame
    Definition Classes
    Transformer
    Annotations
    @Since( "2.0.0" )
  84. def transform(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): DataFrame
    Definition Classes
    Transformer
    Annotations
    @Since( "2.0.0" ) @varargs()
  85. final def transformSchema(schema: StructType): StructType
    Definition Classes
    AssertionChunkConverter → PipelineStage
  86. def transformSchema(schema: StructType, logging: Boolean): StructType
    Attributes
    protected
    Definition Classes
    PipelineStage
    Annotations
    @DeveloperApi()
  87. val uid: String
    Definition Classes
    AssertionChunkConverter → Identifiable
  88. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  89. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  90. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  91. def write: MLWriter
    Definition Classes
    DefaultParamsWritable → MLWritable

Inherited from CheckLicense

Inherited from HasOutputAnnotatorType

Inherited from HasOutputAnnotationCol

Inherited from HasInputAnnotationCols

Inherited from DefaultParamsWritable

Inherited from MLWritable

Inherited from Transformer

Inherited from PipelineStage

Inherited from Logging

Inherited from Params

Inherited from Serializable

Inherited from Serializable

Inherited from Identifiable

Inherited from AnyRef

Inherited from Any

Parameters

Annotator types

Required input and expected output annotator types

Members

Parameter setters