class_docstr: TextSet wraps a set of texts with status.
class_docstr_tok: ["TextSet","wraps","a","set","of","texts","with","status","."]
docstr: Read text files with labels from a directory.
  The folder structure is expected to be the following:
  path
    |dir1 - text1, text2, ...
    |dir2 - text1, text2, ...
    |dir3 - text1, text2, ...
  Under the target path, there ought to be N subdirectories (dir1 to dirN). Each
  subdirectory represents a category and contains all texts that belong to such
  category. Each category will be a given a label according to its position in the
  ascending order sorted among all subdirectories.
  All texts will be given a label according to the subdirectory where it is located.
  Labels start from 0.
  
  :param path: The folder path to texts. Local or distributed file system (such as HDFS)
               are supported. If you want to read from a distributed file system, sc
               needs to be specified.
  :param sc: An instance of SparkContext.
             If specified, texts will be read as a DistributedTextSet.
             Default is None and in this case texts will be read as a LocalTextSet.
  :param min_partitions: Int. A suggestion value of the minimal partition number for input
                         texts. Only need to specify this when sc is not None. Default is 1.
  
  :return: TextSet.
docstr_tok: ["Read","text","files","with","labels","from","a","directory",".","The","folder","structure","is","expected","to","be","the","following",":","path","|dir1","-","text1",",","text2",",","...","|dir2","-","text1",",","text2",",","...","|dir3","-","text1",",","text2",",","...","Under","the","target","path",",","there","ought","to","be","N","subdirectories","(","dir1","to","dirN",")",".","Each","subdirectory","represents","a","category","and","contains","all","texts","that","belong","to","such","category",".","Each","category","will","be","a","given","a","label","according","to","its","position","in","the","ascending","order","sorted","among","all","subdirectories",".","All","texts","will","be","given","a","label","according","to","the","subdirectory","where","it","is","located",".","Labels","start","from","0.",":","param","path",":","The","folder","path","to","texts",".","Local","or","distributed","file","system","(","such","as","HDFS",")","are","supported",".","If","you","want","to","read","from","a","distributed","file","system",",","sc","needs","to","be","specified",".",":","param","sc",":","An","instance","of","SparkContext",".","If","specified",",","texts","will","be","read","as","a","DistributedTextSet",".","Default","is","None","and","in","this","case","texts","will","be","read","as","a","LocalTextSet",".",":","param","min_partitions",":","Int",".","A","suggestion","value","of","the","minimal","partition","number","for","input","texts",".","Only","need","to","specify","this","when","sc","is","not","None",".","Default","is","1.",":","return",":","TextSet","."]
code: def read(cls, path, sc=None, min_partitions=1, bigdl_type="float"):
      """
      Read text files with labels from a directory.
      The folder structure is expected to be the following:
      path
        |dir1 - text1, text2, ...
        |dir2 - text1, text2, ...
        |dir3 - text1, text2, ...
      Under the target path, there ought to be N subdirectories (dir1 to dirN). Each
      subdirectory represents a category and contains all texts that belong to such
      category. Each category will be a given a label according to its position in the
      ascending order sorted among all subdirectories.
      All texts will be given a label according to the subdirectory where it is located.
      Labels start from 0.
  
      :param path: The folder path to texts. Local or distributed file system (such as HDFS)
                   are supported. If you want to read from a distributed file system, sc
                   needs to be specified.
      :param sc: An instance of SparkContext.
                 If specified, texts will be read as a DistributedTextSet.
                 Default is None and in this case texts will be read as a LocalTextSet.
      :param min_partitions: Int. A suggestion value of the minimal partition number for input
                             texts. Only need to specify this when sc is not None. Default is 1.
  
      :return: TextSet.
      """
      jvalue = callZooFunc(
          bigdl_type, "readTextSet", path, sc, min_partitions
      )
      return TextSet(jvalue=jvalue)
  
imports: import six
  from bigdl.util.common import JavaValue
  from zoo.common.utils import callZooFunc
  from pyspark import RDD
label_desc: Use image node_id 23 for calling the TextSet obj's underlying member method code with example usage: obj.read(cls, path, sc, min_partitions, bigdl_type) and returns: TextSet