Packages

class ChunkTokenizer extends Tokenizer

Tokenizes and flattens extracted NER chunks.

The ChunkTokenizer will split the extracted NER CHUNK type Annotations and will create TOKEN type Annotations. The result is then flattened, resulting in a single array.

For extended examples of usage, see the ChunkTokenizerTestSpec.

Example

import spark.implicits._
import com.johnsnowlabs.nlp.DocumentAssembler
import com.johnsnowlabs.nlp.annotators.{ChunkTokenizer, TextMatcher, Tokenizer}
import com.johnsnowlabs.nlp.annotators.sbd.pragmatic.SentenceDetector
import com.johnsnowlabs.nlp.util.io.ReadAs
import org.apache.spark.ml.Pipeline

val documentAssembler = new DocumentAssembler()
  .setInputCol("text")
  .setOutputCol("document")

val sentenceDetector = new SentenceDetector()
  .setInputCols(Array("document"))
  .setOutputCol("sentence")

val tokenizer = new Tokenizer()
  .setInputCols(Array("sentence"))
  .setOutputCol("token")

val entityExtractor = new TextMatcher()
  .setInputCols("sentence", "token")
  .setEntities("src/test/resources/entity-extractor/test-chunks.txt", ReadAs.TEXT)
  .setOutputCol("entity")

val chunkTokenizer = new ChunkTokenizer()
  .setInputCols("entity")
  .setOutputCol("chunk_token")

val pipeline = new Pipeline().setStages(Array(
    documentAssembler,
    sentenceDetector,
    tokenizer,
    entityExtractor,
    chunkTokenizer
  ))

val data = Seq(
  "Hello world, my name is Michael, I am an artist and I work at Benezar",
  "Robert, an engineer from Farendell, graduated last year. The other one, Lucas, graduated last week."
).toDF("text")
val result = pipeline.fit(data).transform(data)

result.selectExpr("entity.result as entity" , "chunk_token.result as chunk_token").show(false)
+-----------------------------------------------+---------------------------------------------------+
|entity                                         |chunk_token                                        |
+-----------------------------------------------+---------------------------------------------------+
|[world, Michael, work at Benezar]              |[world, Michael, work, at, Benezar]                |
|[engineer from Farendell, last year, last week]|[engineer, from, Farendell, last, year, last, week]|
+-----------------------------------------------+---------------------------------------------------+
Linear Supertypes
Tokenizer, AnnotatorApproach[TokenizerModel], CanBeLazy, DefaultParamsWritable, MLWritable, HasOutputAnnotatorType, HasOutputAnnotationCol, HasInputAnnotationCols, Estimator[TokenizerModel], PipelineStage, Logging, Params, Serializable, Serializable, Identifiable, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. ChunkTokenizer
  2. Tokenizer
  3. AnnotatorApproach
  4. CanBeLazy
  5. DefaultParamsWritable
  6. MLWritable
  7. HasOutputAnnotatorType
  8. HasOutputAnnotationCol
  9. HasInputAnnotationCols
  10. Estimator
  11. PipelineStage
  12. Logging
  13. Params
  14. Serializable
  15. Serializable
  16. Identifiable
  17. AnyRef
  18. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

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

    uid

    required internal uid for saving annotator

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. def _fit(dataset: Dataset[_], recursiveStages: Option[PipelineModel]): TokenizerModel
    Attributes
    protected
    Definition Classes
    AnnotatorApproach
  6. def addContextChars(v: String): ChunkTokenizer.this.type

    Add one character string to rip off from tokens, such as parenthesis or question marks.

    Add one character string to rip off from tokens, such as parenthesis or question marks. Ignored if using prefix, infix or suffix patterns.

    Definition Classes
    Tokenizer
  7. def addException(value: String): ChunkTokenizer.this.type

    Add a single exception

    Add a single exception

    Definition Classes
    Tokenizer
  8. def addInfixPattern(value: String): ChunkTokenizer.this.type

    Add an extension pattern regex with groups to the top of thsetExceptionse rules (will target first, from more specific to the more general).

    Add an extension pattern regex with groups to the top of thsetExceptionse rules (will target first, from more specific to the more general).

    Definition Classes
    Tokenizer
  9. def addSplitChars(v: String): ChunkTokenizer.this.type

    One character string to split tokens inside, such as hyphens.

    One character string to split tokens inside, such as hyphens. Ignored if using infix, prefix or suffix patterns.

    Definition Classes
    Tokenizer
  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. def beforeTraining(spark: SparkSession): Unit
    Definition Classes
    AnnotatorApproach
  12. def buildRuleFactory: RuleFactory

    Build rule factory which combines all defined parameters to build regex that is applied to tokens

    Build rule factory which combines all defined parameters to build regex that is applied to tokens

    Definition Classes
    Tokenizer
  13. val caseSensitiveExceptions: BooleanParam

    Whether to care for case sensitiveness in exceptions (Default: true)

    Whether to care for case sensitiveness in exceptions (Default: true)

    Definition Classes
    Tokenizer
  14. final def checkSchema(schema: StructType, inputAnnotatorType: String): Boolean
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  15. final def clear(param: Param[_]): ChunkTokenizer.this.type
    Definition Classes
    Params
  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  17. val contextChars: StringArrayParam

    Character list used to separate from token boundaries (Default: Array(".", ",", ";", ":", "!", "?", "*", "-", "(", ")", "\"", "'"))

    Character list used to separate from token boundaries (Default: Array(".", ",", ";", ":", "!", "?", "*", "-", "(", ")", "\"", "'"))

    Definition Classes
    Tokenizer
  18. final def copy(extra: ParamMap): Estimator[TokenizerModel]
    Definition Classes
    AnnotatorApproach → Estimator → PipelineStage → Params
  19. def copyValues[T <: Params](to: T, extra: ParamMap): T
    Attributes
    protected
    Definition Classes
    Params
  20. final def defaultCopy[T <: Params](extra: ParamMap): T
    Attributes
    protected
    Definition Classes
    Params
  21. val description: String

    Annotator that identifies points of analysis in a useful manner

    Annotator that identifies points of analysis in a useful manner

    Definition Classes
    TokenizerAnnotatorApproach
  22. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  24. val exceptions: StringArrayParam

    Words that won't be affected by tokenization rules

    Words that won't be affected by tokenization rules

    Definition Classes
    Tokenizer
  25. val exceptionsPath: ExternalResourceParam

    Path to file containing list of exceptions

    Path to file containing list of exceptions

    Definition Classes
    Tokenizer
  26. def explainParam(param: Param[_]): String
    Definition Classes
    Params
  27. def explainParams(): String
    Definition Classes
    Params
  28. final def extractParamMap(): ParamMap
    Definition Classes
    Params
  29. final def extractParamMap(extra: ParamMap): ParamMap
    Definition Classes
    Params
  30. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  31. final def fit(dataset: Dataset[_]): TokenizerModel
    Definition Classes
    AnnotatorApproach → Estimator
  32. def fit(dataset: Dataset[_], paramMaps: Seq[ParamMap]): Seq[TokenizerModel]
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  33. def fit(dataset: Dataset[_], paramMap: ParamMap): TokenizerModel
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  34. def fit(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): TokenizerModel
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" ) @varargs()
  35. final def get[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  36. def getCaseSensitiveExceptions(value: Boolean): Boolean

    Whether to follow case sensitiveness for matching exceptions in text

    Whether to follow case sensitiveness for matching exceptions in text

    Definition Classes
    Tokenizer
  37. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  38. def getContextChars: Array[String]

    List of 1 character string to rip off from tokens, such as parenthesis or question marks.

    List of 1 character string to rip off from tokens, such as parenthesis or question marks. Ignored if using prefix, infix or suffix patterns.

    Definition Classes
    Tokenizer
  39. final def getDefault[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  40. def getExceptions: Array[String]

    Definition Classes
    Tokenizer
  41. def getInfixPatterns: Array[String]

    Add an extension pattern regex with groups to the top of the rules (will target first, from more specific to the more general).

    Add an extension pattern regex with groups to the top of the rules (will target first, from more specific to the more general).

    Definition Classes
    Tokenizer
  42. def getInputCols: Array[String]

    returns

    input annotations columns currently used

    Definition Classes
    HasInputAnnotationCols
  43. def getLazyAnnotator: Boolean
    Definition Classes
    CanBeLazy
  44. def getMaxLength(value: Int): Int

    Get the maximum allowed length for each token

    Get the maximum allowed length for each token

    Definition Classes
    Tokenizer
  45. def getMinLength(value: Int): Int

    Get the minimum allowed length for each token

    Get the minimum allowed length for each token

    Definition Classes
    Tokenizer
  46. final def getOrDefault[T](param: Param[T]): T
    Definition Classes
    Params
  47. final def getOutputCol: String

    Gets annotation column name going to generate

    Gets annotation column name going to generate

    Definition Classes
    HasOutputAnnotationCol
  48. def getParam(paramName: String): Param[Any]
    Definition Classes
    Params
  49. def getPrefixPattern: String

    Regex to identify subtokens that come in the beginning of the token.

    Regex to identify subtokens that come in the beginning of the token. Regex has to start with \\A and must contain groups (). Each group will become a separate token within the prefix. Defaults to non-letter characters. e.g. quotes or parenthesis

    Definition Classes
    Tokenizer
  50. def getSplitChars: Array[String]

    List of 1 character string to split tokens inside, such as hyphens.

    List of 1 character string to split tokens inside, such as hyphens. Ignored if using infix, prefix or suffix patterns.

    Definition Classes
    Tokenizer
  51. def getSplitPattern: String

    List of 1 character string to split tokens inside, such as hyphens.

    List of 1 character string to split tokens inside, such as hyphens. Ignored if using infix, prefix or suffix patterns.

    Definition Classes
    Tokenizer
  52. def getSuffixPattern: String

    Regex to identify subtokens that are in the end of the token.

    Regex to identify subtokens that are in the end of the token. Regex has to end with \\z and must contain groups (). Each group will become a separate token within the prefix. Defaults to non-letter characters. e.g. quotes or parenthesis

    Definition Classes
    Tokenizer
  53. def getTargetPattern: String

    Basic regex rule to identify a candidate for tokenization.

    Basic regex rule to identify a candidate for tokenization. Defaults to \\S+ which means anything not a space

    Definition Classes
    Tokenizer
  54. final def hasDefault[T](param: Param[T]): Boolean
    Definition Classes
    Params
  55. def hasParam(paramName: String): Boolean
    Definition Classes
    Params
  56. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  57. val infixPatterns: StringArrayParam

    Regex patterns that match tokens within a single target.

    Regex patterns that match tokens within a single target. groups identify different sub-tokens. multiple defaults

    Infix patterns must use regex group. Notice each group will result in separate token

    Example:

    import org.apache.spark.ml.Pipeline
    import com.johnsnowlabs.nlp.annotators.Tokenizer
    import com.johnsnowlabs.nlp.DocumentAssembler
    
    val textDf = sqlContext.sparkContext.parallelize(Array("l'une d'un l'un, des l'extrême des l'extreme")).toDF("text")
    val documentAssembler = new DocumentAssembler().setInputCol("text").setOutputCol("sentences")
    val tokenizer = new Tokenizer().setInputCols("sentences").setOutputCol("tokens").setInfixPatterns(Array("([\\p{L}\\w]+'{1})([\\p{L}\\w]+)"))
    new Pipeline().setStages(Array(documentAssembler, tokenizer)).fit(textDf).transform(textDf).select("tokens.result").show(false)

    This will yield: l', une, d', un, l', un, , , des, l', extrême, des, l', extreme

    Definition Classes
    Tokenizer
  58. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  59. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  60. val inputAnnotatorTypes: Array[AnnotatorType]

    Input Annotator Type : CHUNK

    Input Annotator Type : CHUNK

    Definition Classes
    ChunkTokenizerTokenizerHasInputAnnotationCols
  61. final val inputCols: StringArrayParam

    columns that contain annotations necessary to run this annotator AnnotatorType is used both as input and output columns if not specified

    columns that contain annotations necessary to run this annotator AnnotatorType is used both as input and output columns if not specified

    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  62. final def isDefined(param: Param[_]): Boolean
    Definition Classes
    Params
  63. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  64. final def isSet(param: Param[_]): Boolean
    Definition Classes
    Params
  65. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  66. val lazyAnnotator: BooleanParam
    Definition Classes
    CanBeLazy
  67. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  68. def logDebug(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  69. def logDebug(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  70. def logError(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  71. def logError(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  72. def logInfo(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  73. def logInfo(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  74. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  75. def logTrace(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  76. def logTrace(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  77. def logWarning(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  78. def logWarning(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  79. val maxLength: IntParam

    Set the maximum allowed length for each token

    Set the maximum allowed length for each token

    Definition Classes
    Tokenizer
  80. val minLength: IntParam

    Set the minimum allowed length for each token

    Set the minimum allowed length for each token

    Definition Classes
    Tokenizer
  81. def msgHelper(schema: StructType): String
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  82. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  83. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  84. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  85. def onTrained(model: TokenizerModel, spark: SparkSession): Unit
    Definition Classes
    AnnotatorApproach
  86. val optionalInputAnnotatorTypes: Array[String]
    Definition Classes
    HasInputAnnotationCols
  87. val outputAnnotatorType: AnnotatorType

    Output Annotator Type : TOKEN

    Output Annotator Type : TOKEN

    Definition Classes
    ChunkTokenizerTokenizerHasOutputAnnotatorType
  88. final val outputCol: Param[String]
    Attributes
    protected
    Definition Classes
    HasOutputAnnotationCol
  89. lazy val params: Array[Param[_]]
    Definition Classes
    Params
  90. val prefixPattern: Param[String]

    Regex with groups and begins with \\A to match target prefix.

    Regex with groups and begins with \\A to match target prefix. Overrides contextCharacters Param

    Definition Classes
    Tokenizer
  91. def save(path: String): Unit
    Definition Classes
    MLWritable
    Annotations
    @Since( "1.6.0" ) @throws( ... )
  92. final def set(paramPair: ParamPair[_]): ChunkTokenizer.this.type
    Attributes
    protected
    Definition Classes
    Params
  93. final def set(param: String, value: Any): ChunkTokenizer.this.type
    Attributes
    protected
    Definition Classes
    Params
  94. final def set[T](param: Param[T], value: T): ChunkTokenizer.this.type
    Definition Classes
    Params
  95. def setCaseSensitiveExceptions(value: Boolean): ChunkTokenizer.this.type

    Whether to follow case sensitiveness for matching exceptions in text

    Whether to follow case sensitiveness for matching exceptions in text

    Definition Classes
    Tokenizer
  96. def setContextChars(v: Array[String]): ChunkTokenizer.this.type

    List of 1 character string to rip off from tokens, such as parenthesis or question marks.

    List of 1 character string to rip off from tokens, such as parenthesis or question marks. Ignored if using prefix, infix or suffix patterns.

    Definition Classes
    Tokenizer
  97. final def setDefault(paramPairs: ParamPair[_]*): ChunkTokenizer.this.type
    Attributes
    protected
    Definition Classes
    Params
  98. final def setDefault[T](param: Param[T], value: T): ChunkTokenizer.this.type
    Attributes
    protected[org.apache.spark.ml]
    Definition Classes
    Params
  99. def setExceptions(value: Array[String]): ChunkTokenizer.this.type

    List of tokens to not alter at all.

    List of tokens to not alter at all. Allows composite tokens like two worded tokens that the user may not want to split.

    Definition Classes
    Tokenizer
  100. def setExceptionsPath(path: String, readAs: Format = ReadAs.TEXT, options: Map[String, String] = Map("format" -> "text")): ChunkTokenizer.this.type

    Path to txt file with list of token exceptions

    Path to txt file with list of token exceptions

    Definition Classes
    Tokenizer
  101. def setInfixPatterns(value: Array[String]): ChunkTokenizer.this.type

    Set a list of Regex patterns that match tokens within a single target.

    Set a list of Regex patterns that match tokens within a single target. Groups identify different sub-tokens. multiple defaults

    Definition Classes
    Tokenizer
  102. final def setInputCols(value: String*): ChunkTokenizer.this.type
    Definition Classes
    HasInputAnnotationCols
  103. def setInputCols(value: Array[String]): ChunkTokenizer.this.type

    Overrides required annotators column if different than default

    Overrides required annotators column if different than default

    Definition Classes
    HasInputAnnotationCols
  104. def setLazyAnnotator(value: Boolean): ChunkTokenizer.this.type
    Definition Classes
    CanBeLazy
  105. def setMaxLength(value: Int): ChunkTokenizer.this.type

    Get the maximum allowed length for each token

    Get the maximum allowed length for each token

    Definition Classes
    Tokenizer
  106. def setMinLength(value: Int): ChunkTokenizer.this.type

    Set the minimum allowed length for each token

    Set the minimum allowed length for each token

    Definition Classes
    Tokenizer
  107. final def setOutputCol(value: String): ChunkTokenizer.this.type

    Overrides annotation column name when transforming

    Overrides annotation column name when transforming

    Definition Classes
    HasOutputAnnotationCol
  108. def setPrefixPattern(value: String): ChunkTokenizer.this.type

    Regex to identify subtokens that come in the beginning of the token.

    Regex to identify subtokens that come in the beginning of the token. Regex has to start with \\A and must contain groups (). Each group will become a separate token within the prefix. Defaults to non-letter characters. e.g. quotes or parenthesis

    Definition Classes
    Tokenizer
  109. def setSplitChars(v: Array[String]): ChunkTokenizer.this.type

    List of 1 character string to split tokens inside, such as hyphens.

    List of 1 character string to split tokens inside, such as hyphens. Ignored if using infix, prefix or suffix patterns.

    Definition Classes
    Tokenizer
  110. def setSplitPattern(value: String): ChunkTokenizer.this.type

    Regex pattern to separate from the inside of tokens.

    Regex pattern to separate from the inside of tokens. Takes priority over splitChars.

    Definition Classes
    Tokenizer
  111. def setSuffixPattern(value: String): ChunkTokenizer.this.type

    Regex to identify subtokens that are in the end of the token.

    Regex to identify subtokens that are in the end of the token. Regex has to end with \\z and must contain groups (). Each group will become a separate token within the prefix. Defaults to non-letter characters. e.g. quotes or parenthesis

    Definition Classes
    Tokenizer
  112. def setTargetPattern(value: String): ChunkTokenizer.this.type

    Set a basic regex rule to identify token candidates in text.

    Set a basic regex rule to identify token candidates in text.

    Definition Classes
    Tokenizer
  113. val splitChars: StringArrayParam

    Character list used to separate from the inside of tokens

    Character list used to separate from the inside of tokens

    Definition Classes
    Tokenizer
  114. val splitPattern: Param[String]

    Pattern to separate from the inside of tokens.

    Pattern to separate from the inside of tokens. takes priority over splitChars.

    This pattern will be applied to the tokens which where extracted with the target pattern previously

    Example:

    import org.apache.spark.ml.Pipeline
    
    import com.johnsnowlabs.nlp.annotators.Tokenizer
    
    import com.johnsnowlabs.nlp.DocumentAssembler
    
    val textDf = sqlContext.sparkContext.parallelize(Array("Tokens in this-text will#be#split on hashtags-and#dashes")).toDF("text")
    
    val documentAssembler = new DocumentAssembler().setInputCol("text").setOutputCol("sentences")
    
    val tokenizer = new Tokenizer().setInputCols("sentences").setOutputCol("tokens").setSplitPattern("-|#")
    
    new Pipeline().setStages(Array(documentAssembler, tokenizer)).fit(textDf).transform(textDf).select("tokens.result").show(false)

    This will yield: Tokens, in, this, text, will, be, split, on, hashtags, and, dashes

    Definition Classes
    Tokenizer
  115. val suffixPattern: Param[String]

    Regex with groups and ends with \\z to match target suffix.

    Regex with groups and ends with \\z to match target suffix. Overrides contextCharacters Param

    Definition Classes
    Tokenizer
  116. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  117. val targetPattern: Param[String]

    Pattern to grab from text as token candidates.

    Pattern to grab from text as token candidates. (Default: "\\S+")

    Defaults to: "\\S+" which means anything not a space will be matched and considered as a token candidate, This will cause text to be split on on white spaces to yield token candidates.

    This rule will be added to the BREAK_PATTERN varaible, which is used to yield token candidates.

    import org.apache.spark.ml.Pipeline
    import com.johnsnowlabs.nlp.annotators.Tokenizer
    import com.johnsnowlabs.nlp.DocumentAssembler
    
    val textDf = sqlContext.sparkContext.parallelize(Array("I only consider lowercase characters and NOT UPPERCASED and only the numbers 0,1, to 7 as tokens but not 8 or 9")).toDF("text")
    val documentAssembler = new DocumentAssembler().setInputCol("text").setOutputCol("sentences")
    val tokenizer = new Tokenizer().setInputCols("sentences").setOutputCol("tokens").setTargetPattern("a-z-0-7")
    new Pipeline().setStages(Array(documentAssembler, tokenizer)).fit(textDf).transform(textDf).select("tokens.result").show(false)

    This will yield: only, consider, lowercase, characters, and, and, only, the, numbers, 0, 1, to, 7, as, tokens, but, not, or

    Definition Classes
    Tokenizer
  118. def toString(): String
    Definition Classes
    Identifiable → AnyRef → Any
  119. def train(dataset: Dataset[_], recursivePipeline: Option[PipelineModel]): TokenizerModel

    Clears out rules and constructs a new rule for every combination of rules provided .

    Clears out rules and constructs a new rule for every combination of rules provided . The strategy is to catch one token per regex group. User may add its own groups if needs targets to be tokenized separately from the rest

    Definition Classes
    ChunkTokenizerTokenizerAnnotatorApproach
  120. final def transformSchema(schema: StructType): StructType

    requirement for pipeline transformation validation.

    requirement for pipeline transformation validation. It is called on fit()

    Definition Classes
    AnnotatorApproach → PipelineStage
  121. def transformSchema(schema: StructType, logging: Boolean): StructType
    Attributes
    protected
    Definition Classes
    PipelineStage
    Annotations
    @DeveloperApi()
  122. val uid: String
    Definition Classes
    ChunkTokenizerTokenizer → Identifiable
  123. def validate(schema: StructType): Boolean

    takes a Dataset and checks to see if all the required annotation types are present.

    takes a Dataset and checks to see if all the required annotation types are present.

    schema

    to be validated

    returns

    True if all the required types are present, else false

    Attributes
    protected
    Definition Classes
    AnnotatorApproach
  124. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  125. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  126. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  127. def write: MLWriter
    Definition Classes
    DefaultParamsWritable → MLWritable

Inherited from Tokenizer

Inherited from CanBeLazy

Inherited from DefaultParamsWritable

Inherited from MLWritable

Inherited from HasOutputAnnotatorType

Inherited from HasOutputAnnotationCol

Inherited from HasInputAnnotationCols

Inherited from Estimator[TokenizerModel]

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

A list of (hyper-)parameter keys this annotator can take. Users can set and get the parameter values through setters and getters, respectively.

Annotator types

Required input and expected output annotator types

Members

Parameter setters

Parameter getters