class Reader2Table extends Reader2Doc

The Reader2Table annotator allows you to use the reading files more smoothly within existing Spark NLP workflows, enabling seamless reuse of your pipelines. Reader2Doc can be used for extracting structured content from various document types using Spark NLP readers. It supports reading from many files types and returns parsed output as a structured Spark DataFrame.

Supported formats include plain text, HTML, Word (.doc/.docx), Excel (.xls/.xlsx), PowerPoint (.ppt/.pptx)

Example

import com.johnsnowlabs.reader.Reader2Table
import com. johnsnowlabs.nlp.base.DocumentAssembler
import org.apache.spark.ml.Pipeline

val reader2Table = new Reader2Table()
  .setContentType("application/csv")
  .setContentPath(s"$pdfDirectory/")

val pipeline = new Pipeline()
  .setStages(Array(reader2Table))

val pipelineModel = pipeline.fit(emptyDataSet)
val resultDf = pipelineModel.transform(emptyDataSet)

resultDf.show()
+----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|fileName        |document                                                                                                                                                                                    |
+----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|stanley-cups.csv|[{document, 0, 137, {"caption":"","header":[],"rows":[["Team","Location","Stanley Cups"],["Blues","STL","1"],["Flyers","PHI","2"],["Maple Leafs","TOR","13"]]}, {elementType -> Table}, []}]|
+----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Linear Supertypes
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. Reader2Table
  2. Reader2Doc
  3. HasXmlReaderProperties
  4. HasTextReaderProperties
  5. HasPowerPointProperties
  6. HasHTMLReaderProperties
  7. HasExcelReaderProperties
  8. HasEmailReaderProperties
  9. HasReaderProperties
  10. ParamsAndFeaturesWritable
  11. HasFeatures
  12. HasOutputAnnotationCol
  13. HasOutputAnnotatorType
  14. DefaultParamsWritable
  15. MLWritable
  16. Transformer
  17. PipelineStage
  18. Logging
  19. Params
  20. Serializable
  21. Serializable
  22. Identifiable
  23. AnyRef
  24. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

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

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. def $$[T](feature: StructFeature[T]): T
    Attributes
    protected
    Definition Classes
    HasFeatures
  5. def $$[K, V](feature: MapFeature[K, V]): Map[K, V]
    Attributes
    protected
    Definition Classes
    HasFeatures
  6. def $$[T](feature: SetFeature[T]): Set[T]
    Attributes
    protected
    Definition Classes
    HasFeatures
  7. def $$[T](feature: ArrayFeature[T]): Array[T]
    Attributes
    protected
    Definition Classes
    HasFeatures
  8. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. val addAttachmentContent: Param[Boolean]
    Definition Classes
    HasEmailReaderProperties
  10. val appendCells: Param[Boolean]
    Definition Classes
    HasExcelReaderProperties
  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. val cellSeparator: Param[String]
    Definition Classes
    HasExcelReaderProperties
  13. final def clear(param: Param[_]): Reader2Table.this.type
    Definition Classes
    Params
  14. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  15. val contentPath: Param[String]
    Definition Classes
    HasReaderProperties
  16. val contentType: Param[String]
    Definition Classes
    HasReaderProperties
  17. def copy(extra: ParamMap): Transformer
    Definition Classes
    Reader2Doc → Transformer → PipelineStage → Params
  18. def copyValues[T <: Params](to: T, extra: ParamMap): T
    Attributes
    protected
    Definition Classes
    Params
  19. final def defaultCopy[T <: Params](extra: ParamMap): T
    Attributes
    protected
    Definition Classes
    Params
  20. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  22. val excludeNonText: BooleanParam
    Definition Classes
    Reader2Doc
  23. def explainParam(param: Param[_]): String
    Definition Classes
    Params
  24. def explainParams(): String
    Definition Classes
    Params
  25. val explodeDocs: BooleanParam
    Definition Classes
    Reader2Doc
  26. final def extractParamMap(): ParamMap
    Definition Classes
    Params
  27. final def extractParamMap(extra: ParamMap): ParamMap
    Definition Classes
    Params
  28. val features: ArrayBuffer[Feature[_, _, _]]
    Definition Classes
    HasFeatures
  29. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  30. val flattenOutput: BooleanParam
    Definition Classes
    Reader2Doc
  31. def get[T](feature: StructFeature[T]): Option[T]
    Attributes
    protected
    Definition Classes
    HasFeatures
  32. def get[K, V](feature: MapFeature[K, V]): Option[Map[K, V]]
    Attributes
    protected
    Definition Classes
    HasFeatures
  33. def get[T](feature: SetFeature[T]): Option[Set[T]]
    Attributes
    protected
    Definition Classes
    HasFeatures
  34. def get[T](feature: ArrayFeature[T]): Option[Array[T]]
    Attributes
    protected
    Definition Classes
    HasFeatures
  35. final def get[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  36. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  37. final def getDefault[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  38. final def getOrDefault[T](param: Param[T]): T
    Definition Classes
    Params
  39. final def getOutputCol: String

    Gets annotation column name going to generate

    Gets annotation column name going to generate

    Definition Classes
    HasOutputAnnotationCol
  40. def getParam(paramName: String): Param[Any]
    Definition Classes
    Params
  41. val groupBrokenParagraphs: Param[Boolean]
    Definition Classes
    HasTextReaderProperties
  42. final def hasDefault[T](param: Param[T]): Boolean
    Definition Classes
    Params
  43. def hasParam(paramName: String): Boolean
    Definition Classes
    Params
  44. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  45. val headers: Param[Map[String, String]]
    Definition Classes
    HasHTMLReaderProperties
  46. val includePageBreaks: Param[Boolean]
    Definition Classes
    HasReaderProperties
  47. val includeSlideNotes: Param[Boolean]
    Definition Classes
    HasPowerPointProperties
  48. val includeTitleTag: Param[Boolean]
    Definition Classes
    HasHTMLReaderProperties
  49. val inferTableStructure: Param[Boolean]
    Definition Classes
    HasReaderProperties
  50. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  51. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  52. final def isDefined(param: Param[_]): Boolean
    Definition Classes
    Params
  53. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  54. final def isSet(param: Param[_]): Boolean
    Definition Classes
    Params
  55. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  56. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  57. def logDebug(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  58. def logDebug(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  59. def logError(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  60. def logError(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  61. def logInfo(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  62. def logInfo(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  63. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  64. def logTrace(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  65. def logTrace(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  66. def logWarning(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  67. def logWarning(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  68. val maxLineCount: Param[Int]
    Definition Classes
    HasTextReaderProperties
  69. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  70. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  71. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  72. def onWrite(path: String, spark: SparkSession): Unit
    Attributes
    protected
    Definition Classes
    ParamsAndFeaturesWritable
  73. val onlyLeafNodes: Param[Boolean]
    Definition Classes
    HasXmlReaderProperties
  74. val outputAnnotatorType: AnnotatorType
    Definition Classes
    Reader2DocHasOutputAnnotatorType
  75. val outputAsDocument: BooleanParam

    Whether to return all sentences joined into a single document

    Whether to return all sentences joined into a single document

    Definition Classes
    Reader2Doc
  76. final val outputCol: Param[String]
    Attributes
    protected
    Definition Classes
    HasOutputAnnotationCol
  77. val outputFormat: Param[String]
    Definition Classes
    HasHTMLReaderProperties
  78. val paragraphSplit: Param[String]
    Definition Classes
    HasTextReaderProperties
  79. lazy val params: Array[Param[_]]
    Definition Classes
    Params
  80. def partitionBuilder: Partition
    Attributes
    protected
    Definition Classes
    Reader2Doc
  81. def partitionToAnnotation: UserDefinedFunction
    Definition Classes
    Reader2TableReader2Doc
  82. def save(path: String): Unit
    Definition Classes
    MLWritable
    Annotations
    @Since( "1.6.0" ) @throws( ... )
  83. def set[T](feature: StructFeature[T], value: T): Reader2Table.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  84. def set[K, V](feature: MapFeature[K, V], value: Map[K, V]): Reader2Table.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  85. def set[T](feature: SetFeature[T], value: Set[T]): Reader2Table.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  86. def set[T](feature: ArrayFeature[T], value: Array[T]): Reader2Table.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  87. final def set(paramPair: ParamPair[_]): Reader2Table.this.type
    Attributes
    protected
    Definition Classes
    Params
  88. final def set(param: String, value: Any): Reader2Table.this.type
    Attributes
    protected
    Definition Classes
    Params
  89. final def set[T](param: Param[T], value: T): Reader2Table.this.type
    Definition Classes
    Params
  90. def setAddAttachmentContent(value: Boolean): Reader2Table.this.type
    Definition Classes
    HasEmailReaderProperties
  91. def setAppendCells(value: Boolean): Reader2Table.this.type
    Definition Classes
    HasExcelReaderProperties
  92. def setCellSeparator(value: String): Reader2Table.this.type
    Definition Classes
    HasExcelReaderProperties
  93. def setContentPath(value: String): Reader2Table.this.type
    Definition Classes
    HasReaderProperties
  94. def setContentType(value: String): Reader2Table.this.type
    Definition Classes
    HasReaderProperties
  95. def setDefault[T](feature: StructFeature[T], value: () ⇒ T): Reader2Table.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  96. def setDefault[K, V](feature: MapFeature[K, V], value: () ⇒ Map[K, V]): Reader2Table.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  97. def setDefault[T](feature: SetFeature[T], value: () ⇒ Set[T]): Reader2Table.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  98. def setDefault[T](feature: ArrayFeature[T], value: () ⇒ Array[T]): Reader2Table.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  99. final def setDefault(paramPairs: ParamPair[_]*): Reader2Table.this.type
    Attributes
    protected
    Definition Classes
    Params
  100. final def setDefault[T](param: Param[T], value: T): Reader2Table.this.type
    Attributes
    protected[org.apache.spark.ml]
    Definition Classes
    Params
  101. def setExcludeNonText(value: Boolean): Reader2Table.this.type

    Excludes rows that are not text data.

    Excludes rows that are not text data. e.g. tables

    Definition Classes
    Reader2Doc
  102. def setExplodeDocs(value: Boolean): Reader2Table.this.type
    Definition Classes
    Reader2Doc
  103. def setFlattenOutput(value: Boolean): Reader2Table.this.type
    Definition Classes
    Reader2Doc
  104. def setGroupBrokenParagraphs(value: Boolean): Reader2Table.this.type
    Definition Classes
    HasTextReaderProperties
  105. def setHeaders(value: Map[String, String]): Reader2Table.this.type
    Definition Classes
    HasHTMLReaderProperties
  106. def setHeadersPython(headers: Map[String, String]): Reader2Table.this.type
    Definition Classes
    HasHTMLReaderProperties
  107. def setIncludePageBreaks(value: Boolean): Reader2Table.this.type
    Definition Classes
    HasReaderProperties
  108. def setIncludeSlideNotes(value: Boolean): Reader2Table.this.type
    Definition Classes
    HasPowerPointProperties
  109. def setIncludeTitleTag(value: Boolean): Reader2Table.this.type
    Definition Classes
    HasHTMLReaderProperties
  110. def setInferTableStructure(value: Boolean): Reader2Table.this.type
    Definition Classes
    HasReaderProperties
  111. def setMaxLineCount(value: Int): Reader2Table.this.type
    Definition Classes
    HasTextReaderProperties
  112. def setOnlyLeafNodes(value: Boolean): Reader2Table.this.type
    Definition Classes
    HasXmlReaderProperties
  113. def setOutputAsDocument(value: Boolean): Reader2Table.this.type

    Whether to return all sentences joined into a single document

    Whether to return all sentences joined into a single document

    Definition Classes
    Reader2Doc
  114. final def setOutputCol(value: String): Reader2Table.this.type

    Overrides annotation column name when transforming

    Overrides annotation column name when transforming

    Definition Classes
    HasOutputAnnotationCol
  115. def setOutputFormat(value: String): Reader2Table.this.type
    Definition Classes
    HasHTMLReaderProperties
  116. def setParagraphSplit(value: String): Reader2Table.this.type
    Definition Classes
    HasTextReaderProperties
  117. def setShortLineWordThreshold(value: Int): Reader2Table.this.type
    Definition Classes
    HasTextReaderProperties
  118. def setStoreContent(value: Boolean): Reader2Table.this.type
    Definition Classes
    HasReaderProperties
  119. def setThreshold(value: Double): Reader2Table.this.type
    Definition Classes
    HasTextReaderProperties
  120. def setTimeout(value: Int): Reader2Table.this.type
    Definition Classes
    HasHTMLReaderProperties
  121. def setTitleFontSize(value: Int): Reader2Table.this.type
    Definition Classes
    HasReaderProperties
  122. def setTitleLengthSize(value: Int): Reader2Table.this.type
    Definition Classes
    HasTextReaderProperties
  123. def setTitleThreshold(value: Float): Reader2Table.this.type
    Definition Classes
    Reader2Doc
  124. def setXmlKeepTags(value: Boolean): Reader2Table.this.type
    Definition Classes
    HasXmlReaderProperties
  125. val shortLineWordThreshold: Param[Int]
    Definition Classes
    HasTextReaderProperties
  126. val storeContent: Param[Boolean]
    Definition Classes
    HasReaderProperties
  127. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  128. val threshold: Param[Double]
    Definition Classes
    HasTextReaderProperties
  129. val timeout: Param[Int]
    Definition Classes
    HasHTMLReaderProperties
  130. val titleFontSize: Param[Int]
    Definition Classes
    HasReaderProperties
  131. val titleLengthSize: Param[Int]
    Definition Classes
    HasTextReaderProperties
  132. val titleThreshold: Param[Float]
    Definition Classes
    Reader2Doc
  133. def toString(): String
    Definition Classes
    Identifiable → AnyRef → Any
  134. def transform(dataset: Dataset[_]): DataFrame
    Definition Classes
    Reader2TableReader2Doc → Transformer
  135. def transform(dataset: Dataset[_], paramMap: ParamMap): DataFrame
    Definition Classes
    Transformer
    Annotations
    @Since( "2.0.0" )
  136. def transform(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): DataFrame
    Definition Classes
    Transformer
    Annotations
    @Since( "2.0.0" ) @varargs()
  137. def transformSchema(schema: StructType): StructType
    Definition Classes
    Reader2Doc → PipelineStage
  138. def transformSchema(schema: StructType, logging: Boolean): StructType
    Attributes
    protected
    Definition Classes
    PipelineStage
    Annotations
    @DeveloperApi()
  139. val uid: String
    Definition Classes
    Reader2TableReader2Doc → Identifiable
  140. def validateRequiredParameters(): Unit
    Definition Classes
    Reader2TableReader2Doc
  141. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  142. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  143. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  144. def write: MLWriter
    Definition Classes
    ParamsAndFeaturesWritable → DefaultParamsWritable → MLWritable
  145. val xmlKeepTags: Param[Boolean]
    Definition Classes
    HasXmlReaderProperties

Inherited from Reader2Doc

Inherited from HasXmlReaderProperties

Inherited from HasTextReaderProperties

Inherited from HasPowerPointProperties

Inherited from HasHTMLReaderProperties

Inherited from HasExcelReaderProperties

Inherited from HasEmailReaderProperties

Inherited from HasReaderProperties

Inherited from ParamsAndFeaturesWritable

Inherited from HasFeatures

Inherited from HasOutputAnnotationCol

Inherited from HasOutputAnnotatorType

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

param

Ungrouped